Geant4  10.00.p03
UCons.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 // UCons
12 //
13 // Class description:
14 //
15 // A UCons is, in the general case, a Phi segment of a cone, with
16 // half-length fDz, inner and outer radii specified at -fDz and +fDz.
17 // The Phi segment is described by a starting fSPhi angle, and the
18 // +fDPhi delta angle for the shape.
19 // If the delta angle is >=2*UUtils::kPi, the shape is treated as
20 // continuous in Phi
21 //
22 // Member Data:
23 //
24 // fRmin1 inside radius at -fDz
25 // fRmin2 inside radius at +fDz
26 // fRmax1 outside radius at -fDz
27 // fRmax2 outside radius at +fDz
28 // fDz half length in z
29 //
30 // fSPhi starting angle of the segment in radians
31 // fDPhi delta angle of the segment in radians
32 //
33 // fPhiFullCone Boolean variable used for indicate the Phi Section
34 //
35 // Note:
36 // Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
37 // and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
38 // made with (say) Phi of a point.
39 //
40 // 19.10.12 Marek Gayer
41 // Created from original implementation in Geant4
42 // --------------------------------------------------------------------
43 
44 #ifndef UCons_HH
45 #define UCons_HH
46 
47 #include "VUSolid.hh"
48 
49 class UCons : public VUSolid
50 {
51  public: // with description
52 
53  UCons(const std::string& pName,
54  double pRmin1, double pRmax1,
55  double pRmin2, double pRmax2,
56  double pDz,
57  double pSPhi, double pDPhi);
58  //
59  // Constructs a cone with the given name and dimensions
60 
61  ~UCons() ;
62  //
63  // Destructor
64 
65  // Accessors
66 
67  inline double GetInnerRadiusMinusZ() const;
68  inline double GetOuterRadiusMinusZ() const;
69  inline double GetInnerRadiusPlusZ() const;
70  inline double GetOuterRadiusPlusZ() const;
71  inline double GetZHalfLength() const;
72  inline double GetStartPhiAngle() const;
73  inline double GetDeltaPhiAngle() const;
74 
75  // Modifiers
76 
77  inline void SetInnerRadiusMinusZ(double Rmin1);
78  inline void SetOuterRadiusMinusZ(double Rmax1);
79  inline void SetInnerRadiusPlusZ(double Rmin2);
80  inline void SetOuterRadiusPlusZ(double Rmax2);
81  inline void SetZHalfLength(double newDz);
82  inline void SetStartPhiAngle(double newSPhi, bool trig = true);
83  inline void SetDeltaPhiAngle(double newDPhi);
84 
85  // Other methods for solid
86 
87  inline double GetCubicVolume();
88  inline double GetSurfaceArea();
89 
90 
91 // inline VUSolid::EnumInside Inside( const UVector3& p ) const;
92 
93  bool Normal(const UVector3& p, UVector3& n) const;
94 
95  double DistanceToIn(const UVector3& p, const UVector3& v, double aPstep = UUtils::kInfinity) const;
96 
97  double SafetyFromOutside(const UVector3& p, bool precise) const;
98 
99 
100 
101  double DistanceToOut(const UVector3& aPoint,
102  const UVector3& aDirection,
103  UVector3& aNormalVector,
104  bool& aConvex,
105  double aPstep = UUtils::kInfinity) const;
106 
107  double SafetyFromInside(const UVector3& p, bool precise) const;
108 
110 
111  UVector3 GetPointOnSurface() const;
112 
113  VUSolid* Clone() const;
114 
115  std::ostream& StreamInfo(std::ostream& os) const;
116 
117 // void Extent (EAxisType aAxis, double &aMin, double &aMax) const;
118  void Extent(UVector3& aMin, UVector3& aMax) const;
119 
120  virtual void GetParametersList(int /*aNumber*/, double* /*aArray*/) const;
121 
122  virtual void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
123 
124  // Safety used for UPolycone
125 
126  inline double SafetyToPhi(const UVector3& p,
127  const double rho, bool& outside) const;
128  inline double SafetyFromInsideR(const UVector3& p,
129  const double rho,bool) const;
130  inline double SafetyFromOutsideR(const UVector3& p,
131  const double rho,bool) const;
132 
133  inline VUSolid::EnumInside Inside(const UVector3& p) const;
134 
135  public: // without description
136 
137  UCons();
138  //
139  // Fake default constructor for usage restricted to direct object
140  // persistency for clients requiring preallocation of memory for
141  // persistifiable objects.
142 
143  UCons(const UCons& rhs);
144  UCons& operator=(const UCons& rhs);
145  // Copy constructor and assignment operator.
146 
147  // Old access functions
148 
149  inline double GetRmin1() const;
150  inline double GetRmax1() const;
151  inline double GetRmin2() const;
152  inline double GetRmax2() const;
153  inline double GetDz() const;
154  inline double GetSPhi() const;
155  inline double GetDPhi() const;
156 
157  private:
158 
160 
161  inline double Capacity();
162  inline double SurfaceArea();
163 
164  inline void Initialize();
165  //
166  // Reset relevant values to zero
167 
168  inline void CheckSPhiAngle(double sPhi);
169  inline void CheckDPhiAngle(double dPhi);
170  inline void CheckPhiAngles(double sPhi, double dPhi);
171  //
172  // Reset relevant flags and angle values
173 
174  inline void InitializeTrigonometry();
175  //
176  // Recompute relevant trigonometric values and cache them
177 
178  UVector3 ApproxSurfaceNormal(const UVector3& p) const;
179  //
180  // Algorithm for SurfaceNormal() following the original
181  // specification for points not on the surface
182 
183  private:
184 
185  // Used by distanceToOut
186  //
188 
189  // used by normal
190  //
192 
194  //
195  // Radial and angular tolerances
196 
198  //
199  // Radial and angular dimensions
200 
203  //
204  // Cached trigonometric values
205 
207  //
208  // Flag for identification of section or full cone
209 
211 };
212 
213 #include "UCons.icc"
214 
215 #endif
double SafetyToPhi(const UVector3 &p, const double rho, bool &outside) const
void SetZHalfLength(double newDz)
double GetRmin1() const
double GetDPhi() const
double sinSPhi
Definition: UCons.hh:201
bool fPhiFullCone
Definition: UCons.hh:206
double SafetyFromOutside(const UVector3 &p, bool precise) const
Definition: UCons.cc:1259
virtual void ComputeBBox(UBBox *, bool)
Definition: UCons.hh:122
VUSolid::EnumInside Inside(const UVector3 &p) const
double Capacity()
void Initialize()
double GetRmax2() const
void SetOuterRadiusMinusZ(double Rmax1)
UGeometryType GetEntityType() const
Definition: UCons.cc:2044
double fSPhi
Definition: UCons.hh:197
std::ostream & StreamInfo(std::ostream &os) const
Definition: UCons.cc:2063
double DistanceToIn(const UVector3 &p, const UVector3 &v, double aPstep=UUtils::kInfinity) const
Definition: UCons.cc:440
UCons & operator=(const UCons &rhs)
Definition: UCons.cc:130
double cosHDPhiOT
Definition: UCons.hh:201
void InitializeTrigonometry()
~UCons()
Definition: UCons.cc:106
double secRMax
Definition: UCons.hh:210
double cosCPhi
Definition: UCons.hh:201
double SafetyFromInsideR(const UVector3 &p, const double rho, bool) const
double SafetyFromOutsideR(const UVector3 &p, const double rho, bool) const
double SafetyFromInside(const UVector3 &p, bool precise) const
Definition: UCons.cc:1995
double GetOuterRadiusPlusZ() const
double GetSPhi() const
double SurfaceArea()
VUSolid * Clone() const
Definition: UCons.cc:2053
Definition: UCons.hh:49
double tanRMin
Definition: UCons.hh:210
void SetDeltaPhiAngle(double newDPhi)
ESide
Definition: UCons.hh:187
double tanRMax
Definition: UCons.hh:210
static const double kInfinity
Definition: UUtils.hh:53
double kAngTolerance
Definition: UCons.hh:193
double GetDz() const
double GetStartPhiAngle() const
bool Normal(const UVector3 &p, UVector3 &n) const
Definition: UCons.cc:174
double GetZHalfLength() const
double sinCPhi
Definition: UCons.hh:201
double fDPhi
Definition: UCons.hh:197
ENorm
Definition: UCons.hh:191
double fRmin2
Definition: UCons.hh:197
EnumInside
Definition: VUSolid.hh:23
const G4int n
double sinEPhi
Definition: UCons.hh:201
double fSurfaceArea
Definition: UCons.hh:159
double cosSPhi
Definition: UCons.hh:201
double GetInnerRadiusPlusZ() const
double fRmax1
Definition: UCons.hh:197
double GetOuterRadiusMinusZ() const
double fCubicVolume
Definition: UCons.hh:159
void Extent(UVector3 &aMin, UVector3 &aMax) const
Definition: UCons.cc:2185
double kRadTolerance
Definition: UCons.hh:193
virtual void GetParametersList(int, double *) const
Definition: UCons.cc:2192
double GetRmax1() const
double fDz
Definition: UCons.hh:197
double GetSurfaceArea()
void CheckPhiAngles(double sPhi, double dPhi)
void SetInnerRadiusPlusZ(double Rmin2)
void CheckSPhiAngle(double sPhi)
double fRmin1
Definition: UCons.hh:197
double GetDeltaPhiAngle() const
double secRMin
Definition: UCons.hh:210
std::string UGeometryType
Definition: UTypes.hh:39
double GetInnerRadiusMinusZ() const
void SetOuterRadiusPlusZ(double Rmax2)
double cosHDPhiIT
Definition: UCons.hh:201
UCons()
Definition: UCons.cc:92
UVector3 GetPointOnSurface() const
Definition: UCons.cc:2090
void SetInnerRadiusMinusZ(double Rmin1)
UVector3 ApproxSurfaceNormal(const UVector3 &p) const
Definition: UCons.cc:298
void CheckDPhiAngle(double dPhi)
double fRmax2
Definition: UCons.hh:197
double cosEPhi
Definition: UCons.hh:201
double GetRmin2() const
void SetStartPhiAngle(double newSPhi, bool trig=true)
double DistanceToOut(const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const
Definition: UCons.cc:1343
double GetCubicVolume()