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 G4BREPSolidSphere 00031 // 00032 // Class description: 00033 // 00034 // Definition of a generic BREP sphere: 00035 // 00036 // G4BREPSolidSphere(const G4String& name, 00037 // const G4Vector3D& origin, 00038 // const G4Vector3D& xhat, 00039 // const G4Vector3D& zhat, 00040 // G4double radius) 00041 00042 // Authors: J.Sulkimo, P.Urban. 00043 // Revisions by: L.Broglia, G.Cosmo. 00044 // ---------------------------------------------------------------------- 00045 #ifndef __G4BREPSolidSphere 00046 #define __G4BREPSolidSphere 00047 00048 #include "G4BREPSolid.hh" 00049 00050 class G4BREPSolidSphere : public G4BREPSolid 00051 { 00052 00053 public: // with description 00054 00055 G4BREPSolidSphere(const G4String& name, 00056 const G4Vector3D& origin, 00057 const G4Vector3D& xhat, 00058 const G4Vector3D& zhat, 00059 G4double radius); 00060 // Constructor defining the sphere through its spherical surfaces. 00061 00062 ~G4BREPSolidSphere(); 00063 // Empty destructor. 00064 00065 EInside Inside(register const G4ThreeVector& Pt) const; 00066 // Determines if the point Pt is inside, outside or on the surface 00067 // of the solid. 00068 00069 G4ThreeVector SurfaceNormal(const G4ThreeVector&) const; 00070 // Calculates the normal of the surface at a point on the surface 00071 // The sense of the normal depends on the sense of the surface. 00072 00073 G4double DistanceToIn(const G4ThreeVector&) const; 00074 // Calculates the shortest distance ("safety") from a point 00075 // outside the solid to any boundary of this solid. 00076 // Return 0 if the point is already inside. 00077 00078 G4double DistanceToIn(register const G4ThreeVector& Pt, 00079 register const G4ThreeVector& V) const; 00080 // Calculates the distance from a point Pt outside the solid 00081 // to the solid's boundary along a specified direction vector V. 00082 // Note: Intersections with boundaries less than the tolerance must 00083 // be ignored if the direction is away from the boundary. 00084 00085 G4double DistanceToOut(register const G4ThreeVector& Pt, 00086 register const G4ThreeVector& V, 00087 const G4bool calcNorm=false, 00088 G4bool *validNorm=0, G4ThreeVector *n=0) const; 00089 // Calculates the distance from a point inside the solid to the solid`s 00090 // boundary along a specified direction vector. 00091 // Return 0 if the point is already outside. 00092 // Note: If the shortest distance to a boundary is less than the 00093 // tolerance, it is ignored. This allows for a point within a 00094 // tolerant boundary to leave immediately. 00095 00096 G4double DistanceToOut(const G4ThreeVector&) const; 00097 // Calculates the shortest distance ("safety") from a point inside the 00098 // solid to any boundary of this solid. 00099 // Return 0 if the point is already outside. 00100 00101 G4VSolid* Clone() const; 00102 // Returns a pointer of a dynamically allocated copy of the solid. 00103 00104 std::ostream& StreamInfo(std::ostream& os) const; 00105 // Streams solid contents to output stream. 00106 00107 public: // without description 00108 00109 G4BREPSolidSphere(__void__&); 00110 // Fake default constructor for usage restricted to direct object 00111 // persistency for clients requiring preallocation of memory for 00112 // persistifiable objects. 00113 00114 inline void SphReset() { active=1; } 00115 00116 G4BREPSolidSphere(const G4BREPSolidSphere& rhs); 00117 G4BREPSolidSphere& operator=(const G4BREPSolidSphere& rhs); 00118 // Copy constructor and assignment operator. 00119 00120 private: 00121 00122 void InitializeSphere(); 00123 00124 private: 00125 00126 struct G4BREPSphereParams 00127 { 00128 G4Vector3D origin; 00129 G4Vector3D xhat; 00130 G4Vector3D zhat; 00131 G4double radius; 00132 } constructorParams; 00133 }; 00134 00135 #endif