00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // ---------------------------------------------------------------------- 00030 // Class G4BREPSolidPCone 00031 // 00032 // Class description: 00033 // 00034 // The polyconical solid G4BREPSolidPCone is a shape defined by a set of 00035 // inner and outer conical or cylindrical surface sections and two planes 00036 // perpendicular to the Z axis. Each conical surface is defined by its 00037 // radius at two different planes perpendicular to the Z-axis. Inner and 00038 // outer conical surfaces are defined using common Z planes: 00039 // 00040 // G4BREPSolidPCone( const G4String& name, 00041 // G4double start_angle, 00042 // G4double opening_angle, 00043 // G4int num_z_planes, 00044 // G4double z_start, 00045 // G4double z_values[], 00046 // G4double RMIN[], 00047 // G4double RMAX[] ) 00048 00049 // Authors: J.Sulkimo, P.Urban. 00050 // Revisions by: L.Broglia, S.Giani, G.Cosmo. 00051 // ---------------------------------------------------------------------- 00052 #ifndef __G4BREPSolidPCone 00053 #define __G4BREPSolidPCone 00054 00055 #include "G4BREPSolid.hh" 00056 00057 class G4BREPSolidPCone : public G4BREPSolid 00058 { 00059 00060 public: // with description 00061 00062 G4BREPSolidPCone( const G4String& name, 00063 G4double start_angle, 00064 G4double opening_angle, 00065 G4int num_z_planes, // sections 00066 G4double z_start, 00067 G4double z_values[], 00068 G4double RMIN[], 00069 G4double RMAX[] ); 00070 // Constructor defining the polycone through its 00071 // conical/cylindrical surfaces. 00072 00073 ~G4BREPSolidPCone(); 00074 // Destructor. 00075 00076 void Initialize(); 00077 // Calculates the bounding box. 00078 00079 EInside Inside(register const G4ThreeVector& Pt) const; 00080 // Determines if the point Pt is inside, outside or on the surface 00081 // of the solid. 00082 00083 G4ThreeVector SurfaceNormal(const G4ThreeVector&) const; 00084 // Calculates the normal of the surface at a point on the surface 00085 // The sense of the normal depends on the sense of the surface. 00086 00087 G4double DistanceToIn(const G4ThreeVector&) const; 00088 // Calculates the shortest distance ("safety") from a point 00089 // outside the solid to any boundary of this solid. 00090 // Return 0 if the point is already inside. 00091 00092 G4double DistanceToIn(register const G4ThreeVector& Pt, 00093 register const G4ThreeVector& V) const; 00094 // Calculates the distance from a point Pt outside the solid 00095 // to the solid's boundary along a specified direction vector V. 00096 // Note: Intersections with boundaries less than the tolerance must 00097 // be ignored if the direction is away from the boundary. 00098 00099 G4double DistanceToOut(register const G4ThreeVector& Pt, 00100 register const G4ThreeVector& V, 00101 const G4bool calcNorm=false, 00102 G4bool *validNorm=0, G4ThreeVector *n=0) const; 00103 // Calculates the distance from a point inside the solid to the solid`s 00104 // boundary along a specified direction vector. 00105 // Return 0 if the point is already outside. 00106 // Note: If the shortest distance to a boundary is less than the 00107 // tolerance, it is ignored. This allows for a point within a 00108 // tolerant boundary to leave immediately. 00109 00110 G4double DistanceToOut(const G4ThreeVector&) const; 00111 // Calculates the shortest distance ("safety") from a point inside the 00112 // solid to any boundary of this solid. 00113 // Return 0 if the point is already outside. 00114 00115 public: 00116 00117 void Reset() const; 00118 // Resets all distance attributes. 00119 00120 G4Polyhedron* CreatePolyhedron () const; 00121 // Creates a G4Polyhedron 00122 00123 G4VSolid* Clone() const; 00124 // Returns a pointer of a dynamically allocated copy of the solid. 00125 00126 std::ostream& StreamInfo(std::ostream& os) const; 00127 // Streams solid contents to output stream. 00128 00129 public: // without description 00130 00131 G4BREPSolidPCone(__void__&); 00132 // Fake default constructor for usage restricted to direct object 00133 // persistency for clients requiring preallocation of memory for 00134 // persistifiable objects. 00135 00136 G4BREPSolidPCone(const G4BREPSolidPCone& rhs); 00137 G4BREPSolidPCone& operator=(const G4BREPSolidPCone& rhs); 00138 // Copy constructor and assignment operator. 00139 00140 private: 00141 00142 void InitializePCone(); 00143 00144 G4Surface* ComputePlanarSurface( G4double r1, G4double r2, 00145 G4ThreeVector& origin, 00146 G4ThreeVector& planeAxis, 00147 G4ThreeVector& planeDirection, 00148 G4int surfSense ); 00149 // For a given radius values compute a planar surface 00150 00151 // The following is only utilised in storing the shape parameters for 00152 // use in visualising this shape. J.A. Feb 24, 1997 00153 // R. Chytracek, Nov 2002, Update to new IO dumping mechanism 00154 00155 struct G4BREPPConeParams 00156 { 00157 G4double start_angle; 00158 G4double opening_angle; 00159 G4int num_z_planes; 00160 G4double z_start; 00161 G4double* z_values; 00162 G4double* RMIN; 00163 G4double* RMAX; 00164 } constructorParams; 00165 }; 00166 00167 #endif