0023375: (OCC 6.5.3 regression) BRepBuilderAPI_Sewing returns wrong result
authoromy <omy@opencascade.com>
Fri, 29 Mar 2013 11:57:20 +0000 (15:57 +0400)
committerbugmaster <bugmaster@opencascade.com>
Mon, 1 Apr 2013 07:38:43 +0000 (11:38 +0400)
Fixed selection of sewing pairs of edges.
Mistake fix
Adding test case for this fix

src/BRepBuilderAPI/BRepBuilderAPI_Sewing.cxx
tests/bugs/modalg_5/bug23375 [new file with mode: 0755]
tests/bugs/modalg_5/bug23375_1 [new file with mode: 0755]

index 2834271..74a067f 100755 (executable)
@@ -1131,7 +1131,7 @@ void BRepBuilderAPI_Sewing::EvaluateDistances(TopTools_SequenceOfShape& sequence
         ProjectPointsOnCurve(ptsRef,c3d,first,last,arrDist,arrPara,arrProj,Standard_False);
       for( j = 1; j <= npt; j++ )
       {
-        if(arrDist(j) < 0. || arrDist(j) > myTolerance)
+        if(arrDist(j) < 0.)
           continue;
         if(dist < arrDist(j))
           dist = arrDist(j);
@@ -4301,7 +4301,7 @@ void BRepBuilderAPI_Sewing::ProjectPointsOnCurve(const TColgp_Array1OfPnt& arrPn
               }
             }
           }
-          if (distProj2 < worktol * worktol) {
+          if (distProj2 < worktol * worktol || !isConsiderEnds) {
             arrDist(i1) = sqrt (distProj2);
             arrPara(i1) = paramProj;
             arrProj(i1) = ptProj;
diff --git a/tests/bugs/modalg_5/bug23375 b/tests/bugs/modalg_5/bug23375
new file mode 100755 (executable)
index 0000000..f8c99d5
--- /dev/null
@@ -0,0 +1,23 @@
+puts "========================"
+puts "OCC23375"
+puts "========================" 
+puts ""
+#######################################################################
+# (OCC 6.5.3 regression) BRepBuilderAPI_Sewing returns wrong result
+#######################################################################
+
+restore [locate_data_file bug23375_Volute1.brep] v
+
+explode v
+sewing result 0.01 v_1 v_2
+
+checkshape result
+
+set tolmaxres [tolmax result]
+regexp {max tol = ([-0-9.+eE]+)} $tolmaxres full MaxTolerance
+set CMP_TOL 1.e-4
+if { ${MaxTolerance} > ${CMP_TOL} } {
+   puts "Error: invalid tolerance"
+}
+
+set 2dviewer 1
diff --git a/tests/bugs/modalg_5/bug23375_1 b/tests/bugs/modalg_5/bug23375_1
new file mode 100755 (executable)
index 0000000..654e1d4
--- /dev/null
@@ -0,0 +1,33 @@
+puts "========================"
+puts "OCC23375"
+puts "========================" 
+puts ""
+#######################################################################
+# (OCC 6.5.3 regression) BRepBuilderAPI_Sewing returns wrong result
+#######################################################################
+
+restore [locate_data_file bug23375_Pump1.brep] p
+
+sewing result 0.1 p
+
+checkshape result
+
+set whatis_result [whatis result]
+
+if { [regexp {SHELL} ${whatis_result}] != 1 } {
+  puts "Error: invalid result shape; SHELL"
+}
+if { [regexp {FORWARD} ${whatis_result}] != 1 } {
+  puts "Error: invalid result shape; FORWARD"
+}
+if { [regexp {Modified} ${whatis_result}] != 1 } {
+  puts "Error: invalid result shape; Modified"
+}
+if { [regexp {Orientable} ${whatis_result}] != 1 } {
+  puts "Error: invalid result shape; Orientable"
+}
+if { [regexp {Closed} ${whatis_result}] != 1 } {
+  puts "Error: invalid result shape; Closed"
+}
+
+set 2dviewer 1