| [831] | 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 | //
|
|---|
| 31 | // $Id: G4Tet.hh,v 1.9 2006/11/13 08:58:03 gcosmo Exp $
|
|---|
| [1228] | 32 | // GEANT4 tag $Name: geant4-09-03 $
|
|---|
| [831] | 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // --------------------------------------------------------------------
|
|---|
| 36 | // GEANT 4 class header file
|
|---|
| 37 | //
|
|---|
| 38 | // G4Tet
|
|---|
| 39 | //
|
|---|
| 40 | // Class description:
|
|---|
| 41 | //
|
|---|
| 42 | // A G4Tet is a tetrahedrasolid.
|
|---|
| 43 | //
|
|---|
| 44 |
|
|---|
| 45 | // History:
|
|---|
| 46 | // -------
|
|---|
| 47 | // 03.09.2004 - M.H.Mendenhall & R.A.Weller (Vanderbilt University, USA)
|
|---|
| 48 | // 10.02.2005 - D.Anninos (CERN) - Added GetPointOnSurface() method.
|
|---|
| 49 | // 12.11.2006 - M.H.Mendenhall - Added GetSurfaceArea() concrete implementation.
|
|---|
| 50 | // --------------------------------------------------------------------
|
|---|
| 51 | #ifndef G4TET_HH
|
|---|
| 52 | #define G4TET_HH
|
|---|
| 53 |
|
|---|
| 54 | #include "G4VSolid.hh"
|
|---|
| 55 |
|
|---|
| 56 | class G4Tet : public G4VSolid
|
|---|
| 57 | {
|
|---|
| 58 |
|
|---|
| 59 | public: // with description
|
|---|
| 60 |
|
|---|
| 61 | G4Tet(const G4String& pName,
|
|---|
| 62 | G4ThreeVector anchor,
|
|---|
| 63 | G4ThreeVector p2,
|
|---|
| 64 | G4ThreeVector p3,
|
|---|
| 65 | G4ThreeVector p4,
|
|---|
| 66 | G4bool *degeneracyFlag=0);
|
|---|
| 67 |
|
|---|
| 68 | virtual ~G4Tet();
|
|---|
| 69 |
|
|---|
| 70 | void ComputeDimensions(G4VPVParameterisation* p,
|
|---|
| 71 | const G4int n,
|
|---|
| 72 | const G4VPhysicalVolume* pRep);
|
|---|
| 73 |
|
|---|
| 74 | G4bool CalculateExtent(const EAxis pAxis,
|
|---|
| 75 | const G4VoxelLimits& pVoxelLimit,
|
|---|
| 76 | const G4AffineTransform& pTransform,
|
|---|
| 77 | G4double& pmin, G4double& pmax) const;
|
|---|
| 78 | // Methods for solid
|
|---|
| 79 |
|
|---|
| 80 | EInside Inside(const G4ThreeVector& p) const;
|
|---|
| 81 |
|
|---|
| 82 | G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
|
|---|
| 83 |
|
|---|
| 84 | G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
|
|---|
| 85 |
|
|---|
| 86 | G4double DistanceToIn(const G4ThreeVector& p) const;
|
|---|
| 87 |
|
|---|
| 88 | G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
|
|---|
| 89 | const G4bool calcNorm=false,
|
|---|
| 90 | G4bool *validNorm=0, G4ThreeVector *n=0) const;
|
|---|
| 91 |
|
|---|
| 92 | G4double DistanceToOut(const G4ThreeVector& p) const;
|
|---|
| 93 |
|
|---|
| 94 | G4double GetCubicVolume();
|
|---|
| 95 | G4double GetSurfaceArea();
|
|---|
| 96 |
|
|---|
| 97 | G4GeometryType GetEntityType() const;
|
|---|
| 98 |
|
|---|
| 99 | std::ostream& StreamInfo(std::ostream& os) const;
|
|---|
| 100 |
|
|---|
| 101 | G4ThreeVector GetPointOnSurface() const;
|
|---|
| 102 |
|
|---|
| 103 | // Functions for visualization
|
|---|
| 104 |
|
|---|
| 105 | void DescribeYourselfTo (G4VGraphicsScene& scene) const;
|
|---|
| 106 | G4VisExtent GetExtent () const;
|
|---|
| 107 | G4Polyhedron* CreatePolyhedron () const;
|
|---|
| 108 | G4NURBS* CreateNURBS () const;
|
|---|
| 109 | G4Polyhedron* GetPolyhedron () const;
|
|---|
| 110 |
|
|---|
| 111 | public: // without description
|
|---|
| 112 |
|
|---|
| 113 | G4Tet(__void__&);
|
|---|
| 114 | // Fake default constructor for usage restricted to direct object
|
|---|
| 115 | // persistency for clients requiring preallocation of memory for
|
|---|
| 116 | // persistifiable objects.
|
|---|
| 117 |
|
|---|
| 118 | const char* CVSHeaderVers()
|
|---|
| 119 | { return "$Id: G4Tet.hh,v 1.9 2006/11/13 08:58:03 gcosmo Exp $"; }
|
|---|
| 120 | const char* CVSFileVers()
|
|---|
| 121 | { return CVSVers; }
|
|---|
| 122 | void PrintWarnings(G4bool flag)
|
|---|
| 123 | { warningFlag=flag; }
|
|---|
| 124 | static G4bool CheckDegeneracy(G4ThreeVector anchor,
|
|---|
| 125 | G4ThreeVector p2,
|
|---|
| 126 | G4ThreeVector p3,
|
|---|
| 127 | G4ThreeVector p4);
|
|---|
| 128 | std::vector<G4ThreeVector> GetVertices() const;
|
|---|
| 129 | // Return the four vertices of the shape.
|
|---|
| 130 |
|
|---|
| 131 | protected: // with description
|
|---|
| 132 |
|
|---|
| 133 | G4ThreeVectorList*
|
|---|
| 134 | CreateRotatedVertices(const G4AffineTransform& pTransform) const;
|
|---|
| 135 | // Create the List of transformed vertices in the format required
|
|---|
| 136 | // for G4VSolid:: ClipCrossSection and ClipBetweenSections.
|
|---|
| 137 |
|
|---|
| 138 | private:
|
|---|
| 139 |
|
|---|
| 140 | G4double fCubicVolume, fSurfaceArea;
|
|---|
| 141 |
|
|---|
| 142 | mutable G4Polyhedron* fpPolyhedron;
|
|---|
| 143 |
|
|---|
| 144 | G4ThreeVector GetPointOnFace(G4ThreeVector p1, G4ThreeVector p2,
|
|---|
| 145 | G4ThreeVector p3, G4double& area) const;
|
|---|
| 146 | static const char CVSVers[];
|
|---|
| 147 |
|
|---|
| 148 | private:
|
|---|
| 149 |
|
|---|
| 150 | G4ThreeVector fAnchor, fP2, fP3, fP4, fMiddle;
|
|---|
| 151 | G4ThreeVector fNormal123, fNormal142, fNormal134, fNormal234;
|
|---|
| 152 |
|
|---|
| 153 | G4bool warningFlag;
|
|---|
| 154 |
|
|---|
| 155 | G4double fCdotN123, fCdotN142, fCdotN134, fCdotN234;
|
|---|
| 156 | G4double fXMin, fXMax, fYMin, fYMax, fZMin, fZMax;
|
|---|
| 157 | G4double fDx, fDy, fDz, fTol, fMaxSize;
|
|---|
| 158 | };
|
|---|
| 159 |
|
|---|
| 160 | #endif
|
|---|