]> OCCT Git - occt.git/commitdiff
0033146: Modeling Algorithms - 2D Offset with arc-lin approximation fails on open...
authorastromko <astromko@opencascade.com>
Wed, 17 Apr 2024 09:46:06 +0000 (10:46 +0100)
committerdpasukhi <dpasukhi@opencascade.com>
Sun, 19 May 2024 15:03:09 +0000 (16:03 +0100)
Added additional conditions to avoid crash.
Added a test case.

src/BRepFill/BRepFill_OffsetWire.cxx
tests/bugs/modalg_8/bug33146 [new file with mode: 0644]

index befe34193cf7110e03a4822fbcda2a5819d42e79..ee611c1f09d794d31a150ae9616a6fcd03c7433a 100644 (file)
@@ -926,7 +926,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
     if (StartOnEdge) {
       Standard_Boolean Start = 1;
       Trim.AddOrConfuse(Start, E[0], E[1], Params);
-      if (Params.Length() == Vertices.Length()
+      if (Params.Length() == Vertices.Length() && Params.Length() != 0)
         Vertices.SetValue(1,VS);
       
       else
@@ -936,7 +936,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
     if (EndOnEdge) {     
       Standard_Boolean Start = 0;
       Trim.AddOrConfuse(Start, E[0], E[1], Params);
-      if (Params.Length() == Vertices.Length()
+      if (Params.Length() == Vertices.Length() && Params.Length() != 0)
         Vertices.SetValue(Params.Length(),VE);
       
       else
@@ -962,7 +962,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
     // Storage of vertices on parallel edges.
     // fill MapBis and MapVerPar.
     //----------------------------------------------
-    if (!Vertices.IsEmpty()) {
+    if (!Vertices.IsEmpty() && Params.Length() == Vertices.Length()) {
       for (k = 0; k <= 1; k++) {
         if (!MapBis.IsBound(E[k])) {
           MapBis   .Bind(E[k],EmptySeq);
@@ -1298,7 +1298,7 @@ void BRepFill_OffsetWire::UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfSh
       ii++; 
     }
     
-    while (ii <= Vertices.Length()) {
+    while (ii <= Vertices.Length() && ii <= Params.Length()) {
       U2 = Params.Value(ii).X();
       V2 = TopoDS::Vertex(Vertices.Value(ii));
       
diff --git a/tests/bugs/modalg_8/bug33146 b/tests/bugs/modalg_8/bug33146
new file mode 100644 (file)
index 0000000..2c5bca4
--- /dev/null
@@ -0,0 +1,10 @@
+puts "==============================================================="
+puts "0033146: Modeling Algorithms - 2D Offset with arc-lin approximation fails on open B-spline edge"
+puts "==============================================================="
+puts ""
+
+pload MODELING
+restore [locate_data_file bug33146.brep] a
+wire a a
+openoffset result a 1 1. -approx
+checkview -display result_1 -2d -path ${imagedir}/${test_image}.png