Geant4_10
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  inline double SafetyFromInsideAccurate(const UVector3& aPoint) const;
62 
63  virtual double SafetyFromOutside(const UVector3& aPoint, bool aAccurate = false) const;
64 
65  inline 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  inline VUSolid* Clone() const
94  {
95  return new UTrd(GetName(), fDx1, fDx2, fDy1, fDy2, fDz);
96  }
98 
99  virtual void ComputeBBox(UBBox* /*aBox*/, bool /*aStore = false*/) {}
100 
101  //G4Visualisation
102  virtual void GetParametersList(int /*aNumber*/, double* /*aArray*/) const;
103  std::ostream& StreamInfo(std::ostream& os) const;
104 
105  UVector3 GetPointOnSurface() const;
106 
107  private:
108  inline UVector3 ApproxSurfaceNormal(const UVector3& p) const;
109  inline double amin(int n, const double* a) const;
110  inline double amax(int n, const double* a)const;
111  double fDx1, fDx2, fDy1, fDy2, fDz;
112  double fCubicVolume; // Cubic Volume
113  double fSurfaceArea; // Surface Area
114 };
115 
116 #include "UTrd.icc"
117 
118 #endif
virtual double SafetyFromInside(const UVector3 &aPoint, bool aAccurate=false) const
Definition: UTrd.cc:83
void SetYHalfLength2(double val)
tuple a
Definition: test.py:11
double GetZHalfLength() const
void SetYHalfLength1(double val)
VUSolid * Clone() const
Definition: UTrd.hh:93
virtual bool Normal(const UVector3 &aPoint, UVector3 &aNormal) const
Definition: UTrd.cc:932
const std::string & GetName() const
Definition: VUSolid.hh:103
double SafetyFromOutsideAccurate(const UVector3 &aPoint) const
Definition: UTrd.cc:209
void SetXHalfLength1(double val)
const char * p
Definition: xmltok.h:285
UVector3 GetPointOnSurface() const
Definition: UTrd.cc:1163
double GetXHalfLength2() const
virtual void ComputeBBox(UBBox *, bool)
Definition: UTrd.hh:99
virtual void GetParametersList(int, double *) const
Definition: UTrd.cc:1276
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
Char_t n[5]
double GetYHalfLength2() const
void SetAllParameters(double pdx1, double pdx2, double pdy1, double pdy2, double pdz)
Definition: UTrd.cc:77
double GetYHalfLength1() const
EnumInside
Definition: VUSolid.hh:23
EnumInside Inside(const UVector3 &aPoint) const
Definition: UTrd.cc:255
virtual ~UTrd()
Definition: UTrd.hh:34
void Extent(UVector3 &aMin, UVector3 &aMax) const
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:70
UGeometryType GetEntityType() const
Definition: UTrd.cc:1288
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