Geant4_10
UTet.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
6 //
7 // $Id:$
8 //
9 // --------------------------------------------------------------------
10 //
11 // UTet
12 //
13 // Class description:
14 //
15 // A UTet is a tetrahedrasolid.
16 //
17 // 19.07.13 Tatiana Nikitina
18 // Created from original implementation in Geant4
19 // --------------------------------------------------------------------
20 
21 #ifndef UTet_hh
22 #define UTet_hh
23 
24 #include "VUSolid.hh"
25 #include "UUtils.hh"
26 
27 class UTet : public VUSolid
28 {
29 
30  public: // with description
31 
32  UTet(const std::string& name,
33  UVector3 anchor,
34  UVector3 p2,
35  UVector3 p3,
36  UVector3 p4,
37  bool* degeneracyFlag = 0);
38 
39  virtual ~UTet();
40 
41 
42  // Methods for solid
43 
44  EnumInside Inside(const UVector3& p) const;
45 
46  bool Normal(const UVector3& aPoint, UVector3& aNormal) const;
47 
48  double SafetyFromInside(const UVector3& aPoint,
49  bool aAccurate = false) const;
50  double SafetyFromOutside(const UVector3& aPoint,
51  bool aAccurate = false) const;
52  double DistanceToIn(const UVector3& aPoint,
53  const UVector3& aDirection,
54  // UVector3 &aNormalVector,
55  double aPstep = UUtils::kInfinity) const;
56 
57  double DistanceToOut(const UVector3& aPoint,
58  const UVector3& aDirection,
59  UVector3& aNormalVector,
60  bool& aConvex,
61  double aPstep = UUtils::kInfinity) const;
62 
63  void Extent(UVector3& aMin, UVector3& aMax) const;
64 
65  double Capacity();
66  double SurfaceArea();
67 
69 
70  void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
71 
72  //G4Visualisation
73  void GetParametersList(int aNumber, double* aArray) const;
74 
75  VUSolid* Clone() const
76  {
77  std::vector<UVector3> v = GetVertices();
78  return new UTet(GetName(), v[0], v[1], v[2], v[3]);
79  }
80 
81 
82 
84  std::ostream& StreamInfo(std::ostream& os) const;
85 
86  public: // without description
87 
88  //UTet(__void__&);
89  // Fake default constructor for usage restricted to direct object
90  // persistency for clients requiring preallocation of memory for
91  // persistifiable objects.
92 
93  UTet(const UTet& rhs);
94  UTet& operator=(const UTet& rhs);
95  // Copy constructor and assignment operator.
96 
97  const char* CVSHeaderVers()
98  {
99  return "$Id: G4Tet.hh 66356 2012-12-18 09:02:32Z gcosmo $";
100  }
101  const char* CVSFileVers()
102  {
103  return CVSVers;
104  }
105  void PrintWarnings(bool flag)
106  {
107  warningFlag = flag;
108  }
109  static bool CheckDegeneracy(UVector3& anchor,
110  UVector3& p2,
111  UVector3& p3,
112  UVector3& p4);
113  std::vector<UVector3> GetVertices() const;
114  // Return the four vertices of the shape.
115 
116  protected: // with description
117 
118  /* UVectorList*
119  CreateRotatedVertices(const G4AffineTransform& pTransform) const;
120  // Create the List of transformed vertices in the format required
121  // for G4VSolid:: ClipCrossSection and ClipBetweenSections.
122  */
123  private:
124 
125  double fCubicVolume, fSurfaceArea;
126 
127  UVector3 GetPointOnFace(UVector3 p1, UVector3 p2,
128  UVector3 p3, double& area) const;
129  static const char CVSVers[];
130 
131  private:
132 
133  UVector3 fAnchor, fP2, fP3, fP4, fMiddle;
134  UVector3 fNormal123, fNormal142, fNormal134, fNormal234;
135 
136  bool warningFlag;
137 
138  double fCdotN123, fCdotN142, fCdotN134, fCdotN234;
139  double fXMin, fXMax, fYMin, fYMax, fZMin, fZMax;
140  double fDx, fDy, fDz, fTol, fMaxSize;
141 };
142 
143 #endif
static bool CheckDegeneracy(UVector3 &anchor, UVector3 &p2, UVector3 &p3, UVector3 &p4)
UVector3 GetPointOnSurface() const
Definition: UTet.cc:574
const std::string & GetName() const
Definition: VUSolid.hh:103
const char * p
Definition: xmltok.h:285
void ComputeBBox(UBBox *, bool)
Definition: UTet.hh:70
UGeometryType GetEntityType() const
Definition: UTet.cc:642
const XML_Char * name
Definition: expat.h:151
double DistanceToIn(const UVector3 &aPoint, const UVector3 &aDirection, double aPstep=UUtils::kInfinity) const
Definition: UTet.cc:322
virtual ~UTet()
Definition: UTet.cc:137
void Extent(UVector3 &aMin, UVector3 &aMax) const
Definition: UTet.cc:615
double SurfaceArea()
Definition: UTet.cc:652
bool Normal(const UVector3 &aPoint, UVector3 &aNormal) const
Definition: UTet.cc:247
double SafetyFromOutside(const UVector3 &aPoint, bool aAccurate=false) const
Definition: UTet.cc:410
double Capacity()
Definition: UTet.cc:647
std::ostream & StreamInfo(std::ostream &os) const
Definition: UTet.cc:525
double DistanceToOut(const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const
Definition: UTet.cc:422
EnumInside
Definition: VUSolid.hh:23
UTet & operator=(const UTet &rhs)
Definition: UTet.cc:167
double SafetyFromInside(const UVector3 &aPoint, bool aAccurate=false) const
Definition: UTet.cc:505
void GetParametersList(int aNumber, double *aArray) const
Definition: UTet.cc:626
tuple v
Definition: test.py:18
std::vector< UVector3 > GetVertices() const
Definition: UTet.cc:604
const char * CVSFileVers()
Definition: UTet.hh:101
const char * CVSHeaderVers()
Definition: UTet.hh:97
void PrintWarnings(bool flag)
Definition: UTet.hh:105
std::string UGeometryType
Definition: UTypes.hh:70
VUSolid * Clone() const
Definition: UTet.hh:75
UTet(const std::string &name, UVector3 anchor, UVector3 p2, UVector3 p3, UVector3 p4, bool *degeneracyFlag=0)
Definition: UTet.cc:35
EnumInside Inside(const UVector3 &p) const
Definition: UTet.cc:217
Definition: UTet.hh:27