| [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: G4FConicalSurface.hh,v 1.13 2006/06/29 18:39:21 gunter Exp $
|
|---|
| [1058] | 28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $
|
|---|
| [831] | 29 | //
|
|---|
| 30 | // ----------------------------------------------------------------------
|
|---|
| 31 | // Class G4FConicalSurface
|
|---|
| 32 | //
|
|---|
| 33 | // Class description:
|
|---|
| 34 | //
|
|---|
| 35 | // Definition of a generic conical surface.
|
|---|
| 36 | /*
|
|---|
| 37 | Position.axis|
|
|---|
| 38 | |
|
|---|
| 39 | -- ---|--- small_radius
|
|---|
| 40 | l | / | \
|
|---|
| 41 | e | / | \
|
|---|
| 42 | n | / | \
|
|---|
| 43 | g | / | \
|
|---|
| 44 | t | / | \
|
|---|
| 45 | h | / | \
|
|---|
| 46 | -- ---------|--------- large_radius
|
|---|
| 47 | Position
|
|---|
| 48 | */
|
|---|
| 49 |
|
|---|
| 50 | // The code for G4FConicalSurface has been derived from the original
|
|---|
| 51 | // implementation in the "Gismo" package.
|
|---|
| 52 | //
|
|---|
| 53 | // Author: Alan Breakstone
|
|---|
| 54 | // Adaptation: J.Sulkimo, P.Urban.
|
|---|
| 55 | // Revisions by: L.Broglia, G.Cosmo.
|
|---|
| 56 | // ----------------------------------------------------------------------
|
|---|
| 57 | #ifndef __FCONIC_H
|
|---|
| 58 | #define __FCONIC_H
|
|---|
| 59 |
|
|---|
| 60 | #include "G4PointRat.hh"
|
|---|
| 61 | #include "G4Axis2Placement3D.hh"
|
|---|
| 62 | #include "G4Surface.hh"
|
|---|
| 63 |
|
|---|
| 64 | class G4FConicalSurface : public G4Surface
|
|---|
| 65 | {
|
|---|
| 66 |
|
|---|
| 67 | public: // with description
|
|---|
| 68 |
|
|---|
| 69 | G4FConicalSurface();
|
|---|
| 70 | virtual ~G4FConicalSurface();
|
|---|
| 71 | // Default constructor and destructor.
|
|---|
| 72 |
|
|---|
| 73 | G4FConicalSurface( const G4Point3D& o, const G4Vector3D& a,
|
|---|
| 74 | G4double l, G4double sr, G4double lr );
|
|---|
| 75 | // o : origin of the G4FConicalSurface.
|
|---|
| 76 | // a : axis of the G4FConicalSurface.
|
|---|
| 77 | // l : length of the G4FConicalSurface.
|
|---|
| 78 | // sl: small radius of the G4FConicalSurface.
|
|---|
| 79 | // lr: large radius of the G4FConicalSurface.
|
|---|
| 80 |
|
|---|
| 81 | virtual G4Vector3D SurfaceNormal( const G4Point3D& p ) const;
|
|---|
| 82 | // Returns the normal to the surface on point p.
|
|---|
| 83 |
|
|---|
| 84 | G4int Inside( const G4Vector3D& x ) const;
|
|---|
| 85 | // Returns 0 if point x is outside G4ConicalSurface, 1 if Inside.
|
|---|
| 86 |
|
|---|
| 87 | inline G4String GetEntityType() const;
|
|---|
| 88 | // Returns the type identifier.
|
|---|
| 89 |
|
|---|
| 90 | virtual const char* Name() const;
|
|---|
| 91 | // Returns the class type name.
|
|---|
| 92 |
|
|---|
| 93 | virtual void PrintOn( std::ostream& os = G4cout ) const;
|
|---|
| 94 | // Printing function.
|
|---|
| 95 |
|
|---|
| 96 | G4int operator==( const G4FConicalSurface& c ) const;
|
|---|
| 97 | // Equality operator.
|
|---|
| 98 |
|
|---|
| 99 | G4int Intersect( const G4Ray& ry );
|
|---|
| 100 | // Counts the number of intersections of a bounded conical surface by a ray.
|
|---|
| 101 | // At first, calculates the intersections with the semi-infinite
|
|---|
| 102 | // conical surface; then, it counts the intersections within the
|
|---|
| 103 | // finite conical 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 or the intersection with
|
|---|
| 106 | // the opposite surface or kInfinity.
|
|---|
| 107 | // If no intersection is found, it sets distance = kInfinity and returns 0.
|
|---|
| 108 |
|
|---|
| 109 | void CalcBBox();
|
|---|
| 110 | // Computes the bounding-box.
|
|---|
| 111 |
|
|---|
| 112 | virtual G4double HowNear( const G4Vector3D& x ) const;
|
|---|
| 113 | // Computes the shortest distance from the point x to the G4FConicalSurface.
|
|---|
| 114 | // The distance will always be positive.
|
|---|
| 115 | // This function works only with Cone axis equal (0,0,1) or (0,0,-1),
|
|---|
| 116 | // it projects the surface and the point on the x,z plane and computes
|
|---|
| 117 | // the distance in analytical way.
|
|---|
| 118 |
|
|---|
| 119 | virtual G4int WithinBoundary( const G4Vector3D& x ) const;
|
|---|
| 120 | // Returns 1 if the point x is within the boundary, returns 0 otherwise.
|
|---|
| 121 |
|
|---|
| 122 | virtual G4double Scale() const;
|
|---|
| 123 | // Returns the size of a G4FConicalSurface.
|
|---|
| 124 | // Used for Scale-invariant tests of surface thickness.
|
|---|
| 125 | // If the small radius is zero, returns the large radius.
|
|---|
| 126 |
|
|---|
| 127 | virtual G4double Area() const;
|
|---|
| 128 | // Calculates the area of a G4FConicalSurface.
|
|---|
| 129 |
|
|---|
| 130 | virtual void resize( G4double l, G4double sr, G4double lr );
|
|---|
| 131 | // Changes the radii and length of the G4FConicalSurface.
|
|---|
| 132 | // - l (input) argument: the new length
|
|---|
| 133 | // - sr (input) argument: the new small radius
|
|---|
| 134 | // - lr (input) argument: the new large radius
|
|---|
| 135 |
|
|---|
| 136 |
|
|---|
| 137 | inline G4double GetLength() const;
|
|---|
| 138 | inline G4double GetSmallRadius() const;
|
|---|
| 139 | inline G4double GetLargeRadius() const;
|
|---|
| 140 | inline G4double GetTan_Angle() const;
|
|---|
| 141 | // Accessors to dimensions of the G4FConicalSurface.
|
|---|
| 142 |
|
|---|
| 143 | protected:
|
|---|
| 144 |
|
|---|
| 145 | G4double length;
|
|---|
| 146 | // length of G4FConicalSurface
|
|---|
| 147 |
|
|---|
| 148 | G4double small_radius;
|
|---|
| 149 | // small radius of G4FConicalSurface, can be zero
|
|---|
| 150 | G4double large_radius;
|
|---|
| 151 | // large radius of G4FConicalSurface, must be greater than the small
|
|---|
| 152 | // radius. Note that the angle of the G4ConicalSurface is calculated
|
|---|
| 153 | // from these three quantities.
|
|---|
| 154 |
|
|---|
| 155 | G4Axis2Placement3D Position;
|
|---|
| 156 | G4double tan_angle;
|
|---|
| 157 |
|
|---|
| 158 | private:
|
|---|
| 159 |
|
|---|
| 160 | G4FConicalSurface(const G4FConicalSurface&);
|
|---|
| 161 | G4FConicalSurface& operator=(const G4FConicalSurface&);
|
|---|
| 162 | // Private copy constructor and assignment operator.
|
|---|
| 163 |
|
|---|
| 164 | };
|
|---|
| 165 |
|
|---|
| 166 | #include "G4FConicalSurface.icc"
|
|---|
| 167 |
|
|---|
| 168 | #endif
|
|---|