Salome HOME
Issue #3279: Incorrect result of 1D-Fillet with boundary value of radius
authorazv <azv@opencascade.com>
Tue, 28 Jul 2020 15:48:16 +0000 (18:48 +0300)
committerazv <azv@opencascade.com>
Tue, 28 Jul 2020 15:48:16 +0000 (18:48 +0300)
Additional check if the fillet edge eats the original edges.

src/GeomAlgoAPI/GeomAlgoAPI_Fillet1D.cpp
src/GeomAlgoImpl/GEOMImpl_Fillet1d.cxx

index 440822088b3ee32b7c07e1dff2e231d413061659..e937beab9164e29f7b2fd91a5cbd178bf9b9cc59 100644 (file)
@@ -110,15 +110,21 @@ void GeomAlgoAPI_Fillet1D::build(const GeomShapePtr& theBaseWire,
 
     // create fillet builder
     GEOMImpl_Fillet1d aFilletBuilder(anEdge1, anEdge2, aPlane->impl<gp_Pln>());
-    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<gp_Pnt>(), 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<gp_Pnt>(), anEdge1, anEdge2);
-
     // store modified shapes
     myGenerated[aVE->first].push_back(convert(aFilletEdge));
     SetOfShapes::const_iterator aEIt = aVE->second.begin();
index 6ed7b3eac28fc3a20a6ccb7a4328c38697ac5d84..3f3c2d74e33848d391e1e66702bb97fc60ac44ae 100644 (file)
@@ -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;