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 G4ConicalSurface 00031 // 00032 // Class Description: 00033 // 00034 // A G4ConicalSurface is a semi-infinite conical surface defined by 00035 // an axis and an opening angle, defined as the angle between the axis 00036 // and the conical surface, with the origin being the apex of the cone. 00037 00038 // The code for G4ConicalSurface has been derived from the original 00039 // implementation in the "Gismo" package. 00040 // 00041 // Author: A.Breakstone 00042 // Adaptation: J.Sulkimo, P.Urban. 00043 // Revisions by: L.Broglia, G.Cosmo. 00044 // ---------------------------------------------------------------------- 00045 #ifndef __G4CONICALSURFACE_H 00046 #define __G4CONICALSURFACE_H 00047 00048 #include "G4Surface.hh" 00049 00050 00051 class G4ConicalSurface : public G4Surface 00052 { 00053 00054 public: // with description 00055 00056 G4ConicalSurface(); 00057 // Default constructor: 00058 // default axis is ( 1.0, 0.0, 0.0 ), 00059 // default angle is 1.0 radians. 00060 00061 G4ConicalSurface( const G4Point3D& o, const G4Vector3D& a, G4double e ); 00062 // Normal constructor: 00063 // first argument is the origin of the G4ConicalSurface 00064 // second argument is the axis of the G4ConicalSurface 00065 // third argument is the angle of the G4ConicalSurface. 00066 00067 virtual ~G4ConicalSurface(); 00068 // Virtual destructor. 00069 00070 inline G4int operator==( const G4ConicalSurface& c ); 00071 // Equality operator. 00072 00073 inline G4String GetEntityType() const; 00074 // Returns type identifier of the shape. 00075 00076 virtual const char* NameOf() const; 00077 // Returns the class name. 00078 00079 virtual void PrintOn( std::ostream& os = G4cout ) const; 00080 // Printing function, streaming surface's attributes. 00081 00082 virtual G4double HowNear( const G4Vector3D& x ) const; 00083 // Returns the distance from a point to a semi-infinite G4ConicalSurface. 00084 // The point x is the (input) argument. 00085 // The distance is positive if the point is Inside, negative if it 00086 // is outside 00087 00088 void CalcBBox(); 00089 // Computes the bounding-box. 00090 00091 G4int Intersect( const G4Ray& ry ); 00092 // Returns the distance along a Ray (straight line with G4Vector3D) to 00093 // leave or enter a G4ConicalSurface. 00094 // If the G4Vector3D of the Ray is opposite to that of the Normal to 00095 // the G4ConicalSurface at the intersection point, it will not leave the 00096 // G4ConicalSurface. 00097 // Similarly, if the G4Vector3D of the Ray is along that of the Normal 00098 // to the G4ConicalSurface at the intersection point, it will not enter the 00099 // G4ConicalSurface. 00100 // This method is called by all finite shapes sub-classed to 00101 // G4ConicalSurface. 00102 // A negative result means no intersection. 00103 // If no valid intersection point is found, set the distance 00104 // and intersection point to large numbers. 00105 00106 virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const; 00107 // Returns the Normal unit vector to the G4ConicalSurface at a point p 00108 // on (or nearly on) the G4ConicalSurface. 00109 00110 virtual G4int Inside( const G4Vector3D& x ) const; 00111 // Returns 1 if the point x is Inside the G4ConicalSurface, 0 otherwise. 00112 // Outside means that the distance to the G4ConicalSurface would be 00113 // negative. Uses the HowNear() function to calculate this distance. 00114 00115 virtual G4int WithinBoundary( const G4Vector3D& x ) const; 00116 // Returns 1 if point x is on the G4ConicalSurface, otherwise return zero 00117 // Since a G4ConicalSurface is infinite in extent, the function 00118 // will just check if the point is on the G4ConicalSurface (to the surface 00119 // precision). 00120 00121 virtual G4double Scale() const; 00122 // Function overwritten by finite-sized derived classes which returns 00123 // a radius, unless it is zero, in which case it returns the smallest 00124 // non-zero dimension. 00125 // Since a semi-infinite cone has no Scale associated with it, it returns 00126 // the arbitrary number 1.0. 00127 // Used for Scale-invariant tests of surface thickness. 00128 00129 inline G4Vector3D GetAxis() const; 00130 inline G4double GetAngle() const; 00131 // Return the axis and angle of the G4ConicalSurface. 00132 00133 void SetAngle( G4double e ); 00134 // Changes the angle of the G4ConicalSurface. 00135 // Requires angle to range from 0 to PI/2. 00136 00137 public: // without description 00138 00139 /* 00140 virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry, 00141 G4Vector3D& p ) const; 00142 // Returns the distance along a Ray to enter or leave a G4ConicalSurface. 00143 // The first (input) argument is +1 to leave or -1 to enter 00144 // The second (input) argument is a pointer to the Ray 00145 // The third (output) argument returns the intersection point. 00146 00147 virtual G4double distanceAlongHelix( G4int which_way, const Helix* hx, 00148 G4Vector3D& p ) const; 00149 // Returns the distance along a Helix to enter or leave a G4ConicalSurface. 00150 // The first (input) argument is +1 to leave or -1 to enter 00151 // The second (input) argument is a pointer to the Helix 00152 // The third (output) argument returns the intersection point. 00153 00154 G4Vector3D Normal( const G4Vector3D& p ) const; 00155 // Returns the Normal unit vector to a G4ConicalSurface 00156 // at a point p on (or nearly on) the G4ConicalSurface. 00157 00158 virtual void rotate( G4double alpha, G4double beta, 00159 G4double gamma, G4ThreeMat& m, G4int inverse ); 00160 // Rotates the G4ConicalSurface (angles are assumed to be given in 00161 // radians), arguments: 00162 // - first about global x-axis by angle alpha, 00163 // - second about global y-axis by angle beta, 00164 // - third about global z-axis by angle gamma, 00165 // - fourth (output) argument gives the calculated rotation matrix, 00166 // - fifth (input) argument is an integer flag which if 00167 // non-zero reverses the order of the rotations. 00168 00169 virtual void rotate( G4double alpha, G4double beta, 00170 G4double gamma, G4int inverse ); 00171 // Rotates the G4ConicalSurface (angles are assumed to be given in 00172 // radians), arguments: 00173 // - first about global x-axis by angle alpha, 00174 // - second about global y-axis by angle beta, 00175 // - third about global z-axis by angle gamma, 00176 // - fourth (input) argument is an integer flag which if 00177 // non-zero reverses the order of the rotations. 00178 00179 private: 00180 00181 virtual G4double gropeAlongHelix( const Helix* hx ) const; 00182 // Private function to use a crude technique to find the intersection 00183 // of a Helix with a G4ConicalSurface. It returns the turning angle 00184 // along the Helix at which the intersection occurs or -1.0 if no 00185 // intersection point is found. 00186 // The argument to the call is the pointer to the Helix. 00187 */ 00188 00189 private: 00190 00191 G4ConicalSurface(const G4ConicalSurface&); 00192 G4ConicalSurface& operator=(const G4ConicalSurface&); 00193 // Private copy constructor and assignment operator. 00194 00195 private: 00196 00197 G4Vector3D axis; 00198 // Direction of axis of G4ConicalSurface (unit vector). 00199 00200 G4double angle; 00201 // Half opening angle of G4ConicalSurface, in radians 00202 // range is 0 < angle < PI/2. 00203 00204 }; 00205 00206 #include "G4ConicalSurface.icc" 00207 00208 #endif