Flow123d  jenkins-Flow123d-windows-release-multijob-285
plain.cpp
Go to the documentation of this file.
4 
5 using namespace mathfce;
6 
8 
10  return TPlain::numberInstance++;
11 }
12 
14  id = generateId();
15 
16  U = new TVector(0, 0, 0);
17  V = new TVector(0, 0, 0);
18  N = new TVector(0, 0, 0);
19  X = new TPoint(0, 0, 0);
20 
21  Compute();
22 }
23 
24 TPlain::TPlain(const TVector &UU, const TVector &VV, const TPoint &XX) {
25  id = generateId();
26 
27  U = new TVector(UU);
28  V = new TVector(VV);
29  N = new TVector(0, 0, 0);
30  X = new TPoint(XX);
31 
32  Compute();
33 }
34 
35 TPlain::TPlain(const TPoint &P1, const TPoint &P2, const TPoint &P3) {
36  id = generateId();
37 
38  U = new TVector(P1, P2);
39  V = new TVector(P1, P3);
40  N = new TVector(0, 0, 0);
41  X = new TPoint(P1);
42 
43  Compute();
44 }
45 
47  id = generateId();
48 
49  N = new TVector();
50  U = new TVector();
51  V = new TVector();
52  X = new TPoint();
53 
54  a = p.a;
55  b = p.b;
56  c = p.c;
57  d = p.d;
58 
59  *N = *p.N;
60  *U = *p.U;
61  *V = *p.V;
62  *X = *p.X;
63 }
64 
66  *N = Cross(*U, *V);
67  a = N->X1();
68  b = N->X2();
69  c = N->X3();
70  d = -a * X->X() - b * X->Y() - c * X->Z();
71  return;
72 }
73 
75  delete U;
76  delete V;
77  delete N;
78  delete X;
79 }
80 
81 double TPlain::GetA() const {
82  return a;
83 }
84 
85 double TPlain::GetB() const {
86  return b;
87 }
88 
89 double TPlain::GetC() const {
90  return c;
91 }
92 
93 double TPlain::GetD() const {
94  return d;
95 }
96 
97 const TVector &TPlain::GetNormal() const {
98  return *N;
99 }
100 
101 const TVector &TPlain::GetU() const {
102  return *U;
103 }
104 
105 const TVector &TPlain::GetV() const {
106  return *V;
107 }
108 
109 const TPoint &TPlain::GetPoint() const {
110  return *X;
111 }
112 
113 TPoint TPlain::GetPoint(double r, double s) const {
114  TPoint tmp;
115  tmp = r * *U + s * *V + *X;
116  return tmp;
117 }
118 
119 bool TPlain::Belong(const TPoint &P) const {
120  if (IsZero(Distance(*this, P)))
121  return true;
122  return false;
123 }
124 
126  a = p.a;
127  b = p.b;
128  c = p.c;
129  d = p.d;
130  *(*this).U = *p.U;
131  *(*this).V = *p.V;
132  *(*this).N = *p.N;
133  *(*this).X = *p.X;
134  return *this;
135 }
136 
137 void TPlain::SetPoints(const TPoint &P1, const TPoint &P2, const TPoint &P3) {
138  *U = (TPoint) P2 - P1;
139  *V = (TPoint) P3 - P1;
140  *X = P1;
141  Compute();
142 }
143 
double GetA() const
Definition: plain.cpp:81
double Distance(const TBisector &, const TPoint &)
static int numberInstance
Definition: plain.h:9
double a
Definition: plain.h:16
const TPoint & GetPoint() const
Definition: plain.cpp:109
double b
Definition: plain.h:17
double d
Definition: plain.h:19
double GetC() const
Definition: plain.cpp:89
void SetPoints(const TPoint &, const TPoint &, const TPoint &)
Definition: plain.cpp:137
TPoint * X
Definition: plain.h:21
Definition: plain.h:7
bool IsZero(double)
Definition: mathfce.cpp:5
int generateId()
Definition: plain.cpp:9
TVector * V
Definition: plain.h:13
TPlain()
Definition: plain.cpp:13
Definition: mathfce.h:9
const TVector & GetU() const
Definition: plain.cpp:101
Definition: point.h:10
double c
Definition: plain.h:18
double GetB() const
Definition: plain.cpp:85
TVector Cross(const TVector &, const TVector &)
Definition: vector.cpp:163
const TVector & GetV() const
Definition: plain.cpp:105
void Compute()
Definition: plain.cpp:65
bool Belong(const TPoint &) const
Definition: plain.cpp:119
TVector * U
Definition: plain.h:12
TVector * N
Definition: plain.h:14
TPlain & operator=(const TPlain &)
Definition: plain.cpp:125
const TVector & GetNormal() const
Definition: plain.cpp:97
double GetD() const
Definition: plain.cpp:93
~TPlain()
Definition: plain.cpp:74