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