From: jgv Date: Tue, 27 Jan 2015 15:17:08 +0000 (+0300) Subject: 0025704: BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=978f27f1c60162f40820528a1e3012af6b08932f;p=occt-copy.git 0025704: BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect --- diff --git a/src/BRepFill/BRepFill_OffsetWire.cxx b/src/BRepFill/BRepFill_OffsetWire.cxx index 61b05f1f02..21f5585eb3 100755 --- a/src/BRepFill/BRepFill_OffsetWire.cxx +++ b/src/BRepFill/BRepFill_OffsetWire.cxx @@ -215,6 +215,7 @@ static void MakeOffset BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, const Handle(Geom_Plane)& RefPlane, const Standard_Boolean IsOpenResult, + const GeomAbs_JoinType theJoinType, const TopoDS_Vertex * Ends); @@ -277,24 +278,31 @@ static Standard_Boolean KPartCircle IsOpenResult) { Standard_Real anOffset = myOffset; - if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1; Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(E, mySpine, f, l); Handle(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(aPCurve, f, l); Handle(Geom2d_Curve) OC; if (AHC->GetType() == GeomAbs_Line) { + if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1; Adaptor3d_OffsetCurve Off(AHC,anOffset); OC = new Geom2d_Line(Off.Line()); } else if (AHC->GetType() == GeomAbs_Circle) { + if (E.Orientation() == TopAbs_FORWARD) anOffset *= -1; gp_Circ2d theCirc = AHC->Circle(); - if (anOffset < 0. || Abs(anOffset) < theCirc.Radius()) - OC = new Geom2d_Circle (theCirc.Position(), theCirc.Radius() - anOffset); + if (anOffset > 0. || Abs(anOffset) < theCirc.Radius()) + OC = new Geom2d_Circle (theCirc.Position(), theCirc.Radius() + anOffset); + else + { + myIsDone = Standard_False; + return Standard_False; + } } else { + if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1; Handle(Geom2d_TrimmedCurve) G2dT = new Geom2d_TrimmedCurve(aPCurve, f, l); OC = new Geom2d_OffsetCurve( G2dT, anOffset); } @@ -815,7 +823,7 @@ void BRepFill_OffsetWire::PerformWithBiLo } else { MakeOffset (TopoDS::Edge(SE),myWorkSpine,myOffset,myMap,RefPlane, - myIsOpenResult, Ends); + myIsOpenResult, myJoinType, Ends); PE = SE; } } @@ -1966,6 +1974,7 @@ void MakeOffset (const TopoDS_Edge& E, BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map, const Handle(Geom_Plane)& RefPlane, const Standard_Boolean IsOpenResult, + const GeomAbs_JoinType theJoinType, const TopoDS_Vertex * Ends) { Standard_Real f,l; @@ -2009,11 +2018,31 @@ void MakeOffset (const TopoDS_Edge& E, Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle()); Standard_Real Delta = 2*M_PI - l + f; - if (ToExtendFirstPar) - f -= 0.2*Delta; - if (ToExtendLastPar) - l += 0.2*Delta; - + if (theJoinType == GeomAbs_Arc) + { + if (ToExtendFirstPar) + f -= 0.2*Delta; + if (ToExtendLastPar) + l += 0.2*Delta; + } + else //GeomAbs_Intersection + { + if (ToExtendFirstPar && ToExtendLastPar) + { + Standard_Real old_l = l; + f = old_l + Delta/2.; + l = f + 2*M_PI; + } + else if (ToExtendFirstPar) + { + f = l; + l = f + 2*M_PI; + } + else if (ToExtendLastPar) + { + l = f + 2*M_PI; + } + } G2dOC = new Geom2d_TrimmedCurve(CC,f,l); } } @@ -2024,9 +2053,19 @@ void MakeOffset (const TopoDS_Edge& E, Handle(Geom2d_Line) CC = new Geom2d_Line(Off.Line()); Standard_Real Delta = (l - f); if (ToExtendFirstPar) - f -= Delta; + { + if (theJoinType == GeomAbs_Arc) + f -= Delta; + else //GeomAbs_Intersection + f = -Precision::Infinite(); + } if (ToExtendLastPar) - l += Delta; + { + if (theJoinType == GeomAbs_Arc) + l += Delta; + else //GeomAbs_Intersection + l = Precision::Infinite(); + } G2dOC = new Geom2d_TrimmedCurve(CC,f,l); } else {