Geant4  10.00.p01
UOrb.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
6 //
7 // $Id:$
8 //
9 // --------------------------------------------------------------------
10 //
11 // UOrb
12 //
13 // Class description:
14 //
15 // A simple Orb defined by half-lengths on the three axis.
16 // The center of the Orb matches the origin of the local reference frame.
17 //
18 // 19.10.12 Marek Gayer
19 // Created from original implementation in Geant4
20 // --------------------------------------------------------------------
21 
22 #ifndef USOLIDS_UOrb
23 #define USOLIDS_UOrb
24 
25 #include "VUSolid.hh"
26 #include "UUtils.hh"
27 
28 class UOrb : public VUSolid
29 {
30 
31  public:
32  UOrb() : VUSolid(), fR(0), fRTolerance(0) {}
33  UOrb(const std::string& name, double pRmax);
34  ~UOrb() {}
35 
36  UOrb(const UOrb& rhs);
37  UOrb& operator=(const UOrb& rhs);
38 
39  // Accessors
40  inline double GetRadius() const;
41  // Modifiers
42  inline void SetRadius(double newRmax);
43 
44  // Navigation methods
45  EnumInside Inside(const UVector3& aPo6int) const;
46 
47  double SafetyFromInside(const UVector3& aPoint,
48  bool aAccurate = false) const;
49  double SafetyFromOutside(const UVector3& aPoint,
50  bool aAccurate = false) const;
51  double DistanceToIn(const UVector3& aPoint,
52  const UVector3& aDirection,
53  double aPstep = UUtils::kInfinity) const;
54 
55  double DistanceToOut(const UVector3& aPoint,
56  const UVector3& aDirection,
57  UVector3& aNormalVector,
58  bool& aConvex,
59  double aPstep = UUtils::kInfinity) const;
60 
61  bool Normal(const UVector3& aPoint, UVector3& aNormal) const;
62  void Extent(UVector3& aMin, UVector3& aMax) const;
63  inline double Capacity();
64  inline double SurfaceArea();
66 
67  void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
68 
69  //G4Visualisation
70  void GetParametersList(int /*aNumber*/, double* /*aArray*/) const;
71 
72  VUSolid* Clone() const;
73 
75  {
76  return fRTolerance;
77  }
78 
80 
81  std::ostream& StreamInfo(std::ostream& os) const;
82 
83  private:
84  double fR;
85  double fRTolerance;
86  double fCubicVolume; // Cubic Volume
87  double fSurfaceArea; // Surface Area
88 
89  double DistanceToOutForOutsidePoints(const UVector3& p, const UVector3& v, UVector3& n) const;
90 
91 };
92 
93 inline double UOrb::GetRadius() const
94 {
95  return fR;
96 }
97 inline void UOrb::SetRadius(double newRmax)
98 {
99  fR = newRmax;
100 }
101 
102 inline double UOrb::Capacity()
103 {
104  if (fCubicVolume != 0.)
105  {
106  ;
107  }
108  else
109  {
110  fCubicVolume = (4 * UUtils::kPi / 3) * fR * fR * fR;
111  }
112  return fCubicVolume;
113 }
114 
115 inline double UOrb::SurfaceArea()
116 {
117  if (fSurfaceArea != 0.)
118  {
119  ;
120  }
121  else
122  {
123  fSurfaceArea = (4 * UUtils::kPi) * fR * fR;
124  }
125  return fSurfaceArea;
126 }
127 
128 #endif
UOrb & operator=(const UOrb &rhs)
Definition: UOrb.cc:505
bool Normal(const UVector3 &aPoint, UVector3 &aNormal) const
Return unit normal of surface closest to p.
Definition: UOrb.cc:421
void ComputeBBox(UBBox *, bool)
Definition: UOrb.hh:67
UOrb()
Definition: UOrb.hh:32
VUSolid * Clone() const
Definition: UOrb.cc:489
G4String name
Definition: TRTMaterials.hh:40
std::ostream & StreamInfo(std::ostream &os) const
Definition: UOrb.cc:454
UGeometryType GetEntityType() const
Definition: UOrb.cc:538
double GetRadius() const
Definition: UOrb.hh:93
double DistanceToOutForOutsidePoints(const UVector3 &p, const UVector3 &v, UVector3 &n) const
Definition: UOrb.cc:177
double SurfaceArea()
Definition: UOrb.hh:115
UVector3 GetPointOnSurface() const
Definition: UOrb.cc:474
double Capacity()
Definition: UOrb.hh:102
double fCubicVolume
Definition: UOrb.hh:86
static const double kInfinity
Definition: UUtils.hh:54
Definition: UOrb.hh:28
~UOrb()
Definition: UOrb.hh:34
double SafetyFromInside(const UVector3 &aPoint, bool aAccurate=false) const
Definition: UOrb.cc:350
double DistanceToIn(const UVector3 &aPoint, const UVector3 &aDirection, double aPstep=UUtils::kInfinity) const
Definition: UOrb.cc:84
void GetParametersList(int, double *) const
Definition: UOrb.cc:530
EnumInside
Definition: VUSolid.hh:23
const G4int n
void Extent(UVector3 &aMin, UVector3 &aMax) const
Returns extent of the solid along a given cartesian axis OK.
Definition: UOrb.cc:443
double fSurfaceArea
Definition: UOrb.hh:87
double fR
Definition: UOrb.hh:84
double fRTolerance
Definition: UOrb.hh:85
double GetRadialTolerance()
Definition: UOrb.hh:74
static const double kPi
Definition: UUtils.hh:49
std::string UGeometryType
Definition: UTypes.hh:70
double SafetyFromOutside(const UVector3 &aPoint, bool aAccurate=false) const
Definition: UOrb.cc:393
void SetRadius(double newRmax)
Definition: UOrb.hh:97
EnumInside Inside(const UVector3 &aPo6int) const
Return whether point inside/outside/on surface Split into radius checks.
Definition: UOrb.cc:53
double DistanceToOut(const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const
Definition: UOrb.cc:203