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 G4FConicalSurface 00031 // 00032 // Class description: 00033 // 00034 // Definition of a generic conical surface. 00035 /* 00036 Position.axis| 00037 | 00038 -- ---|--- small_radius 00039 l | / | \ 00040 e | / | \ 00041 n | / | \ 00042 g | / | \ 00043 t | / | \ 00044 h | / | \ 00045 -- ---------|--------- large_radius 00046 Position 00047 */ 00048 00049 // The code for G4FConicalSurface has been derived from the original 00050 // implementation in the "Gismo" package. 00051 // 00052 // Author: Alan Breakstone 00053 // Adaptation: J.Sulkimo, P.Urban. 00054 // Revisions by: L.Broglia, G.Cosmo. 00055 // ---------------------------------------------------------------------- 00056 #ifndef __FCONIC_H 00057 #define __FCONIC_H 00058 00059 #include "G4PointRat.hh" 00060 #include "G4Axis2Placement3D.hh" 00061 #include "G4Surface.hh" 00062 00063 class G4FConicalSurface : public G4Surface 00064 { 00065 00066 public: // with description 00067 00068 G4FConicalSurface(); 00069 virtual ~G4FConicalSurface(); 00070 // Default constructor and destructor. 00071 00072 G4FConicalSurface( const G4Point3D& o, const G4Vector3D& a, 00073 G4double l, G4double sr, G4double lr ); 00074 // o : origin of the G4FConicalSurface. 00075 // a : axis of the G4FConicalSurface. 00076 // l : length of the G4FConicalSurface. 00077 // sl: small radius of the G4FConicalSurface. 00078 // lr: large radius of the G4FConicalSurface. 00079 00080 virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const; 00081 // Returns the normal to the surface on point p. 00082 00083 G4int Inside( const G4Vector3D& x ) const; 00084 // Returns 0 if point x is outside G4ConicalSurface, 1 if Inside. 00085 00086 inline G4String GetEntityType() const; 00087 // Returns the type identifier. 00088 00089 virtual const char* Name() const; 00090 // Returns the class type name. 00091 00092 virtual void PrintOn( std::ostream& os = G4cout ) const; 00093 // Printing function. 00094 00095 G4int operator==( const G4FConicalSurface& c ) const; 00096 // Equality operator. 00097 00098 G4int Intersect( const G4Ray& ry ); 00099 // Counts the number of intersections of a bounded conical surface by a ray. 00100 // At first, calculates the intersections with the semi-infinite 00101 // conical surface; then, it counts the intersections within the 00102 // finite conical surface boundaries, and sets the "distance" to the 00103 // closest distance from the start point to the nearest intersection. 00104 // If the point is on the surface it returns or the intersection with 00105 // the opposite surface or kInfinity. 00106 // If no intersection is found, it sets distance = kInfinity and returns 0. 00107 00108 void CalcBBox(); 00109 // Computes the bounding-box. 00110 00111 virtual G4double HowNear( const G4Vector3D& x ) const; 00112 // Computes the shortest distance from the point x to the G4FConicalSurface. 00113 // The distance will always be positive. 00114 // This function works only with Cone axis equal (0,0,1) or (0,0,-1), 00115 // it projects the surface and the point on the x,z plane and computes 00116 // the distance in analytical way. 00117 00118 virtual G4int WithinBoundary( const G4Vector3D& x ) const; 00119 // Returns 1 if the point x is within the boundary, returns 0 otherwise. 00120 00121 virtual G4double Scale() const; 00122 // Returns the size of a G4FConicalSurface. 00123 // Used for Scale-invariant tests of surface thickness. 00124 // If the small radius is zero, returns the large radius. 00125 00126 virtual G4double Area() const; 00127 // Calculates the area of a G4FConicalSurface. 00128 00129 virtual void resize( G4double l, G4double sr, G4double lr ); 00130 // Changes the radii and length of the G4FConicalSurface. 00131 // - l (input) argument: the new length 00132 // - sr (input) argument: the new small radius 00133 // - lr (input) argument: the new large radius 00134 00135 00136 inline G4double GetLength() const; 00137 inline G4double GetSmallRadius() const; 00138 inline G4double GetLargeRadius() const; 00139 inline G4double GetTan_Angle() const; 00140 // Accessors to dimensions of the G4FConicalSurface. 00141 00142 protected: 00143 00144 G4double length; 00145 // length of G4FConicalSurface 00146 00147 G4double small_radius; 00148 // small radius of G4FConicalSurface, can be zero 00149 G4double large_radius; 00150 // large radius of G4FConicalSurface, must be greater than the small 00151 // radius. Note that the angle of the G4ConicalSurface is calculated 00152 // from these three quantities. 00153 00154 G4Axis2Placement3D Position; 00155 G4double tan_angle; 00156 00157 private: 00158 00159 G4FConicalSurface(const G4FConicalSurface&); 00160 G4FConicalSurface& operator=(const G4FConicalSurface&); 00161 // Private copy constructor and assignment operator. 00162 00163 }; 00164 00165 #include "G4FConicalSurface.icc" 00166 00167 #endif