From: nbv Date: Mon, 12 Mar 2018 12:37:39 +0000 (+0300) Subject: 0029548: BRepFill_Pipe algorithm produces result with self-interferences X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR29548;p=occt-copy.git 0029548: BRepFill_Pipe algorithm produces result with self-interferences The region of self-interference is restricted. --- diff --git a/src/GeomFill/GeomFill_Sweep.cxx b/src/GeomFill/GeomFill_Sweep.cxx index d37105dd82..be78b0c389 100644 --- a/src/GeomFill/GeomFill_Sweep.cxx +++ b/src/GeomFill/GeomFill_Sweep.cxx @@ -68,6 +68,8 @@ #include #include #include +#include +#include //#include //======================================================================= @@ -995,13 +997,78 @@ static Standard_Boolean IsSweepParallelSpine (const Handle(GeomFill_LocationLaw) } } else SError = 0.; + + if (Ok) + { + const Handle(Geom_ConicalSurface) aSCon = Handle(Geom_ConicalSurface)::DownCast(S); + + if (!aSCon.IsNull()) + { + const Standard_Real aR = aSCon->RefRadius(), + anAngle = aSCon->SemiAngle(); + + const Standard_Real anApexPrm = -aR / Sin(anAngle); + + const Standard_Real aDf = anApexPrm - UFirst, + aDl = ULast - anApexPrm; + + if (aDf*aDl > 0.0) + { + if (Abs(aDf) > Abs(aDl)) + { + ULast = anApexPrm; + } + else + { + UFirst = anApexPrm; + } + } + } + } + } // (2.3) Revolution if (!Ok) { if (IsTrsf) { Section->Transform(Tf2); - gp_Ax1 Axis (Centre, DN); + gp_Ax1 Axis(Centre, DN); + + { + const Handle(Geom_Line) aL = new Geom_Line(Axis); + const GeomAdaptor_Curve aLin(aL), anAC(Section); + + Extrema_ECC anExtr(anAC, aLin); + anExtr.Perform(); + if (anExtr.IsDone() && anExtr.NbExt() > 0) + { + Extrema_POnCurv aP1, aP2; + for (Standard_Integer i = 1; i <= anExtr.NbExt(); i++) + { + if (anExtr.SquareDistance(i) > Precision::SquareConfusion()) + continue; + + anExtr.Points(i, aP1, aP2); + + const Standard_Real anSinglrPrm = aP1.Parameter(); + const Standard_Real aDf = anSinglrPrm - UFirst, + aDl = ULast - anSinglrPrm; + + if (aDf*aDl > 0.0) + { + if (Abs(aDf) > Abs(aDl)) + { + ULast = anSinglrPrm; + } + else + { + UFirst = anSinglrPrm; + } + } + } + } + } + S = new (Geom_SurfaceOfRevolution) (Section, Axis); myExchUV = Standard_True;