| 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 result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| 26 | //
|
|---|
| 27 | // $Id: G4PolyconeSide.hh,v 1.13 2010/02/24 11:18:25 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // G4PolyconeSide
|
|---|
| 36 | //
|
|---|
| 37 | // Class description:
|
|---|
| 38 | //
|
|---|
| 39 | // Class implmenting a face that represents one conical side
|
|---|
| 40 | // of a polycone:
|
|---|
| 41 | //
|
|---|
| 42 | // G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
|
|---|
| 43 | // const G4PolyconeSideRZ *tail,
|
|---|
| 44 | // const G4PolyconeSideRZ *head,
|
|---|
| 45 | // const G4PolyconeSideRZ *nextRZ,
|
|---|
| 46 | // G4double phiStart, G4double deltaPhi,
|
|---|
| 47 | // G4bool phiIsOpen, G4bool isAllBehind=false )
|
|---|
| 48 | //
|
|---|
| 49 | // Values for r1,z1 and r2,z2 should be specified in clockwise
|
|---|
| 50 | // order in (r,z).
|
|---|
| 51 |
|
|---|
| 52 | // Author:
|
|---|
| 53 | // David C. Williams (davidw@scipp.ucsc.edu)
|
|---|
| 54 | // --------------------------------------------------------------------
|
|---|
| 55 |
|
|---|
| 56 | #ifndef G4PolyconeSide_hh
|
|---|
| 57 | #define G4PolyconeSide_hh
|
|---|
| 58 |
|
|---|
| 59 | #include "G4VCSGface.hh"
|
|---|
| 60 |
|
|---|
| 61 | class G4IntersectingCone;
|
|---|
| 62 |
|
|---|
| 63 | struct G4PolyconeSideRZ
|
|---|
| 64 | {
|
|---|
| 65 | G4double r, z; // start of vector
|
|---|
| 66 | };
|
|---|
| 67 |
|
|---|
| 68 | class G4PolyconeSide : public G4VCSGface
|
|---|
| 69 | {
|
|---|
| 70 | public:
|
|---|
| 71 |
|
|---|
| 72 | G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
|
|---|
| 73 | const G4PolyconeSideRZ *tail,
|
|---|
| 74 | const G4PolyconeSideRZ *head,
|
|---|
| 75 | const G4PolyconeSideRZ *nextRZ,
|
|---|
| 76 | G4double phiStart, G4double deltaPhi,
|
|---|
| 77 | G4bool phiIsOpen, G4bool isAllBehind=false );
|
|---|
| 78 | virtual ~G4PolyconeSide();
|
|---|
| 79 |
|
|---|
| 80 | G4PolyconeSide( const G4PolyconeSide &source );
|
|---|
| 81 | G4PolyconeSide& operator=( const G4PolyconeSide &source );
|
|---|
| 82 |
|
|---|
| 83 | G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
|
|---|
| 84 | G4bool outgoing, G4double surfTolerance,
|
|---|
| 85 | G4double &distance, G4double &distFromSurface,
|
|---|
| 86 | G4ThreeVector &normal, G4bool &isAllBehind );
|
|---|
| 87 |
|
|---|
| 88 | G4double Distance( const G4ThreeVector &p, G4bool outgoing );
|
|---|
| 89 |
|
|---|
| 90 | EInside Inside( const G4ThreeVector &p, G4double tolerance,
|
|---|
| 91 | G4double *bestDistance );
|
|---|
| 92 |
|
|---|
| 93 | G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
|
|---|
| 94 |
|
|---|
| 95 | G4double Extent( const G4ThreeVector axis );
|
|---|
| 96 |
|
|---|
| 97 | void CalculateExtent( const EAxis axis,
|
|---|
| 98 | const G4VoxelLimits &voxelLimit,
|
|---|
| 99 | const G4AffineTransform &tranform,
|
|---|
| 100 | G4SolidExtentList &extentList );
|
|---|
| 101 |
|
|---|
| 102 | G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
|
|---|
| 103 |
|
|---|
| 104 | G4double SurfaceArea();
|
|---|
| 105 | G4ThreeVector GetPointOnFace();
|
|---|
| 106 |
|
|---|
| 107 | public: // without description
|
|---|
| 108 |
|
|---|
| 109 | G4PolyconeSide(__void__&);
|
|---|
| 110 | // Fake default constructor for usage restricted to direct object
|
|---|
| 111 | // persistency for clients requiring preallocation of memory for
|
|---|
| 112 | // persistifiable objects.
|
|---|
| 113 |
|
|---|
| 114 | protected:
|
|---|
| 115 |
|
|---|
| 116 | G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
|
|---|
| 117 | G4double &distOutside2, G4double *rzNorm=0 );
|
|---|
| 118 |
|
|---|
| 119 | G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
|
|---|
| 120 | const G4ThreeVector &p,
|
|---|
| 121 | const G4ThreeVector &v, G4ThreeVector &normal );
|
|---|
| 122 |
|
|---|
| 123 | void CopyStuff( const G4PolyconeSide &source );
|
|---|
| 124 |
|
|---|
| 125 | static void FindLineIntersect( G4double x1, G4double y1,
|
|---|
| 126 | G4double tx1, G4double ty1,
|
|---|
| 127 | G4double x2, G4double y2,
|
|---|
| 128 | G4double tx2, G4double ty2,
|
|---|
| 129 | G4double &x, G4double &y );
|
|---|
| 130 |
|
|---|
| 131 | G4double GetPhi( const G4ThreeVector& p );
|
|---|
| 132 |
|
|---|
| 133 | protected:
|
|---|
| 134 |
|
|---|
| 135 | G4double r[2], z[2]; // r, z parameters, in specified order
|
|---|
| 136 | G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
|
|---|
| 137 | deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen
|
|---|
| 138 | G4bool phiIsOpen; // True if there is a phi slice
|
|---|
| 139 | G4bool allBehind; // True if the entire solid is "behind" this face
|
|---|
| 140 |
|
|---|
| 141 | G4IntersectingCone *cone; // Our intersecting utility class
|
|---|
| 142 |
|
|---|
| 143 | G4double rNorm, zNorm; // Normal to surface in r,z space
|
|---|
| 144 | G4double rS, zS; // Unit vector along surface in r,z space
|
|---|
| 145 | G4double length; // Length of face in r,z space
|
|---|
| 146 | G4double prevRS,
|
|---|
| 147 | prevZS; // Unit vector along previous polyconeSide
|
|---|
| 148 | G4double nextRS,
|
|---|
| 149 | nextZS; // Unit vector along next polyconeSide
|
|---|
| 150 |
|
|---|
| 151 | G4double rNormEdge[2],
|
|---|
| 152 | zNormEdge[2]; // Normal to edges
|
|---|
| 153 |
|
|---|
| 154 | G4int ncorners;
|
|---|
| 155 | G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
|
|---|
| 156 |
|
|---|
| 157 | private:
|
|---|
| 158 |
|
|---|
| 159 | std::pair<G4ThreeVector, G4double> fPhi; // Cached value for phi
|
|---|
| 160 | G4double kCarTolerance; // Geometrical surface thickness
|
|---|
| 161 | G4double fSurfaceArea; // Used for surface calculation
|
|---|
| 162 | };
|
|---|
| 163 |
|
|---|
| 164 | #endif
|
|---|