EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicStlFacet.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicStlFacet.h
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 <TVector3.h>
8 
9 #include <EicStlVertex.h>
10 
11 class EicStlFacetEdge;
12 class EicStlAssembly;
13 
14 #ifndef _EIC_STL_FACET_
15 #define _EIC_STL_FACET_
16 
24 class EicStlFacet {
25  public:
31  EicStlFacet(EicStlVertex * const v1, EicStlVertex * const v2, EicStlVertex * const v3);
35  if (mVertices) {
36  mVertices->clear();
37  delete mVertices;
38  } //if
39 
40  if (mKey) delete mKey;
41  };
42 
45  const EicStlKey *key() const { return mKey;};
46 
49  //void Print() const { vertices[0]->Print(); vertices[1]->Print(); vertices[2]->Print(); };
50 
51  // Basic calculations of the facet (normal, etc);
52  int Calculate();
53 
54  void SetCounter(unsigned counter) { mCounter = counter; };
55  void DecrementCounter( void ) { mCounter--; };
56  void IncrementCounter( void ) { mCounter++; };
57  unsigned GetCounter( void ) const { return mCounter; };
58 
59  const vEntry *vertices( void ) const { return mVertices; };
60  const TVector3 &GetNormal( void ) const { return mNormal; };
61 
62  void SetEdge(unsigned iq, EicStlFacetEdge *edge) {
63  if (iq <= 2) mEdges[iq] = edge;
64  };
65  const EicStlFacetEdge *edge(unsigned iq) const { return (iq <= 2 ? mEdges[iq] : NULL); };
66 
67  //private:
68  // Intermediate vector of vertices; since vertices can be merged later, ordering is
69  // not known at a time of the STL file import;
70  std::vector<EicStlVertex*> mVbuffer;
71 
75  TVector3 mNormal;
76 
77  // Vertex pointers; they are ordered in vertex mKey keys;
79 
80  // Edge pointers; since they are v1->v2, v2->v3 & v3->v1 in 1-2-3 order as in the
81  // "mVertices" map (see above), first two edges are always oriented "in sync" with the
82  // facet normal while the third one is "out of sync", because condition
83  // "mKey(v3)>mKey(v1)" is always "true";
85 
86  // There can be more than one identical facet; as long as this running counter
87  // is greater than 1, assembly builder can attach it to the current assembly;
88  unsigned mCounter;
89 };
90 
91 #endif