75 delete fpPolyhedron; fpPolyhedron =
nullptr;
76 delete fScale; fScale =
nullptr;
84 :
G4VSolid (rhs), fPtrSolid(rhs.fPtrSolid),
85 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea)
98 if (
this == &rhs) {
return *
this; }
106 fPtrSolid = rhs.fPtrSolid;
109 fCubicVolume = rhs.fCubicVolume;
110 fSurfaceArea = rhs.fSurfaceArea;
111 fRebuildPolyhedron =
false;
112 delete fpPolyhedron; fpPolyhedron =
nullptr;
136 fPtrSolid->BoundingLimits(bmin,bmax);
137 pMin.
set(bmin.
x()*scale.x(),bmin.
y()*scale.y(),bmin.
z()*scale.z());
138 pMax.
set(bmax.
x()*scale.x(),bmax.
y()*scale.y(),bmax.
z()*scale.z());
142 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
144 std::ostringstream message;
145 message <<
"Bad bounding box (min >= max) for solid: "
147 <<
"\npMin = " << pMin
148 <<
"\npMax = " << pMax;
149 G4Exception(
"G4ScaledSolid::BoundingLimits()",
"GeomMgt0001",
168 fPtrSolid->BoundingLimits(bmin,bmax);
186 return fPtrSolid->Inside(fScale->Transform(p));
198 fScale->Transform(p, newPoint);
201 G4ThreeVector newNormal = fPtrSolid->SurfaceNormal(newPoint);
205 fScale->InverseTransformNormal(newNormal, normal);
206 return normal/normal.
mag();
219 fScale->Transform(p, newPoint);
223 fScale->Transform(v, newDirection);
224 newDirection = newDirection/newDirection.
mag();
227 G4double dist = fPtrSolid->DistanceToIn(newPoint,newDirection);
230 return fScale->InverseTransformDistance(dist, newDirection);
242 fScale->Transform(p, newPoint);
245 G4double dist = fPtrSolid->DistanceToIn(newPoint);
246 return fScale->InverseTransformDistance(dist);
262 fScale->Transform(p, newPoint);
266 fScale->Transform(v, newDirection);
267 newDirection = newDirection/newDirection.
mag();
271 G4double dist = fPtrSolid->DistanceToOut(newPoint,newDirection,
272 calcNorm,validNorm,&solNorm);
276 fScale->TransformNormal(solNorm, normal);
281 return fScale->InverseTransformDistance(dist, newDirection);
293 fScale->Transform(p, newPoint);
296 G4double dist = fPtrSolid->DistanceToOut(newPoint);
297 return fScale->InverseTransformDistance(dist);
312 "Method not applicable in this context!");
322 return fScale->InverseTransform(fPtrSolid->GetPointOnSurface());
330 return fPtrSolid->GetNumOfConstituents();
339 return fPtrSolid->IsFaceted();
348 return {
"G4ScaledSolid"};
366 return { fScale->GetScale().x(),
367 fScale->GetScale().y(),
368 fScale->GetScale().z() };
379 fRebuildPolyhedron =
true;
388 if(fCubicVolume < 0.)
391 fCubicVolume = fPtrSolid->GetCubicVolume() *
392 fScale->GetScale().x() *
393 fScale->GetScale().y() *
394 fScale->GetScale().z();
406 if(fSurfaceArea < 0.)
421 os <<
"-----------------------------------------------------------\n"
422 <<
" *** Dump for Scaled solid - " <<
GetName() <<
" ***\n"
423 <<
" ===================================================\n"
425 <<
" Parameters of constituent solid: \n"
426 <<
"===========================================================\n";
427 fPtrSolid->StreamInfo(os);
428 os <<
"===========================================================\n"
430 <<
" Scale transformation : \n"
431 <<
" " << fScale->GetScale().x() <<
", "
432 << fScale->GetScale().y() <<
", "
433 << fScale->GetScale().z() <<
"\n"
434 <<
"===========================================================\n";
456 G4Polyhedron* polyhedron = fPtrSolid->CreatePolyhedron();
457 if (polyhedron !=
nullptr)
466 "No G4Polyhedron for scaled solid");
477 if (fpPolyhedron ==
nullptr ||
478 fRebuildPolyhedron ||
479 fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
480 fpPolyhedron->GetNumberOfRotationSteps())
483 fRebuildPolyhedron =
false;
G4TemplateAutoLock< G4RecursiveMutex > G4RecursiveAutoLock
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4MUTEX_INITIALIZER
std::recursive_mutex G4RecursiveMutex
CLHEP::Hep3Vector G4ThreeVector
void set(double x, double y, double z)
HepRotation inverse() const
G4BoundingEnvelope is a helper class to facilitate calculation of the extent of a solid within the li...
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
G4Polyhedron * CreatePolyhedron() const override
G4VSolid * GetUnscaledSolid() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const override
G4ThreeVector GetPointOnSurface() const override
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep) override
G4ScaledSolid & operator=(const G4ScaledSolid &rhs)
G4bool IsFaceted() const override
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const override
G4Scale3D GetScaleTransform() const
G4double GetCubicVolume() override
G4int GetNumOfConstituents() const override
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const override
void SetScaleTransform(const G4Scale3D &scale)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const override
G4ScaledSolid(const G4String &pName, G4VSolid *pSolid, const G4Scale3D &pScale)
EInside Inside(const G4ThreeVector &p) const override
void DescribeYourselfTo(G4VGraphicsScene &scene) const override
G4Polyhedron * GetPolyhedron() const override
G4VSolid * Clone() const override
G4double GetSurfaceArea() override
std::ostream & StreamInfo(std::ostream &os) const override
~G4ScaledSolid() override
G4GeometryType GetEntityType() const override
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const override
virtual void AddSolid(const G4Box &)=0
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
G4VSolid(const G4String &name)
G4VSolid & operator=(const G4VSolid &rhs)
virtual G4double GetSurfaceArea()
G4VoxelLimits represents limitation/restrictions of space, where restrictions are only made perpendic...
HepPolyhedron & Transform(const G4Transform3D &t)