From: gka Date: Wed, 24 May 2017 14:56:23 +0000 (+0300) Subject: Fix for case 180: Error using SnrSplitAlgorithm (691) X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=3ab46247a1ae5f60a8ba3c9abad7a5427978ec8b;p=occt-copy.git Fix for case 180: Error using SnrSplitAlgorithm (691) Protection to avoid creation of the overlapping edges --- diff --git a/src/LocOpe/LocOpe_WiresOnShape.cxx b/src/LocOpe/LocOpe_WiresOnShape.cxx index b037a1a046..fa978a36e4 100644 --- a/src/LocOpe/LocOpe_WiresOnShape.cxx +++ b/src/LocOpe/LocOpe_WiresOnShape.cxx @@ -1208,14 +1208,32 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge, { if (Abs(theIntPar - thePar[j]) <= Precision::PConfusion()) break; + Standard_Real aMidPar = (theIntPar + thePar[j]) * 0.5; + gp_Pnt aPMid = theGAcurve.Value(aMidPar); + + GeomAPI_ProjectPointOnCurve proj; + proj.Init(aPMid,aCurve, aFpar, aLpar); + if(!proj.NbPoints()) + break; + + Standard_Real aDist = proj.LowerDistance(); + gp_Pnt aPointInt = theCurve->Value(theIntPar); + if( aDist <= MaxTol ) + break; + } + //intersection found in the middle of the edge if (j >= 2) //intersection is inside "theEdge" => split { gp_Pnt aPoint = aCurve->Value(anIntPar); + gp_Pnt aPointInt = theCurve->Value(theIntPar); if (aPoint.SquareDistance(thePnt[0]) > aTolV[0] * aTolV[0] && - aPoint.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1]) + aPoint.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1] && + aPointInt.SquareDistance(thePnt[0]) > aTolV[0] * aTolV[0] && + aPointInt.SquareDistance(thePnt[1]) > aTolV[1] * aTolV[1] ) { + SplitPars.Append(theIntPar); if( aDist > aDistMax) aDistMax = aDist; @@ -1280,7 +1298,11 @@ void FindInternalIntersections(const TopoDS_Edge& theEdge, BB.Add(NewEdge, FirstVertex); BB.Add(NewEdge, LastVertex); NewEdge.Orientation(anOrient); - NewEdges.Append(NewEdge); + if (anOrient == TopAbs_FORWARD) + NewEdges.Append(NewEdge); + else + NewEdges.Prepend(NewEdge); + //NewEdges.Append(NewEdge); FirstVertex = LastVertex; FirstPar = LastPar; }