[831] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4FCylindricalSurface.hh,v 1.13 2006/06/29 18:39:25 gunter Exp $ |
---|
[1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[831] | 29 | // |
---|
| 30 | // ---------------------------------------------------------------------- |
---|
| 31 | // Class G4FCylindricalSurface |
---|
| 32 | // |
---|
| 33 | // Class Description: |
---|
| 34 | // |
---|
| 35 | // Definition of a generic bounded cylindrical surface. |
---|
| 36 | // |
---|
| 37 | // Position.axis| radius |
---|
| 38 | // >|---|<--------- |
---|
| 39 | // | |
---|
| 40 | // -- +---|---+ |
---|
| 41 | // l | | | | |
---|
| 42 | // e | | | | |
---|
| 43 | // n | | | | |
---|
| 44 | // g | | | | |
---|
| 45 | // t | | | | |
---|
| 46 | // h | | | | |
---|
| 47 | // -- +---|---+ |
---|
| 48 | // Position |
---|
| 49 | |
---|
| 50 | // The code for G4CylindricalSurface has been derived from the original |
---|
| 51 | // implementation in the "Gismo" package. |
---|
| 52 | // |
---|
| 53 | // Author: A.Breakstone |
---|
| 54 | // Adaptation: J.Sulkimo, P.Urban. |
---|
| 55 | // Revisions by: L.Broglia, G.Cosmo. |
---|
| 56 | // ---------------------------------------------------------------------- |
---|
| 57 | #ifndef __FCYLINDER_H |
---|
| 58 | #define __FCYLINDER_H |
---|
| 59 | |
---|
| 60 | #include "G4PointRat.hh" |
---|
| 61 | #include "G4Axis2Placement3D.hh" |
---|
| 62 | #include "G4Surface.hh" |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | class G4FCylindricalSurface : public G4Surface |
---|
| 66 | { |
---|
| 67 | |
---|
| 68 | public: // with description |
---|
| 69 | |
---|
| 70 | G4FCylindricalSurface(); |
---|
| 71 | // Default constructor. |
---|
| 72 | |
---|
| 73 | G4FCylindricalSurface( const G4Point3D& o, |
---|
| 74 | const G4Vector3D& a, |
---|
| 75 | G4double r, |
---|
| 76 | G4double l ); |
---|
| 77 | // o : origin. |
---|
| 78 | // a : axis. |
---|
| 79 | // r : radius. |
---|
| 80 | // l : length. |
---|
| 81 | |
---|
| 82 | virtual ~G4FCylindricalSurface(); |
---|
| 83 | // Destructor. |
---|
| 84 | |
---|
| 85 | inline G4int operator==( const G4FCylindricalSurface& c ) const; |
---|
| 86 | // Equality operator. |
---|
| 87 | |
---|
| 88 | virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const; |
---|
| 89 | // Returns the Normal unit vector to the G4FCylindricalSurface at a point |
---|
| 90 | // p on (or nearly on) the G4FCylindricalSurface. |
---|
| 91 | |
---|
| 92 | virtual G4int Inside( const G4Vector3D& x ) const; |
---|
| 93 | // Returns 1 if the point x is Inside the G4FCylindricalSurface, |
---|
| 94 | // returns 0 otherwise. |
---|
| 95 | |
---|
| 96 | inline G4String GetEntityType() const; |
---|
| 97 | // Returns the shape identifier. |
---|
| 98 | |
---|
| 99 | G4int Intersect(const G4Ray&); |
---|
| 100 | // Counts the number of intersections of a bounded cylindrical surface |
---|
| 101 | // by a ray. At first, it calculates the intersections with the infinite |
---|
| 102 | // cylindrical surface. Then, it counts the intersections within the |
---|
| 103 | // finite cylindrical surface boundaries, and sets the "distance" to the |
---|
| 104 | // closest distance from the start point to the nearest intersection. |
---|
| 105 | // If the point is on the surface it returns either the intersection with |
---|
| 106 | // the opposite surface or kInfinity. |
---|
| 107 | // If no intersection is found, it sets distance = kInfinity and returns 0. |
---|
| 108 | |
---|
| 109 | virtual G4double HowNear( const G4Vector3D& x ) const; |
---|
| 110 | // Computes the shortest distance from the point x to the |
---|
| 111 | // G4FCylindricalSurface. The distance will be always positive. |
---|
| 112 | |
---|
| 113 | void CalcBBox(); |
---|
| 114 | // Computes the bounding box. |
---|
| 115 | |
---|
| 116 | virtual const char* NameOf() const; |
---|
| 117 | // Returns the class name. |
---|
| 118 | |
---|
| 119 | virtual void PrintOn( std::ostream& os = G4cout ) const; |
---|
| 120 | // Printing function. |
---|
| 121 | |
---|
| 122 | virtual G4int WithinBoundary( const G4Vector3D& x ) const; |
---|
| 123 | // Returns 1 if the point x is within the boundary, 0 otherwise. |
---|
| 124 | |
---|
| 125 | virtual G4double Scale() const; |
---|
| 126 | // Return the radius of a G4FCylindricalSurface. |
---|
| 127 | // Used for Scale-invariant tests of surface thickness. |
---|
| 128 | // If the radius is zero, it returns the length. |
---|
| 129 | |
---|
| 130 | virtual G4double Area() const; |
---|
| 131 | // Calculates the area of a G4FCylindricalSurface. |
---|
| 132 | |
---|
| 133 | virtual void resize( G4double r, G4double l ); |
---|
| 134 | // Changes the radius and length of the G4FCylindricalSurface: |
---|
| 135 | // the first (input) argument is the new radius; |
---|
| 136 | // the second (input) argument is the new length. |
---|
| 137 | |
---|
| 138 | inline G4double GetLength() const; |
---|
| 139 | inline G4Vector3D GetAxis() const; |
---|
| 140 | inline G4double GetRadius() const; |
---|
| 141 | void SetRadius( G4double r ); |
---|
| 142 | // Get/Set methods for the geometrical data of the G4FCylindricalSurface. |
---|
| 143 | |
---|
| 144 | public: // without description |
---|
| 145 | |
---|
| 146 | void InitValues(); |
---|
| 147 | // Re-calculates the private values of the G4FCylindrical surface |
---|
| 148 | // before the Intersect and HowNear function if the G4FCylindrical |
---|
| 149 | // was created by the STEP interface. |
---|
| 150 | |
---|
| 151 | protected: |
---|
| 152 | |
---|
| 153 | G4Axis2Placement3D Position; |
---|
| 154 | G4double radius; |
---|
| 155 | G4double length; |
---|
| 156 | |
---|
| 157 | private: |
---|
| 158 | |
---|
| 159 | G4FCylindricalSurface(const G4FCylindricalSurface&); |
---|
| 160 | G4FCylindricalSurface& operator=(const G4FCylindricalSurface&); |
---|
| 161 | // Private copy constructor and assignment operator. |
---|
| 162 | |
---|
| 163 | }; |
---|
| 164 | |
---|
| 165 | #include "G4FCylindricalSurface.icc" |
---|
| 166 | |
---|
| 167 | #endif |
---|