From 63d86e00e1e6a482fcad527ae0b883deccceed11 Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 28 Jul 2020 18:48:16 +0300 Subject: [PATCH] Issue #3279: Incorrect result of 1D-Fillet with boundary value of radius Additional check if the fillet edge eats the original edges. --- src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp | 16 +++++++++++----- src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx | 8 ++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp index 440822088..e937beab9 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp @@ -110,15 +110,21 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseWire, // create fillet builder GEOMImpl_Fillet1d aFilletBuilder(anEdge1, anEdge2, aPlane->impl()); - if (!aFilletBuilder.Perform(theRadius)) { - // store the failed vertex and continue + bool isOk = aFilletBuilder.Perform(theRadius); + TopoDS_Edge aFilletEdge; + if (isOk) { + GeomPointPtr aPoint = aVE->first->vertex()->point(); + aFilletEdge = aFilletBuilder.Result(aPoint->impl(), anEdge1, anEdge2); + isOk = !aFilletEdge.IsNull(); + } + + if (!isOk) { + // something gone wrong and the fillet edge is not constructed, + // just store the failed vertex and continue myFailedVertices.push_back(*aVIt); continue; } - GeomPointPtr aPoint = aVE->first->vertex()->point(); - TopoDS_Edge aFilletEdge = aFilletBuilder.Result(aPoint->impl(), anEdge1, anEdge2); - // store modified shapes myGenerated[aVE->first].push_back(convert(aFilletEdge)); SetOfShapes::const_iterator aEIt = aVE->second.begin(); diff --git a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx index 6ed7b3eac..3f3c2d74e 100644 --- a/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx +++ b/src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx @@ -664,6 +664,10 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, else theEdge1 = aDivider1.Edge(); } + else { + // error: filleted edge becomes degenerated + aResult = TopoDS_Edge(); + } aCurve = BRep_Tool::Curve(myEdge2, aStart, anEnd); aCurve->D1(aNearest->GetParam2(), aPoint2, aDir); @@ -682,6 +686,10 @@ TopoDS_Edge GEOMImpl_Fillet1d::Result(const gp_Pnt& thePoint, else theEdge2 = aDivider2.Edge(); } + else { + // error: filleted edge becomes degenerated + aResult = TopoDS_Edge(); + } delete aNearest; return aResult; -- 2.39.2