Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Heed::circumf Class Reference

#include <circumf.h>

+ Inheritance diagram for Heed::circumf:

Public Member Functions

point Gpiv (void) const
 
vec Gdir (void) const
 
vfloat Grad (void) const
 
 circumf ()
 
 circumf (const point &fpiv, const vec &fdir, vfloat frad)
 
 circumf (const circumf &f)
 
circumfoperator= (const circumf &f)
 
virtual ~circumf ()
 
int check_point_in (const point &fp, vfloat prec) const
 
int cross (const plane &pn, point pt[2], vfloat prec) const
 
- Public Member Functions inherited from absref
virtual ~absref ()
 
virtual void down (const abssyscoor *fasc)
 
virtual void up (const abssyscoor *fasc)
 
virtual void turn (const vec &dir, vfloat angle)
 
virtual void shift (const vec &dir)
 

Protected Member Functions

virtual void get_components (ActivePtr< absref_transmit > &aref_tran)
 

Protected Attributes

point piv
 
vec dir
 
vfloat rad
 

Static Protected Attributes

static absrefabsref::*[2] aref
 

Friends

int operator== (const circumf &f1, const circumf &f2)
 
int operator!= (const circumf &f1, const circumf &f2)
 
int apeq (const circumf &f1, const circumf &f2, vfloat prec)
 
int not_apeq (const circumf &f1, const circumf &f2, vfloat prec)
 
std::ostream & operator<< (std::ostream &file, const circumf &f)
 

Detailed Description

Definition at line 25 of file circumf.h.

Constructor & Destructor Documentation

◆ circumf() [1/3]

Heed::circumf::circumf ( )

Definition at line 20 of file circumf.cpp.

20: piv(), dir(), rad(0) {}
vfloat rad
Definition: circumf.h:30
point piv
Definition: circumf.h:27

◆ circumf() [2/3]

Heed::circumf::circumf ( const point fpiv,
const vec fdir,
vfloat  frad 
)

Definition at line 21 of file circumf.cpp.

22 : piv(fpiv), dir(), rad(frad) {
23 pvecerror("circumf(...)");
24 check_econd11(length(fdir), == 0, mcerr);
25 dir = unit_vec(fdir);
26}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
#define mcerr
Definition: prstream.h:135
#define pvecerror(string)
Definition: vec.h:52

◆ circumf() [3/3]

Heed::circumf::circumf ( const circumf f)

Definition at line 27 of file circumf.cpp.

28 : absref(f), piv(f.piv), dir(f.dir), rad(f.rad) {
29 ;
30}
Definition: vec.h:134

◆ ~circumf()

virtual Heed::circumf::~circumf ( )
inlinevirtual

Definition at line 54 of file circumf.h.

54{}

Member Function Documentation

◆ check_point_in()

int Heed::circumf::check_point_in ( const point fp,
vfloat  prec 
) const

Definition at line 52 of file circumf.cpp.

52 {
53 // returns 1 if point on the circumference
54 pvecerror("int circumf::check_point_in(const point &fp, vfloat prec) const");
55 vec d = fp - piv;
56 if (check_perp(d, dir, prec) != 1) return 0;
57 if (apeq(length(d), rad)) return 1;
58 return 0;
59}
friend int apeq(const circumf &f1, const circumf &f2, vfloat prec)
Definition: circumf.cpp:45
Definition: vec.h:248

◆ cross()

int Heed::circumf::cross ( const plane pn,
point  pt[2],
vfloat  prec 
) const

Definition at line 60 of file circumf.cpp.

60 {
61 pvecerror("int circumf::cross(const plane& pn, point pt[2]) const");
62 if (pn.distance(piv) > rad) return 0; // to avoid cross at very far pn
63 plane pnc(piv, dir);
64 straight sl(pnc, pn);
65 if (vecerror == 3) {
66 vecerror = 0;
67 return -1;
68 }
69 if (vecerror == 2) {
70 vecerror = 0;
71 return 0;
72 }
73 point closest_pt;
74 vfloat d = sl.distance(piv, closest_pt);
75 if (apeq(d, rad, prec)) {
76 pt[0] = closest_pt;
77 return 1;
78 }
79 if (d > rad) return 0;
80 vfloat cat = sqrt(rad * rad - d * d);
81 pt[0] = closest_pt + cat * sl.Gdir();
82 pt[1] = closest_pt - cat * sl.Gdir();
83 return 2;
84}
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
Definition: vec.h:477
int vecerror
Definition: vec.cpp:31
double vfloat
Definition: vfloat.h:15

Referenced by Heed::splane::range().

◆ Gdir()

vec Heed::circumf::Gdir ( void  ) const
inline

Definition at line 35 of file circumf.h.

35{ return dir; }

Referenced by Heed::splane::range().

◆ get_components()

void Heed::circumf::get_components ( ActivePtr< absref_transmit > &  aref_tran)
protectedvirtual

Reimplemented from absref.

Definition at line 32 of file circumf.cpp.

32 {
33 aref_tran.pass(new absref_transmit(2, aref));
34}
static absrefabsref::*[2] aref
Definition: circumf.h:40

◆ Gpiv()

point Heed::circumf::Gpiv ( void  ) const
inline

Definition at line 33 of file circumf.h.

33{ return piv; }

Referenced by Heed::splane::range().

◆ Grad()

vfloat Heed::circumf::Grad ( void  ) const
inline

Definition at line 36 of file circumf.h.

36{ return rad; }

Referenced by Heed::splane::range().

◆ operator=()

circumf & Heed::circumf::operator= ( const circumf f)
inline

Definition at line 47 of file circumf.h.

47 {
48 piv = f.piv;
49 dir = f.dir;
50 rad = f.rad;
51 return *this;
52 }

Friends And Related Function Documentation

◆ apeq

int apeq ( const circumf f1,
const circumf f2,
vfloat  prec 
)
friend

Definition at line 45 of file circumf.cpp.

45 {
46 pvecerror("int apeq(const circumf &f1, const circumf &f2, vfloat prec)");
47 if (check_par(f1.dir, f2.dir, prec) == 0) return 0;
48 if (apeq(f1.piv, f2.piv, prec) && apeq(f1.rad, f2.rad, prec)) return 1;
49 return 0;
50}

Referenced by check_point_in(), and cross().

◆ not_apeq

int not_apeq ( const circumf f1,
const circumf f2,
vfloat  prec 
)
friend

Definition at line 60 of file circumf.h.

60 {
61 return apeq(f1, f2, prec) == 1 ? 0 : 1;
62 }

◆ operator!=

int operator!= ( const circumf f1,
const circumf f2 
)
friend

Definition at line 56 of file circumf.h.

56 {
57 return f1 == f2 ? 0 : 1;
58 }

◆ operator<<

std::ostream & operator<< ( std::ostream &  file,
const circumf f 
)
friend

Definition at line 86 of file circumf.cpp.

86 {
87 Ifile << "circumf(erence):\n";
88 indn.n += 2;
89 Ifile << "rad=" << f.rad << '\n';
90 file << f.piv << f.dir;
91 indn.n -= 2;
92 return file;
93}
indentation indn
Definition: prstream.cpp:13
#define Ifile
Definition: prstream.h:207

◆ operator==

int operator== ( const circumf f1,
const circumf f2 
)
friend

Definition at line 36 of file circumf.cpp.

36 {
37 pvecerror("int operator==(const circumf &f1, const circumf &f2)");
38
39 if (!(f1.dir == f2.dir || f1.dir == -f2.dir)) return 0;
40 if (f1.piv == f2.piv && f1.rad == f2.rad)
41 return 1;
42 else
43 return 0;
44}

Member Data Documentation

◆ aref

absref absref::* Heed::circumf::aref
staticprotected
Initial value:

Definition at line 40 of file circumf.h.

Referenced by get_components().

◆ dir

vec Heed::circumf::dir
protected

Definition at line 28 of file circumf.h.

Referenced by check_point_in(), circumf(), cross(), Gdir(), and operator=().

◆ piv

point Heed::circumf::piv
protected

Definition at line 27 of file circumf.h.

Referenced by check_point_in(), cross(), Gpiv(), and operator=().

◆ rad

vfloat Heed::circumf::rad
protected

Definition at line 30 of file circumf.h.

Referenced by check_point_in(), cross(), Grad(), and operator=().


The documentation for this class was generated from the following files: