| [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: G4BREPSolidSphere.hh,v 1.11 2006/06/29 18:38:01 gunter Exp $
|
|---|
| [1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| [831] | 29 | //
|
|---|
| 30 | // ----------------------------------------------------------------------
|
|---|
| 31 | // Class G4BREPSolidSphere
|
|---|
| 32 | //
|
|---|
| 33 | // Class description:
|
|---|
| 34 | //
|
|---|
| 35 | // Definition of a generic BREP sphere:
|
|---|
| 36 | //
|
|---|
| 37 | // G4BREPSolidSphere(const G4String& name,
|
|---|
| 38 | // const G4Vector3D& origin,
|
|---|
| 39 | // const G4Vector3D& xhat,
|
|---|
| 40 | // const G4Vector3D& zhat,
|
|---|
| 41 | // G4double radius)
|
|---|
| 42 |
|
|---|
| 43 | // Authors: J.Sulkimo, P.Urban.
|
|---|
| 44 | // Revisions by: L.Broglia, G.Cosmo.
|
|---|
| 45 | // ----------------------------------------------------------------------
|
|---|
| 46 | #ifndef __G4BREPSolidSphere
|
|---|
| 47 | #define __G4BREPSolidSphere
|
|---|
| 48 |
|
|---|
| 49 | #include "G4BREPSolid.hh"
|
|---|
| 50 |
|
|---|
| 51 | class G4BREPSolidSphere : public G4BREPSolid
|
|---|
| 52 | {
|
|---|
| 53 |
|
|---|
| 54 | public: // with description
|
|---|
| 55 |
|
|---|
| 56 | G4BREPSolidSphere(const G4String& name,
|
|---|
| 57 | const G4Vector3D& origin,
|
|---|
| 58 | const G4Vector3D& xhat,
|
|---|
| 59 | const G4Vector3D& zhat,
|
|---|
| 60 | G4double radius);
|
|---|
| 61 | // Constructor defining the sphere through its spherical surfaces.
|
|---|
| 62 |
|
|---|
| 63 | ~G4BREPSolidSphere();
|
|---|
| 64 | // Empty destructor.
|
|---|
| 65 |
|
|---|
| 66 | EInside Inside(register const G4ThreeVector& Pt) const;
|
|---|
| 67 | // Determines if the point Pt is inside, outside or on the surface
|
|---|
| 68 | // of the solid.
|
|---|
| 69 |
|
|---|
| 70 | G4ThreeVector SurfaceNormal(const G4ThreeVector&) const;
|
|---|
| 71 | // Calculates the normal of the surface at a point on the surface
|
|---|
| 72 | // The sense of the normal depends on the sense of the surface.
|
|---|
| 73 |
|
|---|
| 74 | G4double DistanceToIn(const G4ThreeVector&) const;
|
|---|
| 75 | // Calculates the shortest distance ("safety") from a point
|
|---|
| 76 | // outside the solid to any boundary of this solid.
|
|---|
| 77 | // Return 0 if the point is already inside.
|
|---|
| 78 |
|
|---|
| 79 | G4double DistanceToIn(register const G4ThreeVector& Pt,
|
|---|
| 80 | register const G4ThreeVector& V) const;
|
|---|
| 81 | // Calculates the distance from a point Pt outside the solid
|
|---|
| 82 | // to the solid's boundary along a specified direction vector V.
|
|---|
| 83 | // Note: Intersections with boundaries less than the tolerance must
|
|---|
| 84 | // be ignored if the direction is away from the boundary.
|
|---|
| 85 |
|
|---|
| 86 | G4double DistanceToOut(register const G4ThreeVector& Pt,
|
|---|
| 87 | register const G4ThreeVector& V,
|
|---|
| 88 | const G4bool calcNorm=false,
|
|---|
| 89 | G4bool *validNorm=0, G4ThreeVector *n=0) const;
|
|---|
| 90 | // Calculates the distance from a point inside the solid to the solid`s
|
|---|
| 91 | // boundary along a specified direction vector.
|
|---|
| 92 | // Return 0 if the point is already outside.
|
|---|
| 93 | // Note: If the shortest distance to a boundary is less than the
|
|---|
| 94 | // tolerance, it is ignored. This allows for a point within a
|
|---|
| 95 | // tolerant boundary to leave immediately.
|
|---|
| 96 |
|
|---|
| 97 | G4double DistanceToOut(const G4ThreeVector&) const;
|
|---|
| 98 | // Calculates the shortest distance ("safety") from a point inside the
|
|---|
| 99 | // solid to any boundary of this solid.
|
|---|
| 100 | // Return 0 if the point is already outside.
|
|---|
| 101 |
|
|---|
| 102 | virtual std::ostream& StreamInfo(std::ostream& os) const;
|
|---|
| 103 | // Streams solid contents to output stream.
|
|---|
| 104 |
|
|---|
| 105 | public: // without description
|
|---|
| 106 |
|
|---|
| 107 | G4BREPSolidSphere(__void__&);
|
|---|
| 108 | // Fake default constructor for usage restricted to direct object
|
|---|
| 109 | // persistency for clients requiring preallocation of memory for
|
|---|
| 110 | // persistifiable objects.
|
|---|
| 111 |
|
|---|
| 112 | inline void SphReset() { active=1; }
|
|---|
| 113 |
|
|---|
| 114 | private:
|
|---|
| 115 |
|
|---|
| 116 | G4BREPSolidSphere(const G4BREPSolidSphere&);
|
|---|
| 117 | G4BREPSolidSphere& operator=(const G4BREPSolidSphere&);
|
|---|
| 118 | // Private copy constructor and assignment operator.
|
|---|
| 119 |
|
|---|
| 120 | struct G4BREPSphereParams
|
|---|
| 121 | {
|
|---|
| 122 | G4Vector3D origin;
|
|---|
| 123 | G4Vector3D xhat;
|
|---|
| 124 | G4Vector3D zhat;
|
|---|
| 125 | G4double radius;
|
|---|
| 126 | } constructorParams;
|
|---|
| 127 | };
|
|---|
| 128 |
|
|---|
| 129 | #endif
|
|---|