Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Tet.hh
Go to the documentation of this file.
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 intellectual property of the *
19// * Vanderbilt University Free Electron Laser Center *
20// * Vanderbilt University, Nashville, TN, USA *
21// * Development supported by: *
22// * United States MFEL program under grant FA9550-04-1-0045 *
23// * and NASA under contract number NNG04CT05P. *
24// * Written by Marcus H. Mendenhall and Robert A. Weller. *
25// * *
26// * Contributed to the Geant4 Core, January, 2005. *
27// * *
28// ********************************************************************
29//
30// G4Tet
31//
32// Class description:
33//
34// A G4Tet is a tetrahedra solid.
35
36// 03.09.2004 - M.H.Mendenhall & R.A.Weller (Vanderbilt University, USA)
37// 08.01.2020 - E.Tcherniaev, complete revision, speed up
38// --------------------------------------------------------------------
39#ifndef G4TET_HH
40#define G4TET_HH
41
42#include "G4GeomTypes.hh"
43
44#if defined(G4GEOM_USE_USOLIDS)
45#define G4GEOM_USE_UTET 1
46#endif
47
48#if defined(G4GEOM_USE_UTET)
49 #define G4UTet G4Tet
50 #include "G4UTet.hh"
51#else
52
53#include "G4VSolid.hh"
54
55class G4Tet : public G4VSolid
56{
57 public:
58
59 G4Tet(const G4String& pName,
60 const G4ThreeVector& anchor,
61 const G4ThreeVector& p1,
62 const G4ThreeVector& p2,
63 const G4ThreeVector& p3,
64 G4bool* degeneracyFlag = nullptr);
65
66 ~G4Tet() override;
67
68 void SetVertices(const G4ThreeVector& anchor,
69 const G4ThreeVector& p1,
70 const G4ThreeVector& p2,
71 const G4ThreeVector& p3,
72 G4bool* degeneracyFlag = nullptr);
73
74 // Accessors, return the four vertices of the shape
75 void GetVertices(G4ThreeVector& anchor,
76 G4ThreeVector& p1,
77 G4ThreeVector& p2,
78 G4ThreeVector& p3) const;
79 std::vector<G4ThreeVector> GetVertices() const;
80
81 // Set warning flag - deprecated (dummy)
82 inline void PrintWarnings(G4bool) {};
83
84 // Return true if the tetrahedron is degenerate
86 const G4ThreeVector& p1,
87 const G4ThreeVector& p2,
88 const G4ThreeVector& p3) const;
89
90 // Standard methods
92 const G4int n,
93 const G4VPhysicalVolume* pRep) override;
94
95 void SetBoundingLimits(const G4ThreeVector& pMin, const G4ThreeVector& pMax);
96 void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
97 G4bool CalculateExtent(const EAxis pAxis,
98 const G4VoxelLimits& pVoxelLimit,
99 const G4AffineTransform& pTransform,
100 G4double& pmin, G4double& pmax) const override;
101
102 EInside Inside(const G4ThreeVector& p) const override;
103 G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const override;
105 const G4ThreeVector& v) const override;
106 G4double DistanceToIn(const G4ThreeVector& p) const override;
108 const G4ThreeVector& v,
109 const G4bool calcNorm = false,
110 G4bool* validNorm = nullptr,
111 G4ThreeVector* n = nullptr) const override;
112 G4double DistanceToOut(const G4ThreeVector& p) const override;
113
114 G4GeometryType GetEntityType() const override;
115
116 G4VSolid* Clone() const override;
117
118 std::ostream& StreamInfo(std::ostream& os) const override;
119
120 G4double GetCubicVolume() override;
121 G4double GetSurfaceArea() override;
122
123 G4ThreeVector GetPointOnSurface() const override;
124
125 // Methods for visualization
126 void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
127 G4VisExtent GetExtent () const override;
128 G4Polyhedron* CreatePolyhedron () const override;
129 G4Polyhedron* GetPolyhedron () const override;
130
131 // Fake default constructor for usage restricted to direct object
132 // persistency for clients requiring preallocation of memory for
133 // persistifiable objects
134 G4Tet(__void__&);
135
136 // Copy constructor
137 G4Tet(const G4Tet& rhs);
138
139 // Assignment operator
140 G4Tet& operator=(const G4Tet& rhs);
141
142 private:
143
144 // Set data members
145 void Initialize(const G4ThreeVector& p0,
146 const G4ThreeVector& p1,
147 const G4ThreeVector& p2,
148 const G4ThreeVector& p3);
149
150 // Return normal to surface closest to p
151 G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
152
153 private:
154
155 G4double halfTolerance = 0;
156 G4double fCubicVolume = 0; // Volume
157 G4double fSurfaceArea = 0; // Surface area
158 mutable G4bool fRebuildPolyhedron = false;
159 mutable G4Polyhedron* fpPolyhedron = nullptr;
160
161 G4ThreeVector fVertex[4]; // thetrahedron vertices
162 G4ThreeVector fNormal[4]; // normals to faces
163 G4double fDist[4] = {0}; // distances from origin to faces
164 G4double fArea[4] = {0}; // face areas
165 G4ThreeVector fBmin, fBmax; // bounding box
166};
167
168#endif
169
170#endif
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
Definition G4Tet.hh:56
G4Polyhedron * CreatePolyhedron() const override
Definition G4Tet.cc:689
G4VSolid * Clone() const override
Definition G4Tet.cc:594
G4Polyhedron * GetPolyhedron() const override
Definition G4Tet.cc:721
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pmin, G4double &pmax) const override
Definition G4Tet.cc:370
G4GeometryType GetEntityType() const override
Definition G4Tet.cc:585
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
Definition G4Tet.cc:669
G4Tet & operator=(const G4Tet &rhs)
Definition G4Tet.cc:140
G4ThreeVector GetPointOnSurface() const override
Definition G4Tet.cc:624
G4double GetSurfaceArea() override
Definition G4Tet.cc:660
void SetBoundingLimits(const G4ThreeVector &pMin, const G4ThreeVector &pMax)
Definition G4Tet.cc:323
G4Tet(const G4String &pName, const G4ThreeVector &anchor, const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3, G4bool *degeneracyFlag=nullptr)
Definition G4Tet.cc:66
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
Definition G4Tet.cc:528
void PrintWarnings(G4bool)
Definition G4Tet.hh:82
std::ostream & StreamInfo(std::ostream &os) const override
Definition G4Tet.cc:603
G4double GetCubicVolume() override
Definition G4Tet.cc:651
G4VisExtent GetExtent() const override
Definition G4Tet.cc:678
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
Definition G4Tet.cc:434
G4bool CheckDegeneracy(const G4ThreeVector &p0, const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3) const
Definition G4Tet.cc:173
std::vector< G4ThreeVector > GetVertices() const
Definition G4Tet.cc:301
~G4Tet() override
Definition G4Tet.cc:113
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
Definition G4Tet.cc:313
EInside Inside(const G4ThreeVector &p) const override
Definition G4Tet.cc:420
void SetVertices(const G4ThreeVector &anchor, const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3, G4bool *degeneracyFlag=nullptr)
Definition G4Tet.cc:250
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
Definition G4Tet.cc:360
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
Definition G4Tet.cc:488
EAxis
Definition geomdefs.hh:54
EInside
Definition geomdefs.hh:67