Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
plane.h
Go to the documentation of this file.
1#ifndef PLANE_H
2#define PLANE_H
3/*
4Plane defined by point and vector. The vector is normal to plane.
5
6Copyright (c) 2000 Igor B. Smirnov
7
8The file can be used, copied, modified, and distributed
9according to the terms of GNU Lesser General Public License version 2.1
10as published by the Free Software Foundation,
11and provided that the above copyright notice, this permission notice,
12and notices about any modifications of the original text
13appear in all copies and in supporting documentation.
14The file is provided "as is" without express or implied warranty.
15*/
16
19
20namespace Heed {
21
22// **** plane ****
23
24class polyline;
25
26class plane : public absref {
27 protected:
28 point piv; // origin point, pivot
29 vec dir; // direction of normal, unit vector
30 public:
31 point Gpiv(void) const {
32 return piv;
33 }
34 vec Gdir(void) const {
35 return dir;
36 }
37
38 protected:
39 virtual void get_components(ActivePtr<absref_transmit>& aref_tran);
40 static absref(absref::* aref[2]);
41
42 public:
43
44 plane() : piv(), dir() { ; }
45 plane(const point& fpiv, const vec& fdir) : piv(fpiv), dir(unit_vec(fdir)) {
46 ;
47 }
48 plane(const straight& sl, const point& pt);
49 plane(const straight& sl1, const straight& sl2, vfloat prec);
50 // good if lines are crossed or if they are different not crossed parallel.
51 // Otherwise vecerror != 0
52 // Prec is used for crossing of lines.
53
54 plane& operator=(const plane& fpl) {
55 piv = fpl.piv;
56 dir = fpl.dir;
57 return *this;
58 }
59
60 friend int operator==(const plane& pl1, const plane& pl2);
61 friend int operator!=(const plane& pl1, const plane& pl2) {
62 return pl1 == pl2 ? 0 : 1;
63 }
64 friend int apeq(const plane& pl1, const plane& pl2, vfloat prec);
65 friend int not_apeq(const plane& pl1, const plane& pl2, vfloat prec) {
66 return apeq(pl1, pl2, prec) ? 0 : 1;
67 }
68 int check_point_in(const point& fp, vfloat prec) const;
69 // returns 1 if point in the planeCalculates distance
70 // and compares it with prec
71
72 point cross(const straight& sl) const;
73 // figure out whether the plane is crossed by straight line
74 // and return point if it is.
75 // straight is parallel(exactly) to plane but is not in plane,
76 // different parallel vecerror=2
77 // the straight line is in plane(exactly) vecerror=3
78
79 straight cross(const plane& sl) const;
80 // different parallel vecerror=2
81 // the same planes vecerror=3
82
83 int cross(const polyline& pll, point* crpt, int& qcrpt, polyline* crpll,
84 int& qcrpll, vfloat prec) const;
85
86 vfloat distance(const point& fpt) const;
87 friend std::ostream& operator<<(std::ostream& file, const plane& s);
88};
89
90std::ostream& operator<<(std::ostream& file, const plane& s);
91
92}
93
95
96#endif
plane & operator=(const plane &fpl)
Definition: plane.h:54
static absrefabsref::*[2] aref
Definition: plane.h:40
point cross(const straight &sl) const
Definition: plane.cpp:77
plane()
Definition: plane.h:44
point Gpiv(void) const
Definition: plane.h:31
friend int not_apeq(const plane &pl1, const plane &pl2, vfloat prec)
Definition: plane.h:65
friend std::ostream & operator<<(std::ostream &file, const plane &s)
Definition: plane.cpp:160
friend int apeq(const plane &pl1, const plane &pl2, vfloat prec)
Definition: plane.cpp:60
point piv
Definition: plane.h:28
friend int operator!=(const plane &pl1, const plane &pl2)
Definition: plane.h:61
vec dir
Definition: plane.h:29
friend int operator==(const plane &pl1, const plane &pl2)
Definition: plane.cpp:49
plane(const point &fpiv, const vec &fdir)
Definition: plane.h:45
vec Gdir(void) const
Definition: plane.h:34
int check_point_in(const point &fp, vfloat prec) const
Definition: plane.cpp:70
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: plane.cpp:21
vfloat distance(const point &fpt) const
Definition: plane.cpp:153
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