53#include <TopoDS_Shell.hxx>
54#include <TopoDS_Face.hxx>
55#include <TopoDS_Edge.hxx>
56#include <TopoDS_Solid.hxx>
63#include <GC_MakeArcOfCircle.hxx>
64#include <GC_MakeEllipse.hxx>
65#include <BRepBuilderAPI_MakeVertex.hxx>
66#include <BRepBuilderAPI_MakeEdge.hxx>
67#include <BRepBuilderAPI_MakeWire.hxx>
68#include <BRepBuilderAPI_MakeFace.hxx>
69#include <BRepBuilderAPI_MakeShell.hxx>
70#include <BRepBuilderAPI_MakeSolid.hxx>
71#include <BRepBuilderAPI_Transform.hxx>
72#include <BRepBuilderAPI_MakePolygon.hxx>
73#include <BRepBuilderAPI_Sewing.hxx>
74#include <BRepAlgo_Section.hxx>
75#include <BRepPrimAPI_MakeSphere.hxx>
76#include <BRepOffsetAPI_ThruSections.hxx>
77#include <BRepPrimAPI_MakeCylinder.hxx>
78#include <BRepPrimAPI_MakeCone.hxx>
79#include <BRepPrimAPI_MakeTorus.hxx>
80#include <BRepPrimAPI_MakeRevol.hxx>
81#include <BRepPrimAPI_MakePrism.hxx>
82#include <BRepPrimAPI_MakeWedge.hxx>
83#include <BRepPrimAPI_MakeBox.hxx>
84#include <TopExp_Explorer.hxx>
85#include <BRepAlgoAPI_Cut.hxx>
86#include <BRepAlgoAPI_Fuse.hxx>
87#include <BRepAlgoAPI_Common.hxx>
88#include <BRepAlgo_Cut.hxx>
89#include <Geom_Plane.hxx>
90#include <BRepClass3d_SolidClassifier.hxx>
91#include <BRepGProp.hxx>
92#include <GProp_GProps.hxx>
93#include <TColgp_HArray1OfPnt.hxx>
94#include <ShapeFix_ShapeTolerance.hxx>
132 out.open(
"/tmp/TGeoCad.log",ios::app);
133 out<<
"Translating: "<<
type<<endl;
221 throw std::domain_error(
"Unknown Shape");
231 out.open(
"/tmp/TGeoCad.log",ios::app);
232 TopoDS_Shape leftOCCShape;
233 TopoDS_Shape rightOCCShape;
236 GProp_GProps System2;
245 if(leftSName ==
"TGeoCompositeShape") {
250 Transl.SetTranslation(gp_Vec(t[0],t[1],t[2]));
251 Transf.SetValues(
r[0],
r[1],
r[2],0,
254#
if OCC_VERSION_MAJOR == 6 && OCC_VERSION_MINOR < 8
258 BRepBuilderAPI_Transform Transformation(Transf);
259 BRepBuilderAPI_Transform Translation(Transl);
261 TopoDS_Shape shapeTransf = Transformation.Shape();
262 Translation.Perform(shapeTransf, Standard_True);
263 leftOCCShape = Translation.Shape();
266 if(rightSName ==
"TGeoCompositeShape" ) {
271 Transl.SetTranslation(gp_Vec(t[0],t[1],t[2]));
276#
if OCC_VERSION_MAJOR == 6 && OCC_VERSION_MINOR < 8
280 BRepBuilderAPI_Transform Transformation(Transf);
281 BRepBuilderAPI_Transform Translation(Transl);
283 Transformation.Perform(sh,
true);
284 TopoDS_Shape shapeTransf = Transformation.Shape();
285 Translation.Perform(shapeTransf, Standard_True);
286 rightOCCShape = Translation.Shape();
290 if (leftOCCShape.IsNull())
out<<
"leftshape is null"<<endl;
291 if (rightOCCShape.IsNull())
out<<
"rightshape is null"<<endl;
292 leftOCCShape.Closed(
true);
293 rightOCCShape.Closed(
true);
294 BRepAlgoAPI_Fuse Result(leftOCCShape, rightOCCShape);
296 result=Result.Shape();
300 BRepAlgoAPI_Common Result(rightOCCShape,leftOCCShape);
302 result=Result.Shape();
306 if (leftOCCShape.IsNull())
out<<
"leftshape is null"<<endl;
307 if (rightOCCShape.IsNull())
out<<
"rightshape is null"<<endl;
309 BRepGProp::VolumeProperties(rightOCCShape, System);
310 if (System.Mass() < 0.0) rightOCCShape.Reverse();
311 BRepGProp::VolumeProperties(leftOCCShape, System2);
312 if (System2.Mass() < 0.0) leftOCCShape.Reverse();
313 BRepAlgoAPI_Cut Result(leftOCCShape,rightOCCShape);
315 result=Result.Shape();
318 throw std::domain_error(
"Unknown operation" );
324 gp_Pnt p (0.,0.,-dz);
331 e=BRepBuilderAPI_MakeEdge(GC_MakeEllipse (ax2,
a,
b));
333 e=BRepBuilderAPI_MakeEdge(GC_MakeEllipse (ax2,
b,
a));
334 w=BRepBuilderAPI_MakeWire(
e);
335 f=BRepBuilderAPI_MakeFace(w);
336 gp_Vec
v(0 , 0 , dz*2);
340 t.SetRotation(gp::OZ(),
M_PI/2.);
341 BRepBuilderAPI_Transform brepT(
fOccShape , t);
354 if (Rmin==0) Rmin=0.000001;
355 if (Rmax==0) Rmax=0.000001;
356 if (Rtor==0) Rtor=0.000001;
357 torMin = BRepPrimAPI_MakeTorus(Rtor,Rmin,DPhi);
358 torMax = BRepPrimAPI_MakeTorus(Rtor,Rmax,DPhi);
359 BRepAlgoAPI_Cut cutResult(torMax, torMin);
361 tor=cutResult.Shape();
362 TopExp_Explorer anExp1 (tor, TopAbs_SOLID);
364 TopoDS_Shape aTmpShape = anExp1.Current();
365 tor = TopoDS::Solid (aTmpShape);
367 t.SetRotation(gp::OZ(), SPhi);
368 BRepBuilderAPI_Transform brepT(tor , t);
386 if(rmin==0&&phi1==0&&Dphi==2*
M_PI&&theta1==0&&Dtheta==
M_PI) {
387 TopoDS_Solid
s= BRepPrimAPI_MakeSphere(rmax);
390 Handle(Geom_TrimmedCurve) arcO = GC_MakeArcOfCircle (gp_Circ (gp_Ax2 (gp_Pnt(0., 0., 0.),
391 gp_Dir (0, 1,0)),rmax),theta1,
392 theta1+Dtheta,
true);
393 BRepBuilderAPI_MakeEdge makeEO(arcO);
394 eO = TopoDS::Edge(makeEO.Shape());
396 Handle(Geom_TrimmedCurve) arcI = GC_MakeArcOfCircle (gp_Circ (gp_Ax2 (gp_Pnt(0.,0., 0.),
397 gp_Dir (0,1, 0)),rmin),
398 theta1, theta1+Dtheta,
true);
400 BRepBuilderAPI_MakeEdge makeEI(arcI);
401 eI = TopoDS::Edge(makeEI.Shape());
402 e1 = BRepBuilderAPI_MakeEdge(makeEO.Vertex1(), makeEI.Vertex1());
403 e2 = BRepBuilderAPI_MakeEdge(makeEO.Vertex2(), makeEI.Vertex2());
404 w = BRepBuilderAPI_MakeWire(eO , e2 , eI, e1);
405 f = BRepBuilderAPI_MakeFace(w);
407 gp_Pnt pZero(0.,0.,0.);
408 TopoDS_Vertex vZero = BRepBuilderAPI_MakeVertex(pZero);
409 e1 = BRepBuilderAPI_MakeEdge(makeEO.Vertex1(),vZero );
410 e2 = BRepBuilderAPI_MakeEdge(makeEO.Vertex2(),vZero );
411 w = BRepBuilderAPI_MakeWire(eO , e2 , e1);
412 f = BRepBuilderAPI_MakeFace(w);
415 t.SetRotation(gp::OZ(), phi1);
416 BRepBuilderAPI_Transform brepT(
f , t);
426 TopoDS_Solid innerCyl;
427 TopoDS_Solid outerCyl;
432 if (rmin==0) rmin=rmin+0.00001;
433 if (rmax==0) rmax=rmax+0.00001;
434 if (phi1==0&&phi2==0) {
435 innerCyl = BRepPrimAPI_MakeCylinder(rmin,dz*2);
436 outerCyl = BRepPrimAPI_MakeCylinder(rmax,dz*2);
438 innerCyl = BRepPrimAPI_MakeCylinder(rmin,dz*2,phi2);
439 outerCyl = BRepPrimAPI_MakeCylinder(rmax,dz*2,phi2);
441 BRepAlgoAPI_Cut cutResult(outerCyl, innerCyl);
443 tubs=cutResult.Shape();
444 TopExp_Explorer anExp1 (tubs, TopAbs_SOLID);
446 TopoDS_Shape aTmpShape = anExp1.Current();
447 tubs = TopoDS::Solid (aTmpShape);
449 TT.SetRotation(gp_Ax1(gp_Pnt(0.,0.,0.), gp_Vec(0., 0., 1.)), phi1);
450 BRepBuilderAPI_Transform theTT(TT);
451 theTT.Perform(tubs, Standard_True);
453 TR.SetTranslation(gp_Vec(0,0,-dz ));
454 BRepBuilderAPI_Transform theTR(TR);
455 theTR.Perform(tubsT, Standard_True);
462 TopoDS_Solid innerCon;
463 TopoDS_Solid outerCon;
467 if (rmin1==0) rmin1=rmin1+0.000001;
468 if (rmax1==0) rmax1=rmax1+0.000001;
470 innerCon = BRepPrimAPI_MakeCone(rmin1,rmin2,dz*2,phi2);
472 innerCon = BRepPrimAPI_MakeCylinder(rmin1,dz*2,phi2);
474 outerCon = BRepPrimAPI_MakeCone(rmax1,rmax2,dz*2,phi2);
476 outerCon = BRepPrimAPI_MakeCylinder(rmax1,dz*2,phi2);
477 BRepAlgoAPI_Cut cutResult(outerCon, innerCon);
479 cons = cutResult.Shape();
480 TT.SetRotation(gp_Ax1(gp_Pnt(0.,0.,0.), gp_Vec(0., 0., 1.)), phi1);
481 BRepBuilderAPI_Transform theTT(TT);
482 theTT.Perform(cons, Standard_True);
484 TR.SetTranslation(gp_Vec(0,0,-dz ));
485 BRepBuilderAPI_Transform theTR(TR);
486 theTR.Perform(cons, Standard_True);
494 out.open(
"/tmp/TGeoCad.log",ios::app);
495 out<<
"siamo in ctube"<<rmin<<
" "<<rmax<<
" "<<Dphi<<
" "<<dz<<
" "<<Nlow[0]<<
" "<<Nlow[1]<<
" "<<Nlow[2]<<
" "<<Nhigh[0]<<
" "<<Nhigh[1]<<
" "<<Nhigh[2]<<endl;
502 ShapeFix_ShapeTolerance FTol;
507 if (rmin==0) rmin=rmin+0.000001;
508 if (rmax==0) rmax=rmax+0.000001;
509 TopoDS_Solid rminCyl= BRepPrimAPI_MakeCylinder(rmin,2*dz,Dphi);
510 TopoDS_Solid rmaxCyl = BRepPrimAPI_MakeCylinder(rmax,2*dz,Dphi);
511 BRepAlgoAPI_Cut cutResult(rmaxCyl, rminCyl);
513 tubs=cutResult.Shape();
514 TopExp_Explorer anExp2 (tubs, TopAbs_SOLID);
516 TopoDS_Shape aTmpShape = anExp2.Current();
517 tubs = TopoDS::Solid (aTmpShape);
523 TR.SetTranslation(gp_Vec(0,0,-dz));
524 BRepBuilderAPI_Transform theTR(TR);
525 theTR.Perform(tubs, Standard_True);
527 if ((Nhigh[0]>-1
e-4)&&(Nhigh[0]<1
e-4)) nhigh0=0;
528 if ((Nhigh[1]>-1
e-4)&&(Nhigh[1]<1
e-4)) nhigh1=0;
529 if ((Nlow[0]>-1
e-4)&&(Nlow[0]<1
e-4)) nlow0=0;
530 if ((Nlow[1]>-1
e-4)&&(Nlow[1]<1
e-4)) nlow1=0;
531 Handle(Geom_Plane) pH =
new Geom_Plane (gp_Pnt(0,0,dz), gp_Dir(nhigh0,nhigh1,Nhigh[2]));
532 Handle(Geom_Plane) pL =
new Geom_Plane (gp_Pnt(0,0,-dz), gp_Dir(nlow0,nlow1,Nlow[2]));
551 BRepBuilderAPI_MakeShell shell(pH);
555 out<<
"error shell 1"<<shell.Error()<<endl;
556 BRepBuilderAPI_MakeShell shell2 (pL);
560 out<<
"error shell 2"<<shell2.Error()<<endl;
562 FTol.SetTolerance(sH, tolerance ,TopAbs_SHELL);
563 FTol.SetTolerance(sL, tolerance ,TopAbs_SHELL);
565 BRepBuilderAPI_MakeSolid solid (sH, sL);
567 TopoDS_Solid cut=solid.Solid();
568 FTol.SetTolerance(cut, tolerance ,TopAbs_SOLID);
569 BRepBuilderAPI_MakeSolid(sL, sH);
571 out<<
"error solid"<<endl;
574 BRepAlgoAPI_Cut Result(tubs, cut);
576 out<<
"dopo la seconda cut"<<Result.ErrorStatus()<<endl;
583 return Reverse(Result.Shape());
597 BRepOffsetAPI_ThruSections sect(
true,
true);
598 for (
Int_t i=0;i<nz;i++) {
599 for (
Int_t pp=0;pp<vert;pp++) {
603 z[i]=TG_Xtru->
GetZ(i);
608 if (sect.IsDone())
fOccShape = sect.Shape();
617 TopoDS_Vertex vIn,vOut;
618 TopoDS_Vertex vIn1,vOut1;
627 BRepBuilderAPI_MakeEdge makeHyEO;
628 BRepBuilderAPI_MakeEdge makeHyEI;
633 xO = aO*
sqrt(1+(dz*dz)/(bO*bO));
634 gp_Hypr hyO( gp_Ax2 (p,
d ), aO, bO);
635 vOut = BRepBuilderAPI_MakeVertex(gp_Pnt(xO,dz,0));
636 vOut1 = BRepBuilderAPI_MakeVertex(gp_Pnt(xO,-dz,0));
637 makeHyEO=BRepBuilderAPI_MakeEdge(hyO,vOut,vOut1);
640 makeHyEO=BRepBuilderAPI_MakeEdge(gp_Pnt(rmax,-dz,0), gp_Pnt(rmax,dz,0));
644 xI = aI*
sqrt(1+(dz*dz)/(bI*bI));
645 gp_Hypr hyI( gp_Ax2 (p,
d ), aI, bI);
646 vIn = BRepBuilderAPI_MakeVertex(gp_Pnt(xI,dz,0));
647 vIn1 = BRepBuilderAPI_MakeVertex(gp_Pnt(xI,-dz,0));
648 makeHyEI=BRepBuilderAPI_MakeEdge(hyI,vIn,vIn1);
651 makeHyEI=BRepBuilderAPI_MakeEdge(gp_Pnt(rmin,-dz,0), gp_Pnt(rmin,dz,0));
652 hyEO=TopoDS::Edge(makeHyEO.Shape());
653 hyEI=TopoDS::Edge(makeHyEI.Shape());
654 eT= BRepBuilderAPI_MakeEdge(makeHyEO.Vertex1(), makeHyEI.Vertex1());
655 eB= BRepBuilderAPI_MakeEdge(makeHyEO.Vertex2(), makeHyEI.Vertex2());
656 eT1 =BRepBuilderAPI_MakeEdge(makeHyEO.Vertex1(), makeHyEO.Vertex2());
657 BRepBuilderAPI_MakeWire WIRE(hyEO,eB,hyEI,eT);
660 BRepBuilderAPI_MakeFace face(hyW);
662 t.SetRotation(gp::OX(),
M_PI/2.);
663 BRepBuilderAPI_Transform TF(t);
664 TF.Perform(hyF,Standard_True);
665 hyF = TopoDS::Face(TF.Shape());
672 BRepOffsetAPI_ThruSections sect(
true,
true);
691 e1=BRepBuilderAPI_MakeEdge(
p1,
p2 );
692 e2=BRepBuilderAPI_MakeEdge(
p2,
p3 );
693 e3=BRepBuilderAPI_MakeEdge(
p3,p4 );
694 e4=BRepBuilderAPI_MakeEdge(p4,
p1 );
695 w = BRepBuilderAPI_MakeWire(e1,e2,e3,e4);
707 out.open(
"/tmp/TGeoCad.log",ios::app);
708 TopoDS_Shell newShell;
709 TopoDS_Shape sewedShape;
710 TopoDS_Shape aTmpShape;
712 ShapeFix_ShapeTolerance FTol;
714 Handle(TColgp_HArray1OfPnt) pathArray =
new TColgp_HArray1OfPnt(0,8);
715 BRepBuilderAPI_Sewing sew(1.0);
716 TopoDS_Wire wire1,wire2,wire3,wire4,wire5,wire6;
717 TopoDS_Face ff,ff1,ff2,ff3,ff4,ff5;
718 BRepBuilderAPI_MakePolygon poly1,poly2,poly3,poly4,poly5,poly6;
721 for (
Int_t i=0;i<8;i++) {
723 x=count++;
y=count++;z=count++;
725 if (
points[
x]<=0.1) { tolerance=1;}
726 if (
points[
y]<=0.1) { tolerance=1;}
727 if (
points[z]<=0.1) { tolerance=1;}
728 pathArray->SetValue(i,point);
730 poly1.Add(pathArray->Value(0));
731 out<<pathArray->Value(0).X()<<
" "<<pathArray->Value(0).Y()<<
" "<<pathArray->Value(0).Z()<<endl;
732 poly1.Add(pathArray->Value(3));
733 out<<pathArray->Value(3).X()<<pathArray->Value(3).Y()<<pathArray->Value(3).Z()<<endl;
734 poly1.Add(pathArray->Value(2));
735 out<<pathArray->Value(2).X()<<pathArray->Value(2).Y()<<pathArray->Value(2).Z()<<endl;
736 poly1.Add(pathArray->Value(1));
737 out<<pathArray->Value(1).X()<<
" "<<pathArray->Value(1).Y()<<
" "<<pathArray->Value(1).Z()<<endl;
741 poly2.Add(pathArray->Value(0));
742 out<<pathArray->Value(0).X()<<pathArray->Value(0).Y()<<pathArray->Value(0).Z()<<endl;
743 poly2.Add(pathArray->Value(1));
744 out<<pathArray->Value(1).X()<<pathArray->Value(1).Y()<<pathArray->Value(1).Z()<<endl;
745 poly2.Add(pathArray->Value(5));
746 out<<pathArray->Value(5).X()<<pathArray->Value(5).Y()<<pathArray->Value(5).Z()<<endl;
747 poly2.Add(pathArray->Value(4));
748 out<<pathArray->Value(4).X()<<pathArray->Value(4).Y()<<pathArray->Value(4).Z()<<endl;
751 poly3.Add(pathArray->Value(0));
752 out<<pathArray->Value(0).X()<<pathArray->Value(0).Y()<<pathArray->Value(0).Z()<<endl;
753 poly3.Add(pathArray->Value(4));
754 out<<pathArray->Value(4).X()<<pathArray->Value(4).Y()<<pathArray->Value(4).Z()<<endl;
755 poly3.Add(pathArray->Value(7));
756 out<<pathArray->Value(7).X()<<pathArray->Value(7).Y()<<pathArray->Value(7).Z()<<endl;
757 poly3.Add(pathArray->Value(3));
758 out<<pathArray->Value(3).X()<<pathArray->Value(3).Y()<<pathArray->Value(3).Z()<<endl;
761 poly4.Add(pathArray->Value(3));
762 out<<pathArray->Value(3).X()<<pathArray->Value(3).Y()<<pathArray->Value(3).Z()<<endl;
763 poly4.Add(pathArray->Value(2));
764 out<<pathArray->Value(2).X()<<pathArray->Value(2).Y()<<pathArray->Value(2).Z()<<endl;
765 poly4.Add(pathArray->Value(6));
766 out<<pathArray->Value(6).X()<<pathArray->Value(6).Y()<<pathArray->Value(6).Z()<<endl;
767 poly4.Add(pathArray->Value(7));
768 out<<pathArray->Value(7).X()<<pathArray->Value(7).Y()<<pathArray->Value(7).Z()<<endl;
771 poly5.Add(pathArray->Value(4));
772 out<<pathArray->Value(4).X()<<pathArray->Value(4).Y()<<pathArray->Value(4).Z()<<endl;
773 poly5.Add(pathArray->Value(5));
774 out<<pathArray->Value(5).X()<<pathArray->Value(5).Y()<<pathArray->Value(5).Z()<<endl;
775 poly5.Add(pathArray->Value(6));
776 out<<pathArray->Value(6).X()<<pathArray->Value(6).Y()<<pathArray->Value(6).Z()<<endl;
777 poly5.Add(pathArray->Value(7));
778 out<<pathArray->Value(7).X()<<pathArray->Value(7).Y()<<pathArray->Value(7).Z()<<endl;
781 poly6.Add(pathArray->Value(1));
782 out<<pathArray->Value(1).X()<<pathArray->Value(1).Y()<<pathArray->Value(1).Z()<<endl;
783 poly6.Add(pathArray->Value(2));
784 out<<pathArray->Value(2).X()<<pathArray->Value(2).Y()<<pathArray->Value(2).Z()<<endl;
785 poly6.Add(pathArray->Value(6));
786 out<<pathArray->Value(6).X()<<pathArray->Value(6).Y()<<pathArray->Value(6).Z()<<endl;
787 poly6.Add(pathArray->Value(5));
788 out<<pathArray->Value(5).X()<<pathArray->Value(5).Y()<<pathArray->Value(5).Z()<<endl;
793 FTol.SetTolerance(wire1, tolerance ,TopAbs_WIRE);
794 FTol.SetTolerance(wire2, tolerance ,TopAbs_WIRE);
795 FTol.SetTolerance(wire3, tolerance ,TopAbs_WIRE);
796 FTol.SetTolerance(wire4, tolerance ,TopAbs_WIRE);
797 FTol.SetTolerance(wire5, tolerance ,TopAbs_WIRE);
798 FTol.SetTolerance(wire6, tolerance ,TopAbs_WIRE);
800 ff = BRepBuilderAPI_MakeFace(wire1);
801 if (ff.IsNull())
out<<
"face1 is null"<<endl;
802 ff1 = BRepBuilderAPI_MakeFace(wire2);
803 if (ff1.IsNull())
out<<
"face2 is null"<<endl;
804 ff2 = BRepBuilderAPI_MakeFace(wire3);
805 if (ff2.IsNull())
out<<
"face3 is null"<<endl;
806 ff3 = BRepBuilderAPI_MakeFace(wire4);
807 if (ff3.IsNull())
out<<
"face4 is null"<<endl;
808 ff4 = BRepBuilderAPI_MakeFace(wire5);
809 if (ff4.IsNull())
out<<
"face5 is null"<<endl;
810 ff5 = BRepBuilderAPI_MakeFace(wire6);
811 if (ff5.IsNull())
out<<
"face6 is null"<<endl;
820 sewedShape=sew.SewedShape();
822 if (sewedShape.IsNull())
out<<
"Arb8 error"<<endl;
824 TopExp_Explorer anExp (sewedShape, TopAbs_SHELL);
826 aTmpShape = anExp.Current();
827 newShell = TopoDS::Shell (aTmpShape);
829 BRepBuilderAPI_MakeSolid mySolid(newShell);
831 return Reverse(mySolid.Solid());
845 TopoDS_Solid
box = BRepPrimAPI_MakeBox(gp_Pnt(OX - dx, OY - dy, OZ - dz),
846 2.0 * dx, 2.0 * dy, 2.0 * dz);
854 BRepOffsetAPI_ThruSections sect(
true,
true);
864 for (
Int_t i=0;i<2;i++) {
865 BRepBuilderAPI_MakePolygon poly;
871 point1=gp_Pnt(-dx1,-dy1,-dz);
872 point2=gp_Pnt(dx1,-dy1,-dz);
873 point3=gp_Pnt(dx1,dy1,-dz);
874 point4=gp_Pnt(-dx1,dy1,-dz);
893 BRepBuilderAPI_MakePolygon poly;
896 for(i=0; i<num; i++) {
897 poly.Add(gp_Pnt(
x[i],
y[i],z));
899 poly.Add(gp_Pnt(
x[0],
y[0], z));
915 for(
Int_t nCon=0; nCon<zNum-1; nCon++) {
916 zHalf = (z[nCon+1]-z[nCon])/2.;
917 if ((zHalf==0)||(zHalf<0)) zHalf=0.1;
918 cone =
OCC_Cones(rMin[nCon], rMax[nCon], rMin[(nCon+1)], rMax[(nCon+1)],zHalf, startPhi, deltaPhi);
921 Transl.SetTranslation(gp_Vec(t[0],t[1],t[2]));
922 Transf.SetValues(
r[0],
r[1],
r[2],0,
925#
if OCC_VERSION_MAJOR == 6 && OCC_VERSION_MINOR < 8
929 BRepBuilderAPI_Transform Transformation(Transf);
930 BRepBuilderAPI_Transform Translation(Transl);
931 Transformation.Perform(cone,
true);
932 cone = Transformation.Shape();
933 Translation.Perform(cone, Standard_True);
934 cone = Translation.Shape();
936 BRepAlgoAPI_Fuse fuse(pCone, cone);
947 BRepOffsetAPI_ThruSections sectInner(
true,
true);
948 BRepOffsetAPI_ThruSections sectOuter(
true,
true);
949 BRepLib_MakePolygon aPoly2;
957 Double_t Xmax=0.0,Ymax=0.0, Zmax=0.0, max=0.0;
958 Int_t aa=0,bb=1,cc=2;
972 if ((p[check]>-1
e-4)&&(p[check]<1
e-4))
977 for(
Int_t j=0; j<2; j++) {
978 BRepLib_MakePolygon aPoly;
980 xx=p[ind++];yy=p[ind++];zz=p[ind++];
981 point=gp_Pnt(xx,yy,zz);
987 sectInner.AddWire(w1);
991 sectOuter.AddWire(w2);
999 BRepAlgoAPI_Cut Result(sectOuter.Shape(),sectInner.Shape() );
1003 if (
fabs(p[aa])>Xmax) {
1006 if (
fabs(p[bb])>Ymax) {
1009 if (
fabs(p[cc])>Zmax) {
1012 if(numpoint-1==cc)
break;
1021 if ((IsEqual(DPhi,360.0))||(IsEqual(DPhi,0.))) {
1025 myCut=BRepPrimAPI_MakeCylinder (max+1,2*Zmax,(360.-DPhi)*
M_PI/180.);
1026 TT.SetRotation(gp_Ax1(gp_Pnt(0.,0.,0.), gp_Vec(0., 0., 1.)), (-90.0+phi1)*
M_PI/180.0);
1027 BRepBuilderAPI_Transform theTT(TT);
1028 theTT.Perform(myCut, Standard_True);
1030 TR.SetTranslation(gp_Vec(0,0,-Zmax));
1031 BRepBuilderAPI_Transform theTR(TR);
1032 theTR.Perform(
fOccShape, Standard_True);
1034 BRepAlgoAPI_Cut Result2(Result.Shape(),
fOccShape );
1045 BRepClass3d_SolidClassifier * setPrecision=
new BRepClass3d_SolidClassifier (Shape);
1046 setPrecision->PerformInfinitePoint(Precision::Confusion());
1047 if (setPrecision->State() == TopAbs_IN) {
1051 delete(setPrecision);
static double p3(double t, double a, double b, double c, double d)
static double p1(double t, double a, double b)
static double p2(double t, double a, double b, double c)
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
virtual const Double_t * GetOrigin() const
virtual Double_t GetDX() const
virtual Double_t GetDZ() const
virtual Double_t GetDY() const
Base class for Boolean operations between two shapes.
virtual EGeoBoolType GetBooleanOperator() const =0
TGeoMatrix * GetRightMatrix() const
TGeoShape * GetLeftShape() const
TGeoMatrix * GetLeftMatrix() const
TGeoShape * GetRightShape() const
Class handling Boolean composition of shapes.
TGeoBoolNode * GetBoolNode() const
A phi segment of a conical tube.
virtual Double_t GetRmax2() const
virtual Double_t GetDz() const
virtual Double_t GetRmin2() const
virtual Double_t GetRmin1() const
virtual Double_t GetRmax1() const
A tube segment cut with 2 planes.
const Double_t * GetNlow() const
const Double_t * GetNhigh() const
virtual Double_t GetA() const
virtual Double_t GetB() const
Matrix class used for computing global transformations Should NOT be used for node definition.
virtual const Double_t * GetTranslation() const
virtual const Double_t * GetRotationMatrix() const
Hyperboloid class defined by 5 parameters.
Double_t GetStOut() const
Geometrical transformation package.
Double_t * GetRmax() const
Double_t * GetRmin() const
virtual Int_t GetNsegments() const
Returns number of segments on each mesh circle segment.
virtual void SetPoints(Double_t *points) const
create polygone mesh points
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Base abstract class for all shapes.
virtual const char * GetName() const
Get the shape name.
virtual void SetPoints(Double_t *points) const =0
virtual Double_t GetRmin() const
Double_t GetTheta2() const
virtual Double_t GetRmax() const
Double_t GetTheta1() const
TopoDS_Shape Reverse(TopoDS_Shape Shape)
TopoDS_Shape OCC_Box(Double_t dx, Double_t dy, Double_t dz, Double_t OX, Double_t OY, Double_t OZ)
TopoDS_Shape OCC_CompositeShape(TGeoCompositeShape *cs, TGeoHMatrix matrix)
TopoDS_Shape OCC_ParaTrap(Double_t *vertex)
TopoDS_Shape OCC_EllTube(Double_t Dx, Double_t Dy, Double_t Dz)
TopoDS_Shape OCC_Torus(Double_t Rmin, Double_t Rmax, Double_t Rtor, Double_t SPhi, Double_t DPhi)
TopoDS_Shape OCC_Xtru(TGeoXtru *TG_Xtru)
TopoDS_Shape OCC_Pcon(Double_t startPhi, Double_t deltaPhi, Int_t zNum, Double_t *rMin, Double_t *rMax, Double_t *z)
TopoDS_Wire Polygon(Double_t *x, Double_t *y, Double_t z, Int_t num)
TopoDS_Shape OCC_Tube(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t phi2)
TopoDS_Shape OCC_Cones(Double_t rmin1, Double_t rmax1, Double_t rmin2, Double_t rmax2, Double_t dz, Double_t phi1, Double_t phi2)
TopoDS_Shape OCC_Hype(Double_t rmin, Double_t rmax, Double_t stin, Double_t stout, Double_t dz)
TopoDS_Shape OCC_Trd(Double_t dx1, Double_t dx2, Double_t dy1, Double_t dy2, Double_t dz)
TopoDS_Shape OCC_SimpleShape(TGeoShape *TG_Shape)
TopoDS_Shape OCC_Sphere(Double_t rmin, Double_t rmax, Double_t phi1, Double_t Dphi, Double_t theta1, Double_t Dtheta)
TopoDS_Shape OCC_Pgon(Int_t np, Int_t nz, Double_t *p, Double_t phi1, Double_t DPhi, Int_t numpoint)
TopoDS_Shape OCC_Arb8(Double_t dz, Double_t *ivert, Double_t *points)
TopoDS_Shape OCC_Cuttub(Double_t rmin, Double_t rmax, Double_t dz, Double_t phi1, Double_t Dphi, const Double_t *Nlow, const Double_t *Nhigh)
A trapezoid with only x length varying with z.
A trapezoid with both x and y lengths varying with z.
virtual Double_t GetRmin() const
virtual Double_t GetDz() const
virtual Double_t GetRmax() const
An extrusion with fixed outline shape in x-y and a sequence of z extents (segments).
Double_t GetYOffset(Int_t i) const
Double_t GetY(Int_t i) const
Double_t GetScale(Int_t i) const
Double_t GetXOffset(Int_t i) const
Double_t GetX(Int_t i) const
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
static constexpr double s