37 #if defined(G4GEOM_USE_USOLIDS)
55 G4VSolid(name), fShape(s), fRebuildPolyhedron(false), fPolyhedron(0)
59 G4USolid::G4USolid(__void__&
a)
60 :
G4VSolid(a), fShape(0), fRebuildPolyhedron(false), fPolyhedron(0)
66 delete fPolyhedron; fPolyhedron = 0;
71 return (
this == &s) ?
true :
false;
77 VUSolid::EnumInside in_temp;
83 in_temp = fShape->Inside(pt);
86 if (in_temp == VUSolid::eSurface)
return kSurface;
87 if (in_temp == VUSolid::eInside)
return kInside;
89 if (in_temp == VUSolid::EnumInside::eSurface)
return kSurface;
90 if (in_temp == VUSolid::EnumInside::eInside)
return kInside;
103 fShape->Normal(p, n);
118 G4double dist = fShape->DistanceToIn(p, v);
129 G4double dist = fShape->SafetyFromOutside(p);
150 G4double dist = fShape->DistanceToOut(p, v, n,valid);
153 if(valid){ *validNorm =
true;}
154 else {* validNorm =
false;}
171 return fShape->SafetyFromInside(p);
176 return fShape->Capacity();
181 return fShape->SurfaceArea();
187 p = fShape->GetPointOnSurface();
191 G4bool G4USolid::CalculateExtent(
const EAxis pAxis,
198 VUSolid::EAxisType eAxis = VUSolid::eXaxis;
202 eAxis = VUSolid::eYaxis;
207 eAxis = VUSolid::eZaxis;
210 fShape->ExtentAxis(eAxis, pMin, pMax);
258 pMin -= kCarTolerance ;
259 pMax += kCarTolerance ;
267 G4bool existsAfterClip = false ;
275 vertices = CreateRotatedVertices(pTransform) ;
276 ClipCrossSection(vertices, 0, pVoxelLimit, pAxis, pMin, pMax) ;
277 ClipCrossSection(vertices, 4, pVoxelLimit, pAxis, pMin, pMax) ;
278 ClipBetweenSections(vertices, 0, pVoxelLimit, pAxis, pMin, pMax) ;
280 if (pVoxelLimit.
IsLimited(pAxis) ==
false)
284 existsAfterClip = true ;
288 pMin -= kCarTolerance;
289 pMax += kCarTolerance;
301 existsAfterClip = true ;
314 pMin -= kCarTolerance;
324 pMax += kCarTolerance;
336 existsAfterClip = true ;
342 return existsAfterClip;
350 std::ostringstream message;
351 message <<
"Illegal call to G4USolid::ComputeDimensions()" <<
G4endl
352 <<
"Method not overloaded by derived class !";
353 G4Exception(
"G4USolid::ComputeDimensions()",
"GeomSolids0003",
365 G4String string = fShape->GetEntityType();
366 return "G4" + string;
369 std::ostream& G4USolid::StreamInfo(std::ostream& os)
const
371 return fShape->StreamInfo(os);
374 G4USolid::G4USolid(
const G4USolid& rhs)
375 :
G4VSolid(rhs), fRebuildPolyhedron(false), fPolyhedron(0)
377 fShape = rhs.fShape->
Clone();
380 G4USolid& G4USolid::operator=(
const G4USolid& rhs)
395 fShape = rhs.fShape->Clone();
396 fRebuildPolyhedron =
false;
397 delete fPolyhedron; fPolyhedron = 0;
404 std::ostringstream message;
405 message <<
"Clone() method not implemented for type: "
406 << GetEntityType() <<
"!" <<
G4endl
407 <<
"Returning NULL pointer!";
415 G4double xMin, xMax, yMin, yMax, zMin, zMax;
417 fShape->ExtentAxis(VUSolid::eXaxis, xMin, xMax);
418 fShape->ExtentAxis(VUSolid::eYaxis, yMin, yMax);
419 fShape->ExtentAxis(VUSolid::eZaxis, zMin, zMax);
426 vertices->reserve(8);
447 G4Exception(
"G4VUSolid::CreateRotatedVertices()",
"FatalError",
456 if (fShape->GetEntityType() ==
"Box")
459 fShape->GetParametersList(index, array);
462 if (fShape->GetEntityType() ==
"Tubs")
465 fShape->GetParametersList(index, array);
466 return new G4PolyhedronTubs(array[0], array[1], array[2], array[3], array[4]);
468 if (fShape->GetEntityType() ==
"Cons")
471 fShape->GetParametersList(index, array);
472 return new G4PolyhedronCons(array[0], array[1], array[2], array[3], array[4], array[5], array[6]);
474 if (fShape->GetEntityType() ==
"Orb")
477 fShape->GetParametersList(index, array);
480 if (fShape->GetEntityType() ==
"Sphere")
483 fShape->GetParametersList(index, array);
484 return new G4PolyhedronSphere(array[0], array[1], array[2], array[3], array[4], array[5]);
486 if (fShape->GetEntityType() ==
"Tet")
489 fShape->GetParametersList(index, array);
492 static int faces[4][4] = {{1, 3, 2, 0}, {1, 4, 3, 0}, {1, 2, 4, 0}, {2, 3, 4, 0}};
493 xyz[0][0] = array[0];
494 xyz[0][1] = array[1];
495 xyz[0][2] = array[2];
496 xyz[1][0] = array[3];
497 xyz[1][1] = array[4];
498 xyz[1][2] = array[5];
499 xyz[2][0] = array[6];
500 xyz[2][1] = array[7];
501 xyz[2][2] = array[8];
502 xyz[3][0] = array[9];
503 xyz[3][1] = array[10];
504 xyz[3][2] = array[11];
506 ph->createPolyhedron(4, 4, xyz, faces);
509 if (fShape->GetEntityType() ==
"Trd")
512 fShape->GetParametersList(index, array);
513 return new G4PolyhedronTrd2(array[0], array[1], array[2], array[3], array[4]);
515 if (fShape->GetEntityType() ==
"Trap")
518 fShape->GetParametersList(index, array);
519 double phi = (array[11] != 1.0) ? (std::atan(array[10] / array[9])) : (0.0);
520 double alpha1 = std::atan(array[4]);
521 double alpha2 = std::atan(array[8]);
522 double theta = std::acos(array[11]);
525 array[1], array[2], array[3], alpha1,
526 array[5], array[6], array[7], alpha2);
563 fRebuildPolyhedron ||
564 fPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
565 fPolyhedron->GetNumberOfRotationSteps())
569 fPolyhedron = CreatePolyhedron();
570 fRebuildPolyhedron =
false;
582 CalculateExtent(
kXAxis, voxelLimits, affineTransform, vmin, vmax);
585 CalculateExtent(
kYAxis, voxelLimits, affineTransform, vmin, vmax);
588 CalculateExtent(
kZAxis, voxelLimits, affineTransform, vmin, vmax);
594 #endif // G4GEOM_USE_USOLIDS
static const G4double kInfinity
G4double GetMinYExtent() const
CLHEP::Hep3Vector G4ThreeVector
void SetXmax(G4double xmax)
virtual void AddSolid(const G4Box &)=0
#define G4MUTEX_INITIALIZER
void SetYmax(G4double ymax)
G4double GetMaxXExtent() const
G4double GetMinZExtent() const
std::vector< G4ThreeVector > G4ThreeVectorList
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double GetMinXExtent() const
G4double GetMaxZExtent() const
void SetZmin(G4double zmin)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4bool operator==(const G4GeometryCell &k1, const G4GeometryCell &k2)
G4double GetMaxYExtent() const
G4VSolid & operator=(const G4VSolid &rhs)
virtual G4VSolid * Clone() const
void SetZmax(G4double zmax)
void SetXmin(G4double xmin)
G4double GetMaxExtent(const EAxis pAxis) const
void SetYmin(G4double ymin)
G4double GetMinExtent(const EAxis pAxis) const