0030817: Modeling Algorithms - BRepOffsetAPI_MakePipeShell produces invalid result IR-2019-06-27
authoremv <emv@opencascade.com>
Mon, 24 Jun 2019 08:41:30 +0000 (11:41 +0300)
committerapn <apn@opencascade.com>
Thu, 27 Jun 2019 13:07:14 +0000 (16:07 +0300)
BRepFill_TrimShellCorner::CheckAndOrientEdges() - When orienting next edge in a sequence take into account the Orientation of the previous edge.
Test cases for the issue.

src/BRepFill/BRepFill_TrimShellCorner.cxx
tests/bugs/modalg_7/bug30794_1 [new file with mode: 0644]
tests/bugs/modalg_7/bug30794_2 [new file with mode: 0644]
tests/bugs/modalg_7/bug30794_3 [new file with mode: 0644]
tests/bugs/modalg_7/bug30794_4 [new file with mode: 0644]
tests/bugs/modalg_7/bug30817 [new file with mode: 0644]

index eca1216..9bce70a 100644 (file)
@@ -1437,16 +1437,13 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape&  theOrderedList
   gp_Pnt2d ap = aCurve->Value(f);
   Standard_Boolean bFirstFound = Standard_False;
   Standard_Boolean bLastFound = Standard_False;
-  Standard_Boolean bforward = Standard_True;
 
   if(ap.Distance(theFirstPoint) < aTolerance1) {
-    bforward = Standard_True;
     if(theOrientedList.IsEmpty())
       theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
     bFirstFound = Standard_True;
   }
   else if(ap.Distance(theLastPoint) < aTolerance1) {
-    bforward = Standard_False;
     if(theOrientedList.IsEmpty())
       theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
     bLastFound = Standard_True;
@@ -1454,36 +1451,31 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape&  theOrderedList
   ap = aCurve->Value(l);
 
   if(ap.Distance(theLastPoint) < aTolerance2) {
-    bforward = Standard_True;
-
     if(theOrientedList.IsEmpty())
       theOrientedList.Append(aEPrev.Oriented(TopAbs_FORWARD));
     bLastFound = Standard_True;
   }
   else if(ap.Distance(theFirstPoint) < aTolerance2) {
-    bforward = Standard_False;
-
     if(theOrientedList.IsEmpty())
       theOrientedList.Append(aEPrev.Oriented(TopAbs_REVERSED));
     bFirstFound = Standard_True;
   }
 
+  if (!theOrientedList.IsEmpty())
+    aEPrev = TopoDS::Edge (theOrientedList.Last());
+
   for(; anIt.More(); anIt.Next()) {
     const TopoDS_Edge& aE = TopoDS::Edge(anIt.Value());
     TopoDS_Vertex aV11, aV12;
-    TopExp::Vertices(aEPrev, aV11, aV12);
+    TopExp::Vertices(aEPrev, aV11, aV12, Standard_True);
     TopoDS_Vertex aV21, aV22;
-    TopExp::Vertices(aE, aV21, aV22);
-    TopAbs_Orientation anOri = TopAbs_FORWARD;
+    TopExp::Vertices(aE, aV21, aV22, Standard_False);
 
-    if(aV12.IsSame(aV21) || aV11.IsSame(aV22)) {
-      anOri = (bforward) ? TopAbs_FORWARD : TopAbs_REVERSED;
-    }
-    else {
-      anOri = (bforward) ? TopAbs_REVERSED : TopAbs_FORWARD;
-    }
+    TopAbs_Orientation anOri =
+      (aV12.IsSame (aV21) || aV11.IsSame (aV22)) ? TopAbs_FORWARD : TopAbs_REVERSED;
     theOrientedList.Append(aE.Oriented(anOri));
-    aEPrev = aE;
+    aEPrev = TopoDS::Edge (theOrientedList.Last());
+
     aTolerance1 = (aV21.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV21);
     aTolerance2 = (aV22.IsNull()) ? Precision::Confusion() : BRep_Tool::Tolerance(aV22);
     utol = aBAS.UResolution(aTolerance1);
@@ -1511,9 +1503,7 @@ Standard_Boolean CheckAndOrientEdges(const TopTools_ListOfShape&  theOrderedList
     }
   }
 
-  if(!bFirstFound || !bLastFound)
-    return Standard_False;
-  return Standard_True;
+  return bFirstFound && bLastFound;
 }
 
 // ----------------------------------------------------------------------------------------------------
diff --git a/tests/bugs/modalg_7/bug30794_1 b/tests/bugs/modalg_7/bug30794_1
new file mode 100644 (file)
index 0000000..b252470
--- /dev/null
@@ -0,0 +1,19 @@
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes1.brep] c
+explode c
+
+unifysamedom spine c_1
+mksweep spine
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 1.24302e+06 -v 5.64101e+06
+checknbshapes result -wire 14 -face 14 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30794_2 b/tests/bugs/modalg_7/bug30794_2
new file mode 100644 (file)
index 0000000..149483e
--- /dev/null
@@ -0,0 +1,23 @@
+puts "TODO OCC30794 ALL: Faulty shapes in variables"
+puts "TODO OCC30794 ALL: Error : The area of result shape is"
+puts "TODO OCC30794 ALL: Error : The volume of result shape is"
+puts "TODO OCC30794 ALL: Error :  is WRONG because number of"
+
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes1.brep] c
+explode c
+
+mksweep c_1
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 1.24302e+06 -v 5.64101e+06
+checknbshapes result -wire 14 -face 14 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30794_3 b/tests/bugs/modalg_7/bug30794_3
new file mode 100644 (file)
index 0000000..b5993de
--- /dev/null
@@ -0,0 +1,19 @@
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes2.brep] c
+explode c
+
+unifysamedom spine c_1
+mksweep spine
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 883273 -v 1.09918e+07
+checknbshapes result -wire 6 -face 6 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30794_4 b/tests/bugs/modalg_7/bug30794_4
new file mode 100644 (file)
index 0000000..ffadcfb
--- /dev/null
@@ -0,0 +1,22 @@
+puts "TODO OCC30794 ALL: Faulty shapes in variables"
+puts "TODO OCC30794 ALL: Error : The volume of result shape is"
+puts "TODO OCC30794 ALL: Error :  is WRONG because number of"
+
+puts "========"
+puts "0030794: BRepOffsetAPI_MakePipeShell: shape is produced with artifacts"
+puts "========"
+puts ""
+
+restore [locate_data_file bug30794_shapes2.brep] c
+explode c
+
+mksweep c_1
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 883273 -v 1.09918e+07
+checknbshapes result -wire 6 -face 6 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_7/bug30817 b/tests/bugs/modalg_7/bug30817
new file mode 100644 (file)
index 0000000..9f08259
--- /dev/null
@@ -0,0 +1,18 @@
+puts "========"
+puts "0030817: Modeling Algorithms - BRepOffsetAPI_MakePipeShell produces invalid result"
+puts "========"
+puts ""
+
+binrestore [locate_data_file bug30794_shapes.bin] c
+explode c
+
+mksweep c_1
+addsweep c_2
+buildsweep result -C -S
+
+checkshape result
+
+checkprops result -s 1.44508e+06 -v 1.78664e+07
+checknbshapes result -wire 7 -face 7 -shell 1 -solid 1 -t
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png