]> OCCT Git - occt.git/commitdiff
0033759: Modeling Algorithms - Offset is in wrong direction CR33759
authorastromko <astromko@opencascade.com>
Mon, 9 Sep 2024 14:12:11 +0000 (15:12 +0100)
committerastromko <astromko@opencascade.com>
Wed, 11 Sep 2024 19:32:47 +0000 (20:32 +0100)
Changed the condition to avoid reversing offset
  for reversed edges.
Added a test case.

src/BRepFill/BRepFill_OffsetWire.cxx
tests/bugs/modalg_5/bug25334_2
tests/bugs/modalg_5/bug25334_4
tests/bugs/modalg_8/bug33759 [new file with mode: 0644]

index dae07a5bb30f7bcd9b26294ccef1705050762df9..db15151a6ab607ed5db98ac427b3f022666316f9 100644 (file)
@@ -264,12 +264,12 @@ static Standard_Boolean KPartCircle
     }
     else if (AHC->GetType() == GeomAbs_Circle)
     {
-      if (E.Orientation() == TopAbs_FORWARD)
-        anOffset *= -1;
-      if (!BRep_Tool::IsClosed(E))
+      // Reverse the offset function when the edge is FORWARD and CLOSED
+      if (E.Orientation() == TopAbs_FORWARD && BRep_Tool::IsClosed(E))
       {
         anOffset *= -1;
       }
+
       gp_Circ2d theCirc = AHC->Circle();
       if (anOffset > 0. || Abs(anOffset) < theCirc.Radius())
         OC = new Geom2d_Circle (theCirc.Position(), theCirc.Radius() + anOffset);
index b5f90d7539e409561d9f1cc852b06b152368520a..3f16c789c7f620ba75b278761e9d849b26631bd8 100644 (file)
@@ -23,7 +23,7 @@ vori result
 
 fit
 
-checkprops result -l 613.3
+checkprops result -l 644.50
 checkshape result 
 checksection result
 
index 40b13eb67e4ff5d95cdfe1efee81a24dc01a51d5..d22bb01edc594221572fc8709b57d45b250accca 100644 (file)
@@ -23,7 +23,7 @@ vori result
 
 fit
 
-checkprops result -l 354.958 
+checkprops result -l 386.077 
 checkshape result 
 checksection result
 
diff --git a/tests/bugs/modalg_8/bug33759 b/tests/bugs/modalg_8/bug33759
new file mode 100644 (file)
index 0000000..35355f9
--- /dev/null
@@ -0,0 +1,39 @@
+puts "==========================================================="
+puts "0033759: Modeling Algorithms - Offset is in wrong direction"
+puts "==========================================================="
+puts ""
+
+pload MODELING
+circle c1 0 0 0 30
+
+# make and check FORWARD, NOT CLOSED edge
+mkedge e1 c1 1.5*pi 0
+wire w1 e1
+plane pln1 0 0 0  0 0 1  1 0 0
+mkface f1 pln1 w1
+openoffset of1 f1 1 7
+checkprops of1_1 -l 58.1195
+
+# make and check REVERSED, NOT CLOSED edge
+complement e1
+wire w1 e1
+plane pln1 0 0 0  0 0 1  1 0 0
+mkface f1 pln1 w1
+openoffset of1 f1 1 7
+checkprops of1_1 -l 58.1195
+
+# make and check FORWARD CLOSED edge
+mkedge e1 c1 0 0
+wire w1 e1
+plane pln1 0 0 0  0 0 1  1 0 0
+mkface f1 pln1 w1
+openoffset of1 f1 1 7
+checkprops of1_1 -l 232.478
+
+# make and check REVERSED CLOSED edge
+complement e1
+wire w1 e1
+plane pln1 0 0 0  0 0 1  1 0 0
+mkface f1 pln1 w1
+openoffset of1 f1 1 7
+checkprops of1_1 -l 232.478