EGSnrc C++ class library
Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs++
egs_projectors.cpp
Go to the documentation of this file.
1
/*
2
###############################################################################
3
#
4
# EGSnrc egs++ projectors
5
# Copyright (C) 2015 National Research Council Canada
6
#
7
# This file is part of EGSnrc.
8
#
9
# EGSnrc is free software: you can redistribute it and/or modify it under
10
# the terms of the GNU Affero General Public License as published by the
11
# Free Software Foundation, either version 3 of the License, or (at your
12
# option) any later version.
13
#
14
# EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17
# more details.
18
#
19
# You should have received a copy of the GNU Affero General Public License
20
# along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21
#
22
###############################################################################
23
#
24
# Author: Iwan Kawrakow, 2005
25
#
26
# Contributors: Reid Townson
27
#
28
###############################################################################
29
*/
30
31
37
#include "
egs_projectors.h
"
38
#include "
egs_functions.h
"
39
40
EGS_Projector::EGS_Projector
(
const
EGS_Vector
&A,
const
string
&Type) :
41
a(A), xo(
EGS_Vector
()), d(0), type(Type) {
42
norm = a.length();
43
a.normalize();
44
if
(a.
x
*a.
x
+ a.
y
*a.
y
> 0) {
45
v1 =
EGS_Vector
(-a.
y
,a.
x
,0);
46
v1.normalize();
47
}
48
else
{
49
v1 =
EGS_Vector
(1,0,0);
50
}
51
v2 = a%v1;
52
}
53
54
EGS_Projector::EGS_Projector
(
const
EGS_Vector
&x1,
const
EGS_Vector
&x2,
55
const
EGS_Vector
&x3,
const
string
&T) : type(T) {
56
v1 = x2-x1;
57
v2 = x3-x1;
58
a = v1%v2;
59
xo = x1;
60
if
(a.length2() <
epsilon
)
egsFatal
(
"EGS_Projector::EGS_Projector: "
61
" the vectors are co-linear\n"
);
62
a.normalize();
63
norm = 1;
64
v1.normalize();
65
v2 = a%v1;
66
d = a*x1;
67
}
68
69
void
EGS_Projector::printInfo
()
const
{
70
egsInformation
(
" normal = (%g,%g,%g)\n"
,a.
x
,a.
y
,a.
z
);
71
};
EGS_Projector::EGS_Projector
EGS_Projector(const EGS_Vector &A, const string &Type)
Construct a projector named Type. for a plane with plane normal A.
Definition:
egs_projectors.cpp:40
EGS_Projector::printInfo
void printInfo() const
Print some info about this projector using egsInformation.
Definition:
egs_projectors.cpp:69
EGS_Vector
A class representing 3D vectors.
Definition:
egs_vector.h:57
EGS_Vector::y
EGS_Float y
y-component
Definition:
egs_vector.h:62
EGS_Vector::z
EGS_Float z
z-component
Definition:
egs_vector.h:63
EGS_Vector::x
EGS_Float x
x-component
Definition:
egs_vector.h:61
egs_functions.h
Global egspp functions header file.
egs_projectors.h
EGS_Projector and EGS_2DVector class header file.
egsInformation
EGS_InfoFunction EGS_EXPORT egsInformation
Always use this function for reporting the progress of a simulation and any other type of information...
Definition:
egs_functions.cpp:135
egsFatal
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
Definition:
egs_functions.cpp:137
epsilon
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
Definition:
egs_functions.h:62
Generated by
1.9.1