Geant4  10.01.p01
UTrd.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 // UTrd
12 //
13 // Class description:
14 //
15 // A UTrd is a trapezoid with the x and y dimensions varying along z
16 // functions.
17 //
18 // 19.10.12 Marek Gayer
19 // Created from original implementation in Geant4
20 // --------------------------------------------------------------------
21 
22 #ifndef USOLIDS_UTrd
23 #define USOLIDS_UTrd
24 
25 #include "VUSolid.hh"
26 #include "UUtils.hh"
27 
28 class UTrd : public VUSolid
29 {
30  enum ESide {kUndefined, kPX, kMX, kPY, kMY, kPZ, kMZ};
31  public:
32  UTrd() : VUSolid(), fDx1(0), fDx2(0), fDy1(0), fDy2(0), fDz(0) {}
33  UTrd(const std::string& pName, double pdx1, double pdx2, double pdy1, double pdy2, double pdz);
34  virtual ~UTrd() {}
35 
36  UTrd(const UTrd& rhs);
37  UTrd& operator=(const UTrd& rhs);
38 
39  // Copy constructor and assignment operator
40 
41  // Accessors
42 
43  inline double GetXHalfLength1() const;
44  inline double GetXHalfLength2() const;
45  inline double GetYHalfLength1() const;
46  inline double GetYHalfLength2() const;
47  inline double GetZHalfLength() const;
48 
49  // Modifiers
50 
51  inline void SetXHalfLength1(double val);
52  inline void SetXHalfLength2(double val);
53  inline void SetYHalfLength1(double val);
54  inline void SetYHalfLength2(double val);
55  inline void SetZHalfLength(double val);
56  // Navigation methods
57  EnumInside Inside(const UVector3& aPoint) const;
58 
59  virtual double SafetyFromInside(const UVector3& aPoint, bool aAccurate = false) const;
60 
61  double SafetyFromInsideAccurate(const UVector3& aPoint) const;
62 
63  virtual double SafetyFromOutside(const UVector3& aPoint, bool aAccurate = false) const;
64 
65  double SafetyFromOutsideAccurate(const UVector3& aPoint) const;
66 
67  virtual double DistanceToIn(const UVector3& aPoint,
68  const UVector3& aDirection,
69  // UVector3 &aNormalVector,
70  double aPstep = UUtils::kInfinity) const;
71 
72 
73  virtual double DistanceToOut(const UVector3& aPoint,
74  const UVector3& aDirection,
75  UVector3& aNormalVector,
76  bool& aConvex,
77  double aPstep = UUtils::kInfinity) const;
78 
79  virtual bool Normal(const UVector3& aPoint, UVector3& aNormal) const;
80 
81  void CheckAndSetAllParameters ( double pdx1, double pdx2,
82  double pdy1, double pdy2,
83  double pdz );
84 
85  void SetAllParameters ( double pdx1, double pdx2,
86  double pdy1, double pdy2,
87  double pdz );
88 
89 // virtual void Extent ( EAxisType aAxis, double &aMin, double &aMax ) const;
90  void Extent(UVector3& aMin, UVector3& aMax) const;
91  inline double Capacity();
92  inline double SurfaceArea();
93  VUSolid* Clone() const;
95 
96  virtual void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
97 
98  //G4Visualisation
99  virtual void GetParametersList(int /*aNumber*/, double* /*aArray*/) const;
100  std::ostream& StreamInfo(std::ostream& os) const;
101 
102  UVector3 GetPointOnSurface() const;
103 
104  private:
105  UVector3 ApproxSurfaceNormal(const UVector3& p) const;
106  inline double amin(int n, const double* a) const;
107  inline double amax(int n, const double* a)const;
108  double fDx1, fDx2, fDy1, fDy2, fDz;
109  double fCubicVolume; // Cubic Volume
110  double fSurfaceArea; // Surface Area
111 };
112 
113 #include "UTrd.icc"
114 
115 #endif
double fDy2
Definition: UTrd.hh:108
virtual double SafetyFromInside(const UVector3 &aPoint, bool aAccurate=false) const
Definition: UTrd.cc:83
void SetYHalfLength2(double val)
double GetZHalfLength() const
void SetYHalfLength1(double val)
VUSolid * Clone() const
Definition: UTrd.cc:1288
virtual bool Normal(const UVector3 &aPoint, UVector3 &aNormal) const
Definition: UTrd.cc:932
double SafetyFromOutsideAccurate(const UVector3 &aPoint) const
Definition: UTrd.cc:209
void SetXHalfLength1(double val)
UVector3 GetPointOnSurface() const
Definition: UTrd.cc:1163
double GetXHalfLength2() const
double fDy1
Definition: UTrd.hh:108
virtual void ComputeBBox(UBBox *, bool)
Definition: UTrd.hh:96
UVector3 ApproxSurfaceNormal(const UVector3 &p) const
Definition: UTrd.cc:1047
virtual void GetParametersList(int, double *) const
Definition: UTrd.cc:1276
ESide
Definition: UTrd.hh:30
double fDx2
Definition: UTrd.hh:108
G4double a
Definition: TRTMaterials.hh:39
double fCubicVolume
Definition: UTrd.hh:109
double SurfaceArea()
void SetXHalfLength2(double val)
double SafetyFromInsideAccurate(const UVector3 &aPoint) const
Definition: UTrd.cc:132
void SetZHalfLength(double val)
void CheckAndSetAllParameters(double pdx1, double pdx2, double pdy1, double pdy2, double pdz)
Definition: UTrd.cc:38
double amax(int n, const double *a) const
static const double kInfinity
Definition: UUtils.hh:53
double GetYHalfLength2() const
void SetAllParameters(double pdx1, double pdx2, double pdy1, double pdy2, double pdz)
Definition: UTrd.cc:77
double fDz
Definition: UTrd.hh:108
double amin(int n, const double *a) const
double fDx1
Definition: UTrd.hh:108
double GetYHalfLength1() const
double fSurfaceArea
Definition: UTrd.hh:110
EnumInside
Definition: VUSolid.hh:23
const G4int n
EnumInside Inside(const UVector3 &aPoint) const
Return whether point inside/outside/on surface Split into radius checks.
Definition: UTrd.cc:255
virtual ~UTrd()
Definition: UTrd.hh:34
void Extent(UVector3 &aMin, UVector3 &aMax) const
Returns the full 3D cartesian extent of the solid.
Definition: UTrd.cc:1126
UTrd & operator=(const UTrd &rhs)
Definition: UTrd.cc:1249
Definition: UTrd.hh:28
double GetXHalfLength1() const
std::string UGeometryType
Definition: UTypes.hh:39
UGeometryType GetEntityType() const
Definition: UTrd.cc:1296
virtual double DistanceToOut(const UVector3 &aPoint, const UVector3 &aDirection, UVector3 &aNormalVector, bool &aConvex, double aPstep=UUtils::kInfinity) const
Definition: UTrd.cc:555
UTrd()
Definition: UTrd.hh:32
double Capacity()
std::ostream & StreamInfo(std::ostream &os) const
Definition: UTrd.cc:1137
virtual double SafetyFromOutside(const UVector3 &aPoint, bool aAccurate=false) const
Definition: UTrd.cc:170
virtual double DistanceToIn(const UVector3 &aPoint, const UVector3 &aDirection, double aPstep=UUtils::kInfinity) const
Definition: UTrd.cc:321