Flow123d
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
flow123d
src
mesh
ngh
src
plain.cpp
Go to the documentation of this file.
1
#include "
mesh/ngh/include/plain.h
"
2
#include "
mesh/ngh/include/mathfce.h
"
3
#include "
mesh/ngh/include/intersection.h
"
4
5
using namespace
mathfce;
6
7
int
TPlain::numberInstance
= 0;
8
9
int
TPlain::generateId
() {
10
return
TPlain::numberInstance
++;
11
}
12
13
TPlain::TPlain
() {
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
46
TPlain::TPlain
(
const
TPlain
&p) {
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
65
void
TPlain::Compute
() {
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
74
TPlain::~TPlain
() {
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
125
TPlain
&
TPlain::operator =
(
const
TPlain
&p) {
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
Generated on Thu May 29 2014 23:14:49 for Flow123d by
1.8.4