Garfield++ v2r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
circumf.h
Go to the documentation of this file.
1#ifndef CIRCUMF_H
2#define CIRCUMF_H
3
5
6/*
7Copyright (c) 2000 Igor B. Smirnov
8
9The file can be used, copied, modified, and distributed
10according to the terms of GNU Lesser General Public License version 2.1
11as published by the Free Software Foundation,
12and provided that the above copyright notice, this permission notice,
13and notices about any modifications of the original text
14appear in all copies and in supporting documentation.
15The file is provided "as is" without express or implied warranty.
16*/
17
18namespace Heed {
19
20class plane;
21
22/// Circumference, determined by point (center), normal vector, and radius.
23class circumf : public absref {
24 public:
25 /// Default constructor.
26 circumf();
27 /// Constructor.
28 circumf(const point& fpiv, const vec& fdir, vfloat frad);
29 circumf(const circumf& f);
31 piv = f.piv;
32 dir = f.dir;
33 rad = f.rad;
34 return *this;
35 }
36 /// Destructor
37 virtual ~circumf() {}
38 friend int operator==(const circumf& f1, const circumf& f2);
39 friend int operator!=(const circumf& f1, const circumf& f2) {
40 return f1 == f2 ? 0 : 1;
41 }
42 friend bool apeq(const circumf& f1, const circumf& f2, vfloat prec);
43
44 point Gpiv() const { return piv; }
45 vec Gdir() const { return dir; }
46 vfloat Grad() const { return rad; }
47
48 /// Return 1 if point on the circumference.
49 int check_point_in(const point& fp, vfloat prec) const;
50 // return number of crosses and calculates pt.
51 // if total circle lies in the plane, it returns -1.
52 // prec allow to switch to one point if it is almost one
53 int cross(const plane& pn, point pt[2], vfloat prec) const;
54
55 friend std::ostream& operator<<(std::ostream& file, const circumf& f);
56
57 protected:
58 /// Central point, pivot.
60 /// Normal direction, unit vector.
61 /// Circles with dir and -dir are considered the same.
63 /// Radius, >0.
65
66 virtual void get_components(ActivePtr<absref_transmit>& aref_tran);
67 static absref(absref::*aref[2]);
68
69};
70std::ostream& operator<<(std::ostream& file, const circumf& f);
71}
72
73#endif
Active pointer or automatic container or controlling pointer.
Definition: AbsPtr.h:199
Circumference, determined by point (center), normal vector, and radius.
Definition: circumf.h:23
vfloat Grad() const
Definition: circumf.h:46
circumf()
Default constructor.
Definition: circumf.cpp:20
friend std::ostream & operator<<(std::ostream &file, const circumf &f)
Definition: circumf.cpp:84
int cross(const plane &pn, point pt[2], vfloat prec) const
Definition: circumf.cpp:58
friend int operator!=(const circumf &f1, const circumf &f2)
Definition: circumf.h:39
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: circumf.cpp:30
vec Gdir() const
Definition: circumf.h:45
friend bool apeq(const circumf &f1, const circumf &f2, vfloat prec)
Definition: circumf.cpp:44
point Gpiv() const
Definition: circumf.h:44
vfloat rad
Radius, >0.
Definition: circumf.h:64
static absrefabsref::*[2] aref
Definition: circumf.h:67
int check_point_in(const point &fp, vfloat prec) const
Return 1 if point on the circumference.
Definition: circumf.cpp:50
circumf & operator=(const circumf &f)
Definition: circumf.h:30
friend int operator==(const circumf &f1, const circumf &f2)
Definition: circumf.cpp:34
virtual ~circumf()
Destructor.
Definition: circumf.h:37
point piv
Central point, pivot.
Definition: circumf.h:59
Plane, defined by defined by a point and a vector normal to the plane.
Definition: plane.h:24
Point.
Definition: vec.h:374
Definition: vec.h:186
Definition: BGMesh.cpp:5
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:36
double vfloat
Definition: vfloat.h:16