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++)
276 for(a=0; a<nb_of_surfaces-1; a++)
278 if(ConnectedList[a] == 0)
285 N1 = (srf->
Norm())->GetDir();
289 if(ConnectedList[b] == 1)
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;
368 G4int G4BREPSolid::IsBox()
410 if(nb_of_surfaces!=6)
return 0;
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)
444 if((Opposite != 1) && (Sides != nb_of_surfaces-2))
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;
506 const G4int maxCNum = (nb_of_surfaces-1)*nb_of_surfaces;
509 for(a=0; a<maxCNum; a++)
516 for(a=0; a<nb_of_surfaces-1; 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++)
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",
834 if(
SurfaceVec[a]->GetDistance() < sqrHalfTolerance)
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);
971 if( surfDistance > sqrHalfTolerance )
982 if( (Norm * Vtmp) < 0 )
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);
1375 G4int 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;
1460 if(a+1<nb_of_surfaces)
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;