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