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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 
 55 class 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
 85     G4bool CheckDegeneracy(const G4ThreeVector& p0,
 86                            const G4ThreeVector& p1,
 87                            const G4ThreeVector& p2,
 88                            const G4ThreeVector& p3) const;
 89 
 90     // Standard methods
 91     void ComputeDimensions(G4VPVParameterisation* p,
 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;
104     G4double DistanceToIn(const G4ThreeVector& p,
105                           const G4ThreeVector& v) const override;
106     G4double DistanceToIn(const G4ThreeVector& p) const override;
107     G4double DistanceToOut(const G4ThreeVector& p,
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     G4bool IsFaceted () const override;
117 
118     G4VSolid* Clone() const override;
119 
120     std::ostream& StreamInfo(std::ostream& os) const override;
121 
122     G4double GetCubicVolume() override;
123     G4double GetSurfaceArea() override;
124 
125     G4ThreeVector GetPointOnSurface() const override;
126 
127     // Methods for visualization
128     void DescribeYourselfTo (G4VGraphicsScene& scene) const override;
129     G4VisExtent GetExtent () const override;
130     G4Polyhedron* CreatePolyhedron () const override;
131     G4Polyhedron* GetPolyhedron () const override;
132 
133     // Fake default constructor for usage restricted to direct object
134     // persistency for clients requiring preallocation of memory for
135     // persistifiable objects
136     G4Tet(__void__&);
137 
138     // Copy constructor
139     G4Tet(const G4Tet& rhs);
140 
141     // Assignment operator
142     G4Tet& operator=(const G4Tet& rhs);
143 
144   private:
145 
146     // Set data members
147     void Initialize(const G4ThreeVector& p0,
148                     const G4ThreeVector& p1,
149                     const G4ThreeVector& p2,
150                     const G4ThreeVector& p3);
151 
152     // Return normal to surface closest to p
153     G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
154 
155   private:
156 
157     G4double halfTolerance = 0;
158     G4double fCubicVolume = 0; // Volume
159     G4double fSurfaceArea = 0; // Surface area
160     mutable G4bool fRebuildPolyhedron = false;
161     mutable G4Polyhedron* fpPolyhedron = nullptr;
162 
163     G4ThreeVector fVertex[4];   // thetrahedron vertices
164     G4ThreeVector fNormal[4];   // normals to faces
165     G4double fDist[4] = {0};    // distances from origin to faces
166     G4double fArea[4] = {0};    // face areas
167     G4ThreeVector fBmin, fBmax; // bounding box
168 };
169 
170 #endif
171 
172 #endif
173