]> OCCT Git - occt.git/commitdiff
0033615: Modeling Algorithms - Partition algorithm creates unexpected vertices
authorakaftase <168822067+akaftase@users.noreply.github.com>
Sun, 7 Jul 2024 18:54:35 +0000 (19:54 +0100)
committerPasukhin Dmitry <44947322+dpasukhi@users.noreply.github.com>
Mon, 8 Jul 2024 15:28:00 +0000 (17:28 +0200)
This problem occurs because of obtaining 2 ALines which share same vertex on the seam edge.
There should be 2 different vertices with same(or almost the same) 3d parameters, but
with different UV parameters because of periodic surface.
Current fix allows to avoid the same vertices on seam edge and also checks the next vertex.
Added consideration of predicted next point to avoid skipping tha point which is not on seam edge.
Added test case for #33702

src/IntPatch/IntPatch_ALineToWLine.cxx
tests/bugs/modalg_8/bug33615 [new file with mode: 0644]
tests/bugs/modalg_8/bug33702 [new file with mode: 0644]
tests/lowalgos/intss/bug29807_i1002
tests/lowalgos/intss/bug29807_i5002

index 54f8f0745324444e7bf50fd29cc6e910df67d16d..80dea14330e4a158c1bb22fa1ee4b6f65431c0af 100644 (file)
@@ -647,6 +647,26 @@ void IntPatch_ALineToWLine::MakeWLine(const Handle(IntPatch_ALine)& theALine,
         {// Strictly equal!!!
           break;
         }
+        else if (aParameter + aStep < theLPar)
+        {
+          // Prediction of the next point 
+          gp_Pnt aPnt3dNext;
+          gp_Vec aTg;
+          theALine->D1(aParameter + aStep, aPnt3dNext, aTg);
+          Standard_Real anU1 = 0.0, aV1 = 0.0, anU2 = 0.0, aV2 = 0.0;
+          myQuad1.Parameters(aPnt3dNext, anU1, aV1);
+          myQuad2.Parameters(aPnt3dNext, anU2, aV2);
+          IntSurf_PntOn2S aPOn2SNext;
+          aPOn2SNext.SetValue(aPnt3dNext, anU1, aV1, anU2, aV2);
+
+          if (aPOn2SNext.ValueOnSurface(0).SquareDistance(aRPT.ValueOnSurface(0)) > M_PI * M_PI ||
+            aPOn2SNext.ValueOnSurface(1).SquareDistance(aRPT.ValueOnSurface(1)) > M_PI * M_PI)
+          {
+            aPrevLPoint = aRPT;
+            aPrevParam = aParameter;
+            continue;
+          }
+        }
       }
 
       aPrePointExist = IntPatch_SPntNone;
diff --git a/tests/bugs/modalg_8/bug33615 b/tests/bugs/modalg_8/bug33615
new file mode 100644 (file)
index 0000000..ac756f9
--- /dev/null
@@ -0,0 +1,22 @@
+puts "================================"
+puts "0033615: Modeling Algorithms - Partition algorithm creates unexpected vertices"
+puts "================================"
+puts ""
+
+plane plane -5 0 4 -1 0 0
+pcone cone plane 3 1 10 
+pcylinder cylinder 10 20 
+explode cylinder f 
+explode cone f 
+
+don cylinder_1 cone_1 
+axo;fit 
+bclearobjects
+bcleartools
+baddobjects cone_1 
+baddtools cylinder_1 
+bfillds 
+bbuild result
+
+checknbshapes result -vertex 5 -edge 8 -wire 5 -face 4
+checkview -display result -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/modalg_8/bug33702 b/tests/bugs/modalg_8/bug33702
new file mode 100644 (file)
index 0000000..831163c
--- /dev/null
@@ -0,0 +1,12 @@
+puts "================================"
+puts "0033702: Modeling Algorithms - Regression: Intersection curve is not built between cone and cylinder"
+puts "================================"
+puts ""
+
+restore [locate_data_file bug33702_ext.brep] ext 
+restore [locate_data_file bug33702_rev.brep] rev 
+
+bcut result ext rev
+
+checknbshapes result -vertex 51 -edge 75 -wire 42 -face 30
+checkview -display result -2d -path ${imagedir}/${test_image}.png
index 1a4df76d3d4a572bcc6f3b62ed942808264208c7..f0c73ccba0420bfa1ff3cc55181d30481de1067a 100644 (file)
@@ -17,7 +17,7 @@ fit
 
 regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} [bopcurves b1_5 b2_2 -2d] full Toler NbCurv
 
-if { ${Toler} > 0.0004} {
+if { ${Toler} > 0.002} {
    puts "Error: bad tolerance of result"
 }
 
index e55dec57c808718e113ec26d1824aec0248736c3..74d6d1acf005ac2bf716270759222ec75f689939 100644 (file)
@@ -55,6 +55,6 @@ fit
 checksection result -r 0
 checkmaxtol result -min_tol 2.0e-7
 
-checknbshapes result -edge 3 -vertex 3
+checknbshapes result -edge 2 -vertex 2
 
 checkview -screenshot -2d -path ${imagedir}/${test_image}.png