2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
9 // --------------------------------------------------------------------
13 // Implementation of inline methods of UTrd
15 // 19.10.12 Marek Gayer
16 // Created from original implementation in Geant4
17 // --------------------------------------------------------------------
20 double UTrd::GetXHalfLength1() const
26 double UTrd::GetXHalfLength2() const
32 double UTrd::GetYHalfLength1() const
38 double UTrd::GetYHalfLength2() const
44 double UTrd::GetZHalfLength() const
50 void UTrd::SetXHalfLength1(double val)
59 void UTrd::SetXHalfLength2(double val)
67 void UTrd::SetYHalfLength1(double val)
75 void UTrd::SetYHalfLength2(double val)
84 void UTrd::SetZHalfLength(double val)
93 double UTrd::Capacity()
95 if (fCubicVolume != 0.)
101 fCubicVolume = 2 * fDz * ((fDx1 + fDx2) * (fDy1 + fDy2)
102 + (fDx2 - fDx1) * (fDy2 - fDy1) / 3);
108 double UTrd::SurfaceArea()
110 if (fSurfaceArea != 0.)
116 fSurfaceArea = 4 * (fDx1 * fDy1 + fDx2 * fDy2)
117 + 2 * ((fDy1 + fDy2) * std::sqrt(4 * fDz * fDz + (fDx2 - fDx1) * (fDx2 - fDx1))
118 + (fDx1 + fDx2) * std::sqrt(4 * fDz * fDz + (fDy2 - fDy1) * (fDy2 - fDy1)));
122 inline double UTrd::amin(int n, const double* a) const
124 // Return value from array with the minimum element.
126 for (int i = 1; i < n; i++)
128 if (xmin > a[i]) xmin = a[i];
133 inline double UTrd::amax(int n, const double* a)const
135 // Return value from array with the maximum element.
137 for (int i = 1; i < n; i++)
139 if (xmax < a[i]) xmax = a[i];