54 Box(0), Convex(0), AxisBox(0), PlaneSolid(0), place(0), bbox(0),
55 intersectionDistance(kInfinity), active(1), startInside(0),
56 nb_of_surfaces(0), SurfaceVec(0), RealDist(0.), solidname(name), Id(0),
57 fStatistics(1000000), fCubVolEpsilon(0.001), fAreaAccuracy(-1.),
58 fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
64 <<
"--------------------------------------------------------" <<
G4endl
65 <<
"WARNING: BREPS classes are being dismissed. They will |" <<
G4endl
66 <<
" be removed starting from next Geant4 major |" <<
G4endl
67 <<
" release. Please, consider switching to adopt |" <<
G4endl
68 <<
" correspondent CSG or specific primitives. |" <<
G4endl
69 <<
"--------------------------------------------------------"
79 Box(0), Convex(0), AxisBox(0), PlaneSolid(0), place(0), bbox(0),
80 intersectionDistance(kInfinity), active(1), startInside(0),
81 nb_of_surfaces(numberOfSrfs), SurfaceVec(srfVec), RealDist(0.),
82 solidname(name), Id(0),
83 fStatistics(1000000), fCubVolEpsilon(0.001), fAreaAccuracy(-1.),
84 fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
90 <<
"--------------------------------------------------------" <<
G4endl
91 <<
"WARNING: BREPS classes are being dismissed. They will |" <<
G4endl
92 <<
" be removed starting from next Geant4 major |" <<
G4endl
93 <<
" release. Please, consider switching to adopt |" <<
G4endl
94 <<
" correspondent CSG or specific primitives. |" <<
G4endl
95 <<
"--------------------------------------------------------"
104 Box(0), Convex(0), AxisBox(0), PlaneSolid(0), place(0), bbox(0),
105 intersectionDistance(kInfinity), active(1), startInside(0),
106 nb_of_surfaces(0), SurfaceVec(0), RealDist(0.), solidname(
""), Id(0),
107 fStatistics(1000000), fCubVolEpsilon(0.001), fAreaAccuracy(-1.),
108 fCubicVolume(0.), fSurfaceArea(0.), fpPolyhedron(0)
125 :
G4VSolid(rhs), Box(rhs.Box), Convex(rhs.Convex), AxisBox(rhs.AxisBox),
126 PlaneSolid(rhs.PlaneSolid), place(0), bbox(0),
127 intersectionDistance(rhs.intersectionDistance), active(rhs.active),
128 startInside(rhs.startInside), nb_of_surfaces(rhs.nb_of_surfaces),
129 intersection_point(rhs.intersection_point), SurfaceVec(0),
130 RealDist(rhs.RealDist), solidname(rhs.solidname), Id(rhs.Id),
131 fStatistics(rhs.fStatistics), fCubVolEpsilon(rhs.fCubVolEpsilon),
132 fAreaAccuracy(rhs.fAreaAccuracy), fCubicVolume(rhs.fCubicVolume),
133 fSurfaceArea(rhs.fSurfaceArea), fpPolyhedron(0)
142 if (
this == &rhs) {
return *
this; }
156 fStatistics= rhs.fStatistics; fCubVolEpsilon= rhs.fCubVolEpsilon;
157 fAreaAccuracy= rhs.fAreaAccuracy; fCubicVolume= rhs.fCubicVolume;
158 fSurfaceArea= rhs.fSurfaceArea;
164 delete fpPolyhedron; fpPolyhedron= 0;
193 return "Closed_Shell";
204 ((
G4BREPSolid*)
this)->intersectionDistance=kInfinity;
240 for(b =0; b<Points; b++)
278 if(ConnectedList[a] == 0)
285 N1 = (srf->
Norm())->GetDir();
289 if(ConnectedList[b] == 1)
302 for(
G4int c=0;c<SrfPoints;c++)
306 for(
G4int d=0;d<ConnSrfPoints;d++)
310 Pt2 = (ConnectedSrf)->GetPoint(d);
316 N2 = ((ConnectedSrf)->Norm())->GetDir();
333 Pt4 = (ConnectedSrf)->GetPoint(d+1);
335 Pt4 = (ConnectedSrf)->GetPoint(0);
342 G4cout <<
"\nCroosProd2: " << CrossProd2;
344 if( (CrossProd1 < 0 && CrossProd2 < 0) ||
345 (CrossProd1 > 0 && CrossProd2 > 0) )
349 (ConnectedSrf)->Norm()
350 ->SetDir(-1 * (ConnectedSrf)->Norm()->GetDir());
355 CrossProd1 = CP1.
x()+CP1.
y()+CP1.
z();
365 delete []ConnectedList;
368G4int G4BREPSolid::IsBox()
418 Points = (srf1)->GetNumberOfPoints();
429 G4Vector3D Normal2 = ((srf2)->Norm())->GetDir();
430 Result = std::fabs(Normal1 * Normal2);
432 if((Result != 0) && (Result != 1))
439 if(((
G4int)Result) == 1)
450 if(((std::fabs(x_axis * Normal1) == 1) && (std::fabs(y_axis * Normal1) == 0)) ||
451 ((std::fabs(x_axis * Normal1) == 0) && (std::fabs(y_axis * Normal1) == 1)) ||
452 ((std::fabs(x_axis * Normal1) == 0) && (std::fabs(y_axis * Normal1) == 0)))
497 G4int ConnectingPoints=0;
509 for(a=0; a<maxCNum; a++)
524 if (b==a) {
continue; }
534 for(c=0; c<SrfPoints; c++)
538 for(d=0; d<ConnSrfPoints; d++)
543 if (Pts1 == Pts2) { ConnectingPoints++; }
545 if (ConnectingPoints > 0) {
break; }
548 if (ConnectingPoints > 0)
551 ConnectedList[Connections]=b;
560 for(c=0; c<Connections; c++)
564 G4int tmp = ConnectedList[c];
578 if (CrossProd > 0) { Left++; }
579 if (CrossProd < 0) { Right++; }
583 delete [] ConnectedList;
591 delete [] ConnectedList;
615 xMin=xoffset+Min.
x();
616 xMax=xoffset+Max.
x();
638 yMin=yoffset+Min.
y();
639 yMax=yoffset+Max.
y();
661 zMin=zoffset+Min.
z();
662 zMax=zoffset+Max.
z();
709 G4bool existsAfterClip=
false;
722 if ( (pMin!=kInfinity) || (pMax!=-kInfinity) )
724 existsAfterClip=
true;
745 existsAfterClip=
true;
751 return existsAfterClip;
766 vertices->reserve(8);
787 G4Exception(
"G4BREPSolid::CreateRotatedVertices()",
"GeomSolids0003",
803 G4Ray r(Pttmp, Vtmp);
819 G4int hits=0, samehit=0;
834 if(
SurfaceVec[a]->GetDistance() < sqrHalfTolerance)
839 for(
G4int i=0; i<a; i++)
876 if(
SurfaceVec[iplane]->HowNear(Pt) < sqrHalfTolerance)
918 if( std::fabs(Dist) > std::fabs(dists[a]) )
924 if(Dist == kInfinity)
927 return std::fabs(Dist);
948 G4Ray r(Pttmp, Vtmp);
971 if( surfDistance > sqrHalfTolerance )
982 if( (Norm * Vtmp) < 0 )
1029 G4Ray r(Pttmp, Vtmp);
1051 if( surfDistance > sqrHalfTolerance )
1103 if( std::fabs(Dist) > std::fabs(dists[a]) )
1109 if(Dist == kInfinity)
1112 return std::fabs(Dist);
1182 if(max.
x() < box_max.
x()) max.
setX(box_max.
x());
1183 if(max.
y() < box_max.
y()) max.
setY(box_max.
y());
1184 if(max.
z() < box_max.
z()) max.
setZ(box_max.
z());
1188 if(min.
x() > box_min.
x()) min.
setX(box_min.
x());
1189 if(min.
y() > box_min.
y()) min.
setY(box_min.
y());
1190 if(min.
z() > box_min.
z()) min.
setZ(box_min.
z());
1196 G4Exception(
"G4BREPSolid::CalcBBoxes()",
"GeomSolids1002",
1225 Result = (RayDir * Normal);
1243 Result = (RayDir * Normal);
1259 G4int intersection=0;
1296 if(!active_srfs)
Active(0);
1349 HitDistance = RayStart.distance2(closest_point);
1375G4int G4BREPSolid::FinalEvaluation(
register const G4Ray& rayref,
1382 ((
G4BREPSolid*)
this)->intersectionDistance = kInfinity;
1397 Dist = srf_intersection.distance2(start);
1405 if(Dist < sqrHalfTolerance)
1413 if(( Dir * Norm ) >= 0)
1439 G4Point3D TestPoint = (0.00001*Dir) + Pt;
1440 G4double TestDistance = srf_intersection.distance2(TestPoint);
1442 if(TestDistance > Dist)
1451 ((
G4BREPSolid*)
this)->intersectionDistance = Dist;
1452 ((
G4BREPSolid*)
this)->intersection_point = srf_intersection;
1467 if(( Dir * Norm ) < 0)
1504 scope.
setX(std::fabs(Max.
x()) - std::fabs(Min.
x()));
1505 scope.
setY(std::fabs(Max.
y()) - std::fabs(Min.
y()));
1506 scope.
setZ(std::fabs(Max.
z()) - std::fabs(Min.
z()));
1513 os <<
"-----------------------------------------------------------\n"
1514 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
1515 <<
" ===================================================\n"
1517 <<
" Parameters: \n"
1519 <<
"-----------------------------------------------------------\n";
1526 if (!fpPolyhedron ||
1530 delete fpPolyhedron;
1533 return fpPolyhedron;
HepGeom::Point3D< G4double > G4Point3D
const G4Point3D PINFINITY(kInfinity, kInfinity, kInfinity)
std::vector< G4ThreeVector > G4ThreeVectorList
HepGeom::Vector3D< G4double > G4Vector3D
G4DLLIMPORT std::ostream G4cout
G4Axis2Placement3D * place
virtual G4Polyhedron * GetPolyhedron() const
G4double intersectionDistance
void QuickSort(register G4Surface **SrfVec, register G4int left, register G4int right) const
virtual G4double DistanceToOut(const G4ThreeVector &) const
G4BREPSolid & operator=(const G4BREPSolid &rhs)
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4int Intersect(register const G4Ray &) const
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &) const
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &) const
virtual std::ostream & StreamInfo(std::ostream &os) const
virtual EInside Inside(register const G4ThreeVector &Pt) const
static G4int NumberOfSolids
virtual G4String GetEntityType() const
void RemoveHiddenFaces(register const G4Ray &G4Rayref, G4int) const
G4Polyhedron * CreatePolyhedron() const
virtual void Reset() const
virtual G4VSolid * Clone() const
void CheckSurfaceNormals()
virtual G4double DistanceToIn(const G4ThreeVector &) const
G4Point3D intersection_point
G4BREPSolid(const G4String &name)
virtual void CalcBBoxes()
virtual void Initialize()
const G4BoundingBox3D * GetBBox() const
G4NURBS * CreateNURBS() const
static G4double ShortestDistance
void TestSurfaceBBoxes(register const G4Ray &) const
const G4String & GetName() const
G4Point3D GetBoxMin() const
G4int Test(const G4Ray &)
void SetDistance(G4double distance0)
G4double GetDistance() const
G4Point3D GetBoxMax() const
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
const G4Vector3D & GetDir() const
const G4Point3D & GetStart() const
virtual G4int Intersect(const G4Ray &)
virtual const G4Point3D & GetPoint(G4int Count) const
G4BoundingBox3D * GetBBox()
virtual G4Point3D Evaluation(const G4Ray &G4Rayref)
virtual G4Vector3D SurfaceNormal(const G4Point3D &Pt) const =0
void SetDistance(G4double Dist)
virtual G4int GetNumberOfPoints() const
virtual G4int MyType() const
const G4Point3D & GetClosestHit() const
G4double GetDistance() const
virtual G4int IsConvex() const
virtual void AddSolid(const G4Box &)=0
void ClipBetweenSections(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
G4VSolid & operator=(const G4VSolid &rhs)
void ClipCrossSection(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
G4double GetMinExtent(const EAxis pAxis) const
G4bool IsYLimited() const
G4double GetMinZExtent() const
G4bool IsXLimited() const
G4double GetMaxExtent(const EAxis pAxis) const
G4double GetMaxYExtent() const
G4double GetMaxZExtent() const
G4double GetMinYExtent() const
G4double GetMinXExtent() const
G4bool IsZLimited() const
G4double GetMaxXExtent() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
T dot(const BasicVector3D< T > &v) const
static G4int GetNumberOfRotationSteps()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)