EIC Software
Reference for
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
EicStlFacet.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EicStlFacet.cxx
1
//
2
// AYK (ayk@bnl.gov), 2014/01/08; revamped in Oct'2017;
3
//
4
// EicRoot CAD manipulation routines; STL facet class;
5
//
6
7
#include <assert.h>
8
9
#include <
EicStlFacet.h
>
10
11
// =======================================================================================
12
13
EicStlFacet::EicStlFacet
(
EicStlVertex
*
const
v1
,
EicStlVertex
*
const
v2
,
EicStlVertex
*
const
v3
):
14
mKey(NULL), mVertices(NULL), mCounter(0)
15
{
16
mVbuffer
.push_back(v1);
mVbuffer
.push_back(v2);
mVbuffer
.push_back(v3);
17
}
// EicStlFacet::EicStlFacet()
18
19
// ---------------------------------------------------------------------------------------
20
21
int
EicStlFacet::Calculate
(
void
)
22
{
23
// Move vertices to the ordered map;
24
mVertices
=
new
vEntry
(
EicStlKeyCompare
);
25
26
for
(
unsigned
iq=0; iq<3; iq++) {
27
EicStlVertex
*
vtx
=
mVbuffer
[iq];
28
29
// Potentially switch to the new (merged) vertices;
30
if
(vtx->
GetMergedVertex
()) vtx = vtx->
GetMergedVertex
();
31
32
(*mVertices)[vtx->
key
()] =
vtx
;
33
}
//for iq
34
35
// Do not need intermediate array any longer;
36
//mVbuffer.clear();
37
38
// Check, that there are no identical vertices;
39
if
(
mVertices
->size() != 3)
return
-1;
40
41
// And eventually compose the 3*3-double key;
42
mKey
=
GetVertexArrayKey
(
mVertices
);
43
44
// Now that all 3 vertices are "fixed", calculate normal vector; NB: it does not bear
45
// any orientation meaning here, just an "unsigned" direction;
46
{
47
TVector3 vv[3];
48
49
unsigned
counter = 0;
50
for
(vEntry::iterator
it
=
mVertices
->begin();
it
!=
mVertices
->end() ;
it
++)
51
vv[counter++] = TVector3(
it
->second->key()->GetData());
52
53
TVector3 dv21 = vv[1] - vv[0], dv32 = vv[2] - vv[1];
54
mNormal
= dv21.Cross(dv32).Unit();
55
}
56
57
return
0;
58
}
// EicStlFacet::Calculate()
59
60
// =======================================================================================
EicRoot
blob
master
eic
cad
EicStlFacet.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:34
using
1.8.2 with
EIC GitHub integration