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 G4FCylindricalSurface 00031 // 00032 // Class Description: 00033 // 00034 // Definition of a generic bounded cylindrical surface. 00035 // 00036 // Position.axis| radius 00037 // >|---|<--------- 00038 // | 00039 // -- +---|---+ 00040 // l | | | | 00041 // e | | | | 00042 // n | | | | 00043 // g | | | | 00044 // t | | | | 00045 // h | | | | 00046 // -- +---|---+ 00047 // Position 00048 00049 // The code for G4CylindricalSurface has been derived from the original 00050 // implementation in the "Gismo" package. 00051 // 00052 // Author: A.Breakstone 00053 // Adaptation: J.Sulkimo, P.Urban. 00054 // Revisions by: L.Broglia, G.Cosmo. 00055 // ---------------------------------------------------------------------- 00056 #ifndef __FCYLINDER_H 00057 #define __FCYLINDER_H 00058 00059 #include "G4PointRat.hh" 00060 #include "G4Axis2Placement3D.hh" 00061 #include "G4Surface.hh" 00062 00063 00064 class G4FCylindricalSurface : public G4Surface 00065 { 00066 00067 public: // with description 00068 00069 G4FCylindricalSurface(); 00070 // Default constructor. 00071 00072 G4FCylindricalSurface( const G4Point3D& o, 00073 const G4Vector3D& a, 00074 G4double r, 00075 G4double l ); 00076 // o : origin. 00077 // a : axis. 00078 // r : radius. 00079 // l : length. 00080 00081 virtual ~G4FCylindricalSurface(); 00082 // Destructor. 00083 00084 inline G4int operator==( const G4FCylindricalSurface& c ) const; 00085 // Equality operator. 00086 00087 virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const; 00088 // Returns the Normal unit vector to the G4FCylindricalSurface at a point 00089 // p on (or nearly on) the G4FCylindricalSurface. 00090 00091 virtual G4int Inside( const G4Vector3D& x ) const; 00092 // Returns 1 if the point x is Inside the G4FCylindricalSurface, 00093 // returns 0 otherwise. 00094 00095 inline G4String GetEntityType() const; 00096 // Returns the shape identifier. 00097 00098 G4int Intersect(const G4Ray&); 00099 // Counts the number of intersections of a bounded cylindrical surface 00100 // by a ray. At first, it calculates the intersections with the infinite 00101 // cylindrical surface. Then, it counts the intersections within the 00102 // finite cylindrical 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 either the intersection with 00105 // the opposite surface or kInfinity. 00106 // If no intersection is found, it sets distance = kInfinity and returns 0. 00107 00108 virtual G4double HowNear( const G4Vector3D& x ) const; 00109 // Computes the shortest distance from the point x to the 00110 // G4FCylindricalSurface. The distance will be always positive. 00111 00112 void CalcBBox(); 00113 // Computes the bounding box. 00114 00115 virtual const char* NameOf() const; 00116 // Returns the class name. 00117 00118 virtual void PrintOn( std::ostream& os = G4cout ) const; 00119 // Printing function. 00120 00121 virtual G4int WithinBoundary( const G4Vector3D& x ) const; 00122 // Returns 1 if the point x is within the boundary, 0 otherwise. 00123 00124 virtual G4double Scale() const; 00125 // Return the radius of a G4FCylindricalSurface. 00126 // Used for Scale-invariant tests of surface thickness. 00127 // If the radius is zero, it returns the length. 00128 00129 virtual G4double Area() const; 00130 // Calculates the area of a G4FCylindricalSurface. 00131 00132 virtual void resize( G4double r, G4double l ); 00133 // Changes the radius and length of the G4FCylindricalSurface: 00134 // the first (input) argument is the new radius; 00135 // the second (input) argument is the new length. 00136 00137 inline G4double GetLength() const; 00138 inline G4Vector3D GetAxis() const; 00139 inline G4double GetRadius() const; 00140 void SetRadius( G4double r ); 00141 // Get/Set methods for the geometrical data of the G4FCylindricalSurface. 00142 00143 public: // without description 00144 00145 void InitValues(); 00146 // Re-calculates the private values of the G4FCylindrical surface 00147 // before the Intersect and HowNear function if the G4FCylindrical 00148 // was created by the STEP interface. 00149 00150 protected: 00151 00152 G4Axis2Placement3D Position; 00153 G4double radius; 00154 G4double length; 00155 00156 private: 00157 00158 G4FCylindricalSurface(const G4FCylindricalSurface&); 00159 G4FCylindricalSurface& operator=(const G4FCylindricalSurface&); 00160 // Private copy constructor and assignment operator. 00161 00162 }; 00163 00164 #include "G4FCylindricalSurface.icc" 00165 00166 #endif