91 :
G4VSolid(rhs), fCubicVolume(rhs.fCubicVolume),
92 fSurfaceArea(rhs.fSurfaceArea),
93 kRadTolerance(rhs.kRadTolerance), fAccurate(rhs.fAccurate)
131 G4int inside = 0, generated;
133 d = (extentMax - extentMin) / 2.;
134 p = (extentMax + extentMin) / 2.;
137 for (generated = 0; generated < 10000; ++generated)
142 length.
z()*rvec.
z());
145 G4double vbox = (2 * d.
x()) * (2 * d.
y()) * (2 * d.
z());
161 for (
G4int i = 0 ; i < numNodes ; ++i)
170 if (minDistance > distance) minDistance = distance;
178 std::vector<G4int>& candidates,
181 G4int candidatesCount = candidates.size();
185 for (
G4int i = 0 ; i < candidatesCount; ++i)
187 G4int candidate = candidates[i];
194 if (minDistance > distance) minDistance = distance;
196 if (minDistance == 0)
break;
221 if (shift) currentPoint += direction * shift;
224 std::vector<G4int> candidates, curVoxel(3);
233 candidates, exclusion);
234 if (minDistance > distance) minDistance = distance;
235 if (distance < shift)
break;
240 while (minDistance > shift);
260 G4int ignoredSolid = -1;
265 for (
G4int i = 0; i < numNodes; ++i)
267 if (i != ignoredSolid)
280 if (resultDistToOut ==
kInfinity) resultDistToOut = 0;
284 + distance*localDirection);
285 resultDistToOut += distance;
293 return resultDistToOut;
326 std::vector<G4int> candidates;
345 G4int maxCandidate = 0;
348 G4int limit = candidates.size();
349 for (
G4int i = 0 ; i < limit ; ++i)
351 G4int candidate = candidates[i];
375 false, 0, &localNormal);
376 if (maxDistance < shift)
379 maxCandidate = candidate;
380 maxNormal = localNormal;
392 distance += maxDistance;
393 currentPoint += maxDistance * direction;
394 if(maxDistance == 0.) ++count;
422 while ((notOutside) && (count < numNodes));
446 std::vector<G4int> candidates;
447 std::vector<G4MultiUnionSurface> surfaces;
457 for (
G4int i = 0 ; i < limit ; ++i)
459 G4int candidate = candidates[i];
466 location = solid.
Inside(localPoint);
471 surface.
point = localPoint;
472 surface.
solid = &solid;
473 surfaces.push_back(surface);
482 G4int size = surfaces.size();
483 for (
G4int i = 0; i < size - 1; ++i)
486 for (
G4int j = i + 1; j < size; ++j)
527 G4int countSurface = 0;
530 for (
G4int i = 0 ; i < numNodes ; ++i)
539 location = solid.
Inside(localPoint);
557 for (
G4int i = 0 ; i < numNodes ; ++i)
652 std::vector<G4int> candidates;
664 G4int limit = candidates.size();
665 for (
G4int i = 0 ; i < limit ; ++i)
667 G4int candidate = candidates[i];
730 std::vector<G4int> candidates;
738 G4int limit = candidates.size();
739 for (
G4int i = 0; i < limit; ++i)
741 G4int candidate = candidates[i];
751 if (safetyMin > safety) safetyMin = safety;
754 if (safetyMin ==
kInfinity) safetyMin = 0;
773 for (
G4int j = 0; j < numNodes; ++j)
780 for (
auto i = 0; i <= 2; ++i)
783 if ((dxyz[i] = std::abs(point[i] -
pos[i]) - hlen[i]) > safetyMin)
787 for (
auto i = 0; i <= 2; ++i)
788 if (dxyz[i] > 0) d2xyz += dxyz[i] * dxyz[i];
793 if (d2xyz >= safetyMin * safetyMin)
803 if (safety <= 0)
return safety;
805 if (safetyMin > safety) safetyMin = safety;
836 G4int safetyNode = 0;
840 for (
G4int i = 0; i < numNodes; ++i)
843 G4double dxyz0 = std::abs(aPoint.
x() - boxes[i].pos.x()) - boxes[i].hlen.x();
844 if (dxyz0 > safetyMin)
continue;
845 G4double dxyz1 = std::abs(aPoint.
y() - boxes[i].pos.y()) - boxes[i].hlen.y();
846 if (dxyz1 > safetyMin)
continue;
847 G4double dxyz2 = std::abs(aPoint.
z() - boxes[i].pos.z()) - boxes[i].hlen.z();
848 if (dxyz2 > safetyMin)
continue;
850 if (dxyz0 > 0) d2xyz += dxyz0 * dxyz0;
851 if (dxyz1 > 0) d2xyz += dxyz1 * dxyz1;
852 if (dxyz2 > 0) d2xyz += dxyz2 * dxyz2;
853 if (d2xyz >= safetyMin * safetyMin)
continue;
861 if (safetyMin > safety)
895 for (
G4int i = 0 ; i < limit; ++i)
902 if (current.
x() >
max.x())
max.setX(current.
x());
903 if (current.
x() <
min.x())
min.setX(current.
x());
905 if (current.
y() >
max.y())
max.setY(current.
y());
906 if (current.
y() <
min.y())
min.setY(current.
y());
908 if (current.
z() >
max.z())
max.setZ(current.
z());
909 if (current.
z() <
min.z())
min.setZ(current.
z());
917 G4int oldprc = os.precision(16);
918 os <<
"-----------------------------------------------------------\n"
919 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
920 <<
" ===================================================\n"
921 <<
" Solid type: G4MultiUnion\n"
922 <<
" Parameters: \n";
924 for (
G4int i = 0 ; i < numNodes ; ++i)
929 os <<
" Translation is " <<
transform.getTranslation() <<
" \n";
930 os <<
" Rotation is :" <<
" \n";
931 os <<
" " <<
transform.getRotation() <<
"\n";
934 <<
"-----------------------------------------------------------\n";
935 os.precision(oldprc);
988 if (
processor.execute(*top)) {
return top; }
static int operand(pchar begin, pchar end, double &result, pchar &endp, const dic_type &dictionary)
static const G4double pos
static const G4double pMax
static const G4double pMin
static constexpr double s
#define G4MUTEX_INITIALIZER
CLHEP::Hep3Vector G4ThreeVector
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
G4Polyhedron * GetPolyhedron() const
G4double GetRadialTolerance() const
static G4GeometryTolerance * GetInstance()
const G4Transform3D & GetTransformation(G4int index) const
G4int GetNumberOfSolids() const
G4double DistanceToIn(const G4ThreeVector &aPoint) const
G4double GetSurfaceArea()
G4double DistanceToOutNoVoxels(const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, G4ThreeVector *aNormalVector) const
G4int SafetyFromOutsideNumberNode(const G4ThreeVector &aPoint, G4double &safety) const
G4ThreeVector GetLocalVector(const G4Transform3D &trans, const G4ThreeVector &gvec) const
G4ThreeVector GetGlobalPoint(const G4Transform3D &trans, const G4ThreeVector &lpoint) const
G4double GetCubicVolume()
EInside InsideNoVoxels(const G4ThreeVector &aPoint) const
G4double DistanceToInNoVoxels(const G4ThreeVector &aPoint, const G4ThreeVector &aDirection) const
EInside Inside(const G4ThreeVector &aPoint) const
G4double DistanceToOut(const G4ThreeVector &aPoint) const
G4Polyhedron * CreatePolyhedron() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
std::vector< G4Transform3D > fTransformObjs
void BoundingLimits(G4ThreeVector &aMin, G4ThreeVector &aMax) const
G4Polyhedron * GetPolyhedron() const
void TransformLimits(G4ThreeVector &min, G4ThreeVector &max, const G4Transform3D &transformation) const
G4double DistanceToOutVoxels(const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, G4ThreeVector *aNormalVector) const
G4double DistanceToInCandidates(const G4ThreeVector &aPoint, const G4ThreeVector &aDirection, std::vector< G4int > &candidates, G4SurfBits &bits) const
std::ostream & StreamInfo(std::ostream &os) const
G4ThreeVector GetGlobalVector(const G4Transform3D &trans, const G4ThreeVector &lvec) const
G4bool fRebuildPolyhedron
void DescribeYourselfTo(G4VGraphicsScene &scene) const
void AddNode(G4VSolid &solid, const G4Transform3D &trans)
void Extent(EAxis aAxis, G4double &aMin, G4double &aMax) const
G4ThreeVector GetPointOnSurface() const
G4VSolid * GetSolid(G4int index) const
G4ThreeVector GetLocalPoint(const G4Transform3D &trans, const G4ThreeVector &gpoint) const
EInside InsideWithExclusion(const G4ThreeVector &aPoint, G4SurfBits *bits=0) const
G4Polyhedron * fpPolyhedron
std::vector< G4VSolid * > fSolids
G4ThreeVector SurfaceNormal(const G4ThreeVector &aPoint) const
G4MultiUnion & operator=(const G4MultiUnion &rhs)
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
void ResetBitNumber(unsigned int bitnumber)
void SetBitNumber(unsigned int bitnumber, G4bool value=true)
virtual void AddSolid(const G4Box &)=0
G4double EstimateSurfaceArea(G4int nStat, G4double ell) const
virtual std::ostream & StreamInfo(std::ostream &os) const =0
virtual EInside Inside(const G4ThreeVector &p) const =0
void SetName(const G4String &name)
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector GetPointOnSurface() const
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4VSolid & operator=(const G4VSolid &rhs)
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
G4double DistanceToBoundingBox(const G4ThreeVector &point) const
const std::vector< G4VoxelBox > & GetBoxes() const
void GetVoxel(std::vector< G4int > &curVoxel, const G4ThreeVector &point) const
G4int GetBitsPerSlice() const
G4double DistanceToFirst(const G4ThreeVector &point, const G4ThreeVector &direction) const
G4int GetCandidatesVoxelArray(const G4ThreeVector &point, std::vector< G4int > &list, G4SurfBits *crossed=nullptr) const
G4double DistanceToNext(const G4ThreeVector &point, const G4ThreeVector &direction, std::vector< G4int > &curVoxel) const
void Voxelize(std::vector< G4VSolid * > &solids, std::vector< G4Transform3D > &transforms)
static G4int GetNumberOfRotationSteps()
static const G4double kInfinity
static double normal(HepRandomEngine *eptr)
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
const char * name(G4int ptype)