ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4TriangularFacet.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4TriangularFacet.hh
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration and of QinetiQ Ltd, *
20
// * subject to DEFCON 705 IPR conditions. *
21
// * By using, copying, modifying or distributing the software (or *
22
// * any work based on the software) you agree to acknowledge its *
23
// * use in resulting scientific publications, and indicate your *
24
// * acceptance of all terms of the Geant4 Software license. *
25
// ********************************************************************
26
//
27
// G4TriangularFacet
28
//
29
// Class description:
30
//
31
// The G4TriangularFacet class is used for the contruction of
32
// G4TessellatedSolid.
33
// It is defined by three fVertices, which shall be supplied in anti-clockwise
34
// order looking from the outsider of the solid where it belongs.
35
// Its constructor:
36
//
37
// G4TriangularFacet (const G4ThreeVector Pt0, const G4ThreeVector vt1,
38
// const G4ThreeVector vt2, G4FacetVertexType);
39
//
40
// takes 4 parameters to define the three fVertices:
41
// 1) G4FacetvertexType = "ABSOLUTE": in this case Pt0, vt1 and vt2 are
42
// the 3 fVertices in anti-clockwise order looking from the outsider.
43
// 2) G4FacetvertexType = "RELATIVE": in this case the first vertex is Pt0,
44
// the second vertex is Pt0+vt1 and the third vertex is Pt0+vt2, all
45
// in anti-clockwise order when looking from the outsider.
46
47
// 31 October 2004, P R Truscott, QinetiQ Ltd, UK - Created.
48
// 12 October 2012, M Gayer, CERN, - Reviewed optimized implementation.
49
// --------------------------------------------------------------------
50
#ifndef G4TRIANGULARFACET_HH
51
#define G4TRIANGULARFACET_HH 1
52
53
#include "
G4VFacet.hh
"
54
#include "
G4Types.hh
"
55
#include "
G4ThreeVector.hh
"
56
57
#include <vector>
58
#include <array>
59
60
class
G4TriangularFacet
:
public
G4VFacet
61
{
62
public
:
// with desctiption
63
64
G4TriangularFacet
();
65
~G4TriangularFacet
();
66
67
G4TriangularFacet
(
const
G4ThreeVector
& vt0,
const
G4ThreeVector
& vt1,
68
const
G4ThreeVector
& vt2,
G4FacetVertexType
);
69
G4TriangularFacet
(
const
G4TriangularFacet
&
right
);
70
G4TriangularFacet
(
G4TriangularFacet
&& right);
71
72
G4TriangularFacet
&
operator=
(
const
G4TriangularFacet
& right);
73
G4TriangularFacet
&
operator=
(
G4TriangularFacet
&& right);
74
75
G4VFacet
*
GetClone
();
76
G4TriangularFacet
*
GetFlippedFacet
();
77
78
G4ThreeVector
Distance
(
const
G4ThreeVector
&
p
);
79
G4double
Distance
(
const
G4ThreeVector
& p,
G4double
minDist);
80
G4double
Distance
(
const
G4ThreeVector
& p,
G4double
minDist,
81
const
G4bool
outgoing);
82
G4double
Extent
(
const
G4ThreeVector
axis);
83
G4bool
Intersect
(
const
G4ThreeVector
& p,
const
G4ThreeVector
&
v
,
84
const
G4bool
outgoing,
G4double
& distance,
85
G4double
& distFromSurface,
G4ThreeVector
&
normal
);
86
G4double
GetArea
()
const
;
87
G4ThreeVector
GetPointOnFace
()
const
;
88
89
G4ThreeVector
GetSurfaceNormal
()
const
;
90
void
SetSurfaceNormal
(
G4ThreeVector
normal);
91
92
G4GeometryType
GetEntityType
()
const
;
93
94
inline
G4bool
IsDefined
()
const
;
95
inline
G4int
GetNumberOfVertices
()
const
;
96
inline
G4ThreeVector
GetVertex
(
G4int
i)
const
;
97
inline
void
SetVertex
(
G4int
i,
const
G4ThreeVector
& val);
98
99
inline
G4ThreeVector
GetCircumcentre
()
const
;
100
inline
G4double
GetRadius
()
const
;
101
102
inline
G4int
AllocatedMemory
();
103
104
inline
G4int
GetVertexIndex
(
G4int
i)
const
;
105
inline
void
SetVertexIndex
(
G4int
i,
G4int
j);
106
inline
void
SetVertices
(std::vector<G4ThreeVector>* v);
107
108
private
:
109
110
void
CopyFrom
(
const
G4TriangularFacet
& rhs);
111
void
MoveFrom
(
G4TriangularFacet
& rhs);
112
113
G4ThreeVector
fSurfaceNormal
;
114
G4double
fArea
= 0.0;
115
G4ThreeVector
fCircumcentre
;
116
G4double
fRadius
= 0.0;
117
std::array<G4int, 3>
fIndices
;
118
std::vector<G4ThreeVector>*
fVertices
=
nullptr
;
119
120
G4double
fA
,
fB
,
fC
;
121
G4double
fDet
;
122
G4double
fSqrDist
= 0.0;
123
G4ThreeVector
fE1
,
fE2
;
124
G4bool
fIsDefined
=
false
;
125
};
126
127
// --------------------------------------------------------------------
128
// Inlined Methods
129
// --------------------------------------------------------------------
130
131
inline
G4bool
G4TriangularFacet::IsDefined
()
const
132
{
133
return
fIsDefined
;
134
}
135
136
inline
G4int
G4TriangularFacet::GetNumberOfVertices
()
const
137
{
138
return
3;
139
}
140
141
inline
G4ThreeVector
G4TriangularFacet::GetVertex
(
G4int
i)
const
142
{
143
G4int
indice =
fIndices
[i];
144
return
indice < 0 ? (*fVertices)[i] : (*fVertices)[indice];
145
}
146
147
inline
void
G4TriangularFacet::SetVertex
(
G4int
i,
const
G4ThreeVector
& val)
148
{
149
(*fVertices)[i] = val;
150
}
151
152
inline
G4ThreeVector
G4TriangularFacet::GetCircumcentre
()
const
153
{
154
return
fCircumcentre
;
155
}
156
157
inline
G4double
G4TriangularFacet::GetRadius
()
const
158
{
159
return
fRadius
;
160
}
161
162
inline
G4int
G4TriangularFacet::AllocatedMemory
()
163
{
164
G4int
size =
sizeof
(*this);
165
size +=
GetNumberOfVertices
() *
sizeof
(
G4ThreeVector
);
166
return
size;
167
}
168
169
inline
G4int
G4TriangularFacet::GetVertexIndex
(
G4int
i)
const
170
{
171
if
(i < 3)
return
fIndices
[i];
172
else
return
999999999;
173
}
174
175
inline
void
G4TriangularFacet::SetVertexIndex
(
G4int
i,
G4int
j)
176
{
177
fIndices
[i] = j;
178
}
179
180
inline
void
G4TriangularFacet::SetVertices
(std::vector<G4ThreeVector>*
v
)
181
{
182
if
(
fIndices
[0] < 0 &&
fVertices
)
183
{
184
delete
fVertices
;
185
fVertices
=
nullptr
;
186
}
187
fVertices
=
v
;
188
}
189
190
#endif
geant4
tree
geant4-10.6-release
source
geometry
solids
specific
include
G4TriangularFacet.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:19
using
1.8.2 with
ECCE GitHub integration