0029845: UnifySameDomain does not account the accumulated angle when unifying edges
authoremv <emv@opencascade.com>
Thu, 7 Jun 2018 05:29:21 +0000 (08:29 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 14 Jun 2018 11:03:12 +0000 (14:03 +0300)
Check that the accumulated angle does not exceed the given angular tolerance while merging the linear edges.
Test case for the issue.

src/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx
tests/bugs/modalg_7/bug29845 [new file with mode: 0644]

index 4a30612..48d75e2 100644 (file)
@@ -849,12 +849,20 @@ static Standard_Boolean IsMergingPossible(const TopoDS_Edge& edge1, const TopoDS
 
   if (theLineDirectionOk && t2 == GeomAbs_Line)
   {
+    // Check that the accumulated deflection does not exceed the linear tolerance
     Standard_Real aLast = (edge2.Orientation() == TopAbs_FORWARD) ?
       ade2.LastParameter() : ade2.FirstParameter();
     gp_Vec aCurV(theFirstPoint, ade2.Value(aLast));
     Standard_Real aDD = theDirectionVec.CrossSquareMagnitude(aCurV);
     if (aDD > theLinTol*theLinTol)
       return Standard_False;
+
+    // Check that the accumulated angle does not exceed the angular tolerance.
+    // For symmetry, check the angle between vectors of:
+    // - first edge and resulting curve, and
+    // - the last edge and resulting curve.
+    if (theDirectionVec.Angle(aCurV) > theAngTol || Diff2.Angle(aCurV) > theAngTol)
+      return Standard_False;
   }
 
   return Standard_True;
diff --git a/tests/bugs/modalg_7/bug29845 b/tests/bugs/modalg_7/bug29845
new file mode 100644 (file)
index 0000000..e598d20
--- /dev/null
@@ -0,0 +1,21 @@
+puts "========"
+puts "OCC29845:UnifySameDomain does not account the accumulated angle when unifying edges"
+puts "========"
+puts ""
+
+brestore [locate_data_file bug29845_wire.brep] w
+
+# set the linear deflection very high, so the unification
+# will be controlled by the angular deflection only.
+# with the angular deflection of 5 degrees the resulting
+# wire should preserve all the features of the original wire
+
+unifysamedom result w -t 10000 -a 5
+checkshape result
+checknbshapes result -vertex 77 -edge 77
+checkprops result -l 2805.11
+
+smallview +X+Z
+don result
+fit
+checkview -screenshot -2d -path ${imagedir}/${test_image}.png