36 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
42 using namespace CLHEP;
48 G4UTrd::G4UTrd(
const G4String& pName,
52 : G4USolid(pName, new UTrd(pName, pdx1, pdx2, pdy1, pdy2, pdz))
61 G4UTrd::G4UTrd( __void__& a )
78 G4UTrd::G4UTrd(
const G4UTrd& rhs)
87 G4UTrd& G4UTrd::operator = (
const G4UTrd& rhs)
91 if (
this == &rhs) {
return *
this; }
95 G4USolid::operator=(rhs);
104 G4double G4UTrd::GetXHalfLength1()
const
106 return GetShape()->GetXHalfLength1();
108 G4double G4UTrd::GetXHalfLength2()
const
110 return GetShape()->GetXHalfLength2();
112 G4double G4UTrd::GetYHalfLength1()
const
114 return GetShape()->GetYHalfLength1();
116 G4double G4UTrd::GetYHalfLength2()
const
118 return GetShape()->GetYHalfLength2();
120 G4double G4UTrd::GetZHalfLength()
const
122 return GetShape()->GetZHalfLength();
125 void G4UTrd::SetXHalfLength1(
G4double val)
127 GetShape()->SetXHalfLength1(val);
128 fRebuildPolyhedron =
true;
130 void G4UTrd::SetXHalfLength2(
G4double val)
132 GetShape()->SetXHalfLength2(val);
133 fRebuildPolyhedron =
true;
135 void G4UTrd::SetYHalfLength1(
G4double val)
137 GetShape()->SetYHalfLength1(val);
138 fRebuildPolyhedron =
true;
140 void G4UTrd::SetYHalfLength2(
G4double val)
142 GetShape()->SetYHalfLength2(val);
143 fRebuildPolyhedron =
true;
145 void G4UTrd::SetZHalfLength(
G4double val)
147 GetShape()->SetZHalfLength(val);
148 fRebuildPolyhedron =
true;
153 GetShape()->SetAllParameters(pdx1, pdx2, pdy1, pdy2, pdz);
154 fRebuildPolyhedron =
true;
175 return new G4UTrd(*
this);
184 static G4bool checkBBox =
true;
194 pMin.
set(-xmax,-ymax,-dz);
195 pMax.
set( xmax, ymax, dz);
199 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
201 std::ostringstream message;
202 message <<
"Bad bounding box (min >= max) for solid: "
204 <<
"\npMin = " << pMin
205 <<
"\npMax = " << pMax;
215 GetShape()->Extent(vmin,vmax);
223 std::ostringstream message;
224 message <<
"Inconsistency in bounding boxes for solid: "
226 <<
"\nBBox min: wrapper = " << pMin <<
" solid = " << vmin
227 <<
"\nBBox max: wrapper = " << pMax <<
" solid = " << vmax;
239 G4UTrd::CalculateExtent(
const EAxis pAxis,
252 if (
true)
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
254 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
256 return exist = (pMin < pMax) ?
true :
false;
268 baseA[0].set(-dx1,-dy1,-dz);
269 baseA[1].set( dx1,-dy1,-dz);
270 baseA[2].set( dx1, dy1,-dz);
271 baseA[3].set(-dx1, dy1,-dz);
272 baseB[0].set(-dx2,-dy2, dz);
273 baseB[1].set( dx2,-dy2, dz);
274 baseB[2].set( dx2, dy2, dz);
275 baseB[3].set(-dx2, dy2, dz);
277 std::vector<const G4ThreeVectorList *> polygons(2);
278 polygons[0] = &baseA;
279 polygons[1] = &baseB;
282 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
299 #endif // G4GEOM_USE_USOLIDS
void set(double x, double y, double z)
G4GLOB_DLL std::ostream G4cout
const G4double kCarTolerance
std::vector< G4ThreeVector > G4ThreeVectorList
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments