]> OCCT Git - occt-copy.git/commitdiff
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)
committeremv <emv@opencascade.com>
Fri, 7 Dec 2018 06:40:11 +0000 (09:40 +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 4a30612dc691708098f4a7413b3c0bf70d9bf8d0..48d75e2b86674db39a620563dc997cbc6d76b289 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..5fbe880
--- /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 0.087
+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