Garfield++ v1r0
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/*
6Circumference determined by point (center), vector (normal), and radious.
7
8Copyright (c) 2000 Igor B. Smirnov
9
10The file can be used, copied, modified, and distributed
11according to the terms of GNU Lesser General Public License version 2.1
12as published by the Free Software Foundation,
13and provided that the above copyright notice, this permission notice,
14and notices about any modifications of the original text
15appear in all copies and in supporting documentation.
16The file is provided "as is" without express or implied warranty.
17*/
18
19namespace Heed {
20
21class plane;
22
23// **** circumference ****
24
25class circumf : public absref {
26 protected:
27 point piv; // central point, pivot
28 vec dir; // normal direction, unit vector
29 // circles with dir and -dir are considered the same
30 vfloat rad; // radius, >0
31 public:
32 // return one any point of line
33 point Gpiv(void) const { return piv; }
34 // return any direction
35 vec Gdir(void) const { return dir; }
36 vfloat Grad(void) const { return rad; }
37
38 protected:
39 virtual void get_components(ActivePtr<absref_transmit>& aref_tran);
40 static absref(absref::* aref[2]);
41
42 public:
43 // constructors
44 circumf();
45 circumf(const point& fpiv, const vec& fdir, vfloat frad);
46 circumf(const circumf& f);
48 piv = f.piv;
49 dir = f.dir;
50 rad = f.rad;
51 return *this;
52 }
53 // destructor
54 virtual ~circumf() {}
55 friend int operator==(const circumf& f1, const circumf& f2);
56 friend int operator!=(const circumf& f1, const circumf& f2) {
57 return f1 == f2 ? 0 : 1;
58 }
59 friend int apeq(const circumf& f1, const circumf& f2, vfloat prec);
60 friend int not_apeq(const circumf& f1, const circumf& f2, vfloat prec) {
61 return apeq(f1, f2, prec) == 1 ? 0 : 1;
62 }
63 // return 1 if point on the circumference
64 int check_point_in(const point& fp, vfloat prec) const;
65 // return number of crosses and calculates pt.
66 // if total circle lies in the plane, it returns -1.
67 // prec allow to switch to one point if it is almost one
68 int cross(const plane& pn, point pt[2], vfloat prec) const;
69
70 friend std::ostream& operator<<(std::ostream& file, const circumf& f);
71};
72std::ostream& operator<<(std::ostream& file, const circumf& f);
73
74}
75
76#endif
point Gpiv(void) const
Definition: circumf.h:33
friend std::ostream & operator<<(std::ostream &file, const circumf &f)
Definition: circumf.cpp:86
int cross(const plane &pn, point pt[2], vfloat prec) const
Definition: circumf.cpp:60
friend int operator!=(const circumf &f1, const circumf &f2)
Definition: circumf.h:56
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: circumf.cpp:32
vfloat rad
Definition: circumf.h:30
static absrefabsref::*[2] aref
Definition: circumf.h:40
vec Gdir(void) const
Definition: circumf.h:35
int check_point_in(const point &fp, vfloat prec) const
Definition: circumf.cpp:52
circumf & operator=(const circumf &f)
Definition: circumf.h:47
friend int operator==(const circumf &f1, const circumf &f2)
Definition: circumf.cpp:36
virtual ~circumf()
Definition: circumf.h:54
friend int not_apeq(const circumf &f1, const circumf &f2, vfloat prec)
Definition: circumf.h:60
vfloat Grad(void) const
Definition: circumf.h:36
friend int apeq(const circumf &f1, const circumf &f2, vfloat prec)
Definition: circumf.cpp:45
point piv
Definition: circumf.h:27
Definition: vec.h:134
Definition: vec.h:477
Definition: vec.h:248
Definition: BGMesh.cpp:3
std::ostream & operator<<(std::ostream &file, const BGMesh &bgm)
Definition: BGMesh.cpp:22
double vfloat
Definition: vfloat.h:15