[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 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: G4BREPSolidPCone.hh,v 1.14 2006/06/29 18:37:57 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[831] | 29 | // |
---|
| 30 | // ---------------------------------------------------------------------- |
---|
| 31 | // Class G4BREPSolidPCone |
---|
| 32 | // |
---|
| 33 | // Class description: |
---|
| 34 | // |
---|
| 35 | // The polyconical solid G4BREPSolidPCone is a shape defined by a set of |
---|
| 36 | // inner and outer conical or cylindrical surface sections and two planes |
---|
| 37 | // perpendicular to the Z axis. Each conical surface is defined by its |
---|
| 38 | // radius at two different planes perpendicular to the Z-axis. Inner and |
---|
| 39 | // outer conical surfaces are defined using common Z planes: |
---|
| 40 | // |
---|
| 41 | // G4BREPSolidPCone( const G4String& name, |
---|
| 42 | // G4double start_angle, |
---|
| 43 | // G4double opening_angle, |
---|
| 44 | // G4int num_z_planes, |
---|
| 45 | // G4double z_start, |
---|
| 46 | // G4double z_values[], |
---|
| 47 | // G4double RMIN[], |
---|
| 48 | // G4double RMAX[] ) |
---|
| 49 | |
---|
| 50 | // Authors: J.Sulkimo, P.Urban. |
---|
| 51 | // Revisions by: L.Broglia, S.Giani, G.Cosmo. |
---|
| 52 | // ---------------------------------------------------------------------- |
---|
| 53 | #ifndef __G4BREPSolidPCone |
---|
| 54 | #define __G4BREPSolidPCone |
---|
| 55 | |
---|
| 56 | #include "G4BREPSolid.hh" |
---|
| 57 | |
---|
| 58 | class G4BREPSolidPCone : public G4BREPSolid |
---|
| 59 | { |
---|
| 60 | |
---|
| 61 | public: // with description |
---|
| 62 | |
---|
| 63 | G4BREPSolidPCone( const G4String& name, |
---|
| 64 | G4double start_angle, |
---|
| 65 | G4double opening_angle, |
---|
| 66 | G4int num_z_planes, // sections |
---|
| 67 | G4double z_start, |
---|
| 68 | G4double z_values[], |
---|
| 69 | G4double RMIN[], |
---|
| 70 | G4double RMAX[] ); |
---|
| 71 | // Constructor defining the polycone through its |
---|
| 72 | // conical/cylindrical surfaces. |
---|
| 73 | |
---|
| 74 | ~G4BREPSolidPCone(); |
---|
| 75 | // Destructor. |
---|
| 76 | |
---|
| 77 | void Initialize(); |
---|
| 78 | // Calculates the bounding box. |
---|
| 79 | |
---|
| 80 | EInside Inside(register const G4ThreeVector& Pt) const; |
---|
| 81 | // Determines if the point Pt is inside, outside or on the surface |
---|
| 82 | // of the solid. |
---|
| 83 | |
---|
| 84 | G4ThreeVector SurfaceNormal(const G4ThreeVector&) const; |
---|
| 85 | // Calculates the normal of the surface at a point on the surface |
---|
| 86 | // The sense of the normal depends on the sense of the surface. |
---|
| 87 | |
---|
| 88 | G4double DistanceToIn(const G4ThreeVector&) const; |
---|
| 89 | // Calculates the shortest distance ("safety") from a point |
---|
| 90 | // outside the solid to any boundary of this solid. |
---|
| 91 | // Return 0 if the point is already inside. |
---|
| 92 | |
---|
| 93 | G4double DistanceToIn(register const G4ThreeVector& Pt, |
---|
| 94 | register const G4ThreeVector& V) const; |
---|
| 95 | // Calculates the distance from a point Pt outside the solid |
---|
| 96 | // to the solid's boundary along a specified direction vector V. |
---|
| 97 | // Note: Intersections with boundaries less than the tolerance must |
---|
| 98 | // be ignored if the direction is away from the boundary. |
---|
| 99 | |
---|
| 100 | G4double DistanceToOut(register const G4ThreeVector& Pt, |
---|
| 101 | register const G4ThreeVector& V, |
---|
| 102 | const G4bool calcNorm=false, |
---|
| 103 | G4bool *validNorm=0, G4ThreeVector *n=0) const; |
---|
| 104 | // Calculates the distance from a point inside the solid to the solid`s |
---|
| 105 | // boundary along a specified direction vector. |
---|
| 106 | // Return 0 if the point is already outside. |
---|
| 107 | // Note: If the shortest distance to a boundary is less than the |
---|
| 108 | // tolerance, it is ignored. This allows for a point within a |
---|
| 109 | // tolerant boundary to leave immediately. |
---|
| 110 | |
---|
| 111 | G4double DistanceToOut(const G4ThreeVector&) const; |
---|
| 112 | // Calculates the shortest distance ("safety") from a point inside the |
---|
| 113 | // solid to any boundary of this solid. |
---|
| 114 | // Return 0 if the point is already outside. |
---|
| 115 | |
---|
| 116 | public: |
---|
| 117 | |
---|
| 118 | void Reset() const; |
---|
| 119 | // Resets all distance attributes. |
---|
| 120 | |
---|
| 121 | G4Polyhedron* CreatePolyhedron () const; |
---|
| 122 | // Creates a G4Polyhedron |
---|
| 123 | |
---|
| 124 | virtual std::ostream& StreamInfo(std::ostream& os) const; |
---|
| 125 | // Streams solid contents to output stream. |
---|
| 126 | |
---|
| 127 | public: // without description |
---|
| 128 | |
---|
| 129 | G4BREPSolidPCone(__void__&); |
---|
| 130 | // Fake default constructor for usage restricted to direct object |
---|
| 131 | // persistency for clients requiring preallocation of memory for |
---|
| 132 | // persistifiable objects. |
---|
| 133 | |
---|
| 134 | private: |
---|
| 135 | |
---|
| 136 | G4Surface* ComputePlanarSurface( G4double r1, G4double r2, |
---|
| 137 | G4ThreeVector& origin, |
---|
| 138 | G4ThreeVector& planeAxis, |
---|
| 139 | G4ThreeVector& planeDirection, |
---|
| 140 | G4int surfSense ); |
---|
| 141 | // For a given radius values compute a planar surface |
---|
| 142 | |
---|
| 143 | G4BREPSolidPCone(const G4BREPSolidPCone&); |
---|
| 144 | G4BREPSolidPCone& operator=(const G4BREPSolidPCone&); |
---|
| 145 | // Private copy constructor and assignment operator. |
---|
| 146 | |
---|
| 147 | // The following is only utilised in storing the shape parameters for |
---|
| 148 | // use in visualising this shape. J.A. Feb 24, 1997 |
---|
| 149 | // R. Chytracek, Nov 2002, Update to new IO dumping mechanism |
---|
| 150 | |
---|
| 151 | struct G4BREPPConeParams |
---|
| 152 | { |
---|
| 153 | G4double start_angle; |
---|
| 154 | G4double opening_angle; |
---|
| 155 | G4int num_z_planes; |
---|
| 156 | G4double z_start; |
---|
| 157 | G4double* z_values; |
---|
| 158 | G4double* RMIN; |
---|
| 159 | G4double* RMAX; |
---|
| 160 | } constructorParams; |
---|
| 161 | }; |
---|
| 162 | |
---|
| 163 | #endif |
---|