[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: G4BREPSolidCone.hh,v 1.11 2006/06/29 18:37:51 gunter Exp $ |
---|
[850] | 28 | // GEANT4 tag $Name: HEAD $ |
---|
[831] | 29 | // |
---|
| 30 | // ---------------------------------------------------------------------- |
---|
| 31 | // Class G4BREPSolidCone |
---|
| 32 | // |
---|
| 33 | // Class description: |
---|
| 34 | // |
---|
| 35 | // Definition of a generic BREP cone. |
---|
| 36 | // |
---|
| 37 | // G4BREPSolidCone(const G4String& name, |
---|
| 38 | // const G4ThreeVector& origin, |
---|
| 39 | // const G4ThreeVector& axis, |
---|
| 40 | // const G4ThreeVector& direction, |
---|
| 41 | // G4double length, |
---|
| 42 | // G4double radius, |
---|
| 43 | // G4double large_radius) |
---|
| 44 | |
---|
| 45 | // Authors: J.Sulkimo, P.Urban. |
---|
| 46 | // Revisions by: L.Broglia, G.Cosmo. |
---|
| 47 | // ---------------------------------------------------------------------- |
---|
| 48 | #ifndef __G4BREPSolidCone |
---|
| 49 | #define __G4BREPSolidCone |
---|
| 50 | |
---|
| 51 | #include "G4BREPSolid.hh" |
---|
| 52 | |
---|
| 53 | class G4BREPSolidCone : public G4BREPSolid |
---|
| 54 | { |
---|
| 55 | public: // with description |
---|
| 56 | |
---|
| 57 | G4BREPSolidCone(const G4String& name, const G4ThreeVector& origin, |
---|
| 58 | const G4ThreeVector& axis, const G4ThreeVector& direction, |
---|
| 59 | G4double length, G4double radius, G4double large_radius); |
---|
| 60 | // Constructor |
---|
| 61 | |
---|
| 62 | ~G4BREPSolidCone(); |
---|
| 63 | // Empty destructor. |
---|
| 64 | |
---|
| 65 | void Initialize(); |
---|
| 66 | // Computes the bounding box for solids and surfaces. |
---|
| 67 | // Converts concave planes to convex. |
---|
| 68 | |
---|
| 69 | EInside Inside(register const G4ThreeVector& Pt) const; |
---|
| 70 | // Determines if the point Pt is inside, outside or on the surface |
---|
| 71 | // of the solid. |
---|
| 72 | |
---|
| 73 | G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const; |
---|
| 74 | // Returns the outwards pointing unit normal of the shape for the |
---|
| 75 | // surface closest to the point at offset p. |
---|
| 76 | |
---|
| 77 | G4double DistanceToIn(const G4ThreeVector& p) const; |
---|
| 78 | // Calculate the distance to the nearest surface of a shape from an |
---|
| 79 | // outside point p. The distance can be an underestimate. |
---|
| 80 | |
---|
| 81 | G4double DistanceToIn(register const G4ThreeVector& p, |
---|
| 82 | register const G4ThreeVector& v) const; |
---|
| 83 | // Returns the distance along the normalised vector v to the shape, |
---|
| 84 | // from the point at offset p. If there is no intersection, returns |
---|
| 85 | // kInfinity. The first intersection resulting from `leaving' a |
---|
| 86 | // surface/volume is discarded. Hence, it is tolerant of points on |
---|
| 87 | // the surface of the shape. |
---|
| 88 | |
---|
| 89 | G4double DistanceToOut(register const G4ThreeVector& p, |
---|
| 90 | register const G4ThreeVector& v, |
---|
| 91 | const G4bool calcNorm=false, |
---|
| 92 | G4bool *validNorm=0, G4ThreeVector *n=0) const; |
---|
| 93 | // Returns the distance along the normalised vector v to the shape, |
---|
| 94 | // from a point at an offset p inside or on the surface of the shape. |
---|
| 95 | |
---|
| 96 | G4double DistanceToOut(const G4ThreeVector& p) const; |
---|
| 97 | // Calculates the distance to the nearest surface of a shape from an |
---|
| 98 | // inside point. The distance can be an underestimate. |
---|
| 99 | |
---|
| 100 | virtual std::ostream& StreamInfo(std::ostream& os) const; |
---|
| 101 | // Streams solid contents to output stream. |
---|
| 102 | |
---|
| 103 | public: // without description |
---|
| 104 | |
---|
| 105 | G4BREPSolidCone(__void__&); |
---|
| 106 | // Fake default constructor for usage restricted to direct object |
---|
| 107 | // persistency for clients requiring preallocation of memory for |
---|
| 108 | // persistifiable objects. |
---|
| 109 | |
---|
| 110 | private: |
---|
| 111 | |
---|
| 112 | G4BREPSolidCone(const G4BREPSolidCone&); |
---|
| 113 | G4BREPSolidCone& operator=(const G4BREPSolidCone&); |
---|
| 114 | // Private copy constructor and assignment operator. |
---|
| 115 | |
---|
| 116 | private: |
---|
| 117 | |
---|
| 118 | struct G4BREPConeParams |
---|
| 119 | { |
---|
| 120 | G4ThreeVector origin; |
---|
| 121 | G4ThreeVector axis; |
---|
| 122 | G4ThreeVector direction; |
---|
| 123 | G4double length; |
---|
| 124 | G4double radius; |
---|
| 125 | G4double large_radius; |
---|
| 126 | } constructorParams; |
---|
| 127 | |
---|
| 128 | }; |
---|
| 129 | |
---|
| 130 | #endif |
---|