]> OCCT Git - occt.git/commitdiff
0033515: Modeling Algorithm - BRepExtrema_DistShapeShape poduces wrong result IR-2023-11-03
authorakaftasev <akaftasev@opencascade.com>
Wed, 25 Oct 2023 11:32:49 +0000 (12:32 +0100)
committervglukhik <vglukhik@opencascade.com>
Fri, 3 Nov 2023 14:21:37 +0000 (14:21 +0000)
Changed redundant square operation

src/Extrema/Extrema_GenExtCC.gxx
src/Extrema/Extrema_GlobOptFuncCC.cxx
tests/bugs/modalg_8/bug33515 [new file with mode: 0644]
tests/lowalgos/extcc/bug32882
tests/perf/modalg/bug32539_1
tests/perf/modalg/bug32539_2

index 33826fc5c8dbda54c2703f254bc5bcebd9b3477c..8c48e74fe3636475fb1a61ec47dc39b26bc6ca13 100644 (file)
@@ -627,7 +627,7 @@ void Extrema_GenExtCC::Perform()
     {
       Standard_Real aDist1 = ProjPOnC(C1.Value(aT1[iT]), anExtPC2);
       Standard_Real aDist2 = ProjPOnC(C2.Value(aT2[iT]), anExtPC1);
-      isParallel = (Abs(Min(aDist1, aDist2) - aF) < Precision::Confusion());
+      isParallel = (Abs(Min(aDist1, aDist2) - aF * aF) < Precision::Confusion());
     }
   }
 
index 93b5fd60b0f0d384c4c083a30db5bc60e4425bcd..a3db239f843205e41f35a9d70e90c33eee1a50cb 100644 (file)
@@ -43,7 +43,7 @@ static Standard_Boolean _Value(const Adaptor3d_Curve& C1,
     return Standard_False;
   }
 
-  F = C2.Value(v).SquareDistance(C1.Value(u));
+  F = C2.Value(v).Distance(C1.Value(u));
   return Standard_True;
 }
 
@@ -64,7 +64,7 @@ static Standard_Boolean _Value(const Adaptor2d_Curve2d& C1,
     return Standard_False;
   }
 
-  F = C2.Value(v).SquareDistance(C1.Value(u));
+  F = C2.Value(v).Distance(C1.Value(u));
   return Standard_True;
 }
 
diff --git a/tests/bugs/modalg_8/bug33515 b/tests/bugs/modalg_8/bug33515
new file mode 100644 (file)
index 0000000..de54420
--- /dev/null
@@ -0,0 +1,14 @@
+puts "================================"
+puts " 0033515: Modeling Algorithm - BRepExtrema_DistShapeShape poduces wrong result"
+puts "================================"
+
+restore [locate_data_file bug33515_w1.brep] w1
+restore [locate_data_file bug33515_w2.brep] w2
+
+distmini d w1 w2 
+set dist [dval d_val]
+if { $dist < 3.e-10 } {
+       puts "OK: Extrema is valid"
+} else {
+       puts "Error: Extrema distance is too big"
+}
index 9e91bbedf6133ec219270ac23d7aa4028e1a332b..5e5b1c1b36d5f19d87a53648c100ef52c11d776e 100644 (file)
@@ -24,7 +24,7 @@ if { [llength $info] != 3 } {
 # Check result
 checklength ext_1 -l 2.929642751e-14 -eps .01
 checklength ext_2 -l 3.480934286e-14 -eps .01
-checklength ext_3 -l 3.177643716e-14 -eps .01
+checklength ext_3 -l 2.929642751054232-14 -eps .01
 
 # Run extrema c3/c2
 set info [extrema c3 c2]
index 6c7a4333c3932e6cfbba5e0e5de7e8fbe8b28c25..3f83381f6510b29be2bbf4efffce6719ff338455 100644 (file)
@@ -5,6 +5,7 @@ puts ""
 
 # prepare
 pload XDE OCAF
+cpulimit 1000
 XOpen [locate_data_file bug32539_1.xbf] XB
 XGetShape s1 XB 0:1:1:2
 XGetShape s2 XB 0:1:1:4
index 6d9edaf06d218a5ce5c78ad65bfc6152b3f3f29e..5d7bbc27e17c3cfd4e6f11174a8473ee121230f9 100644 (file)
@@ -8,6 +8,7 @@ restore [locate_data_file 5000-12.brep] s1
 restore [locate_data_file BPLSEITLI.brep] s2
 
 # multi-thread
+cpulimit 1000
 dchrono p reset; dchrono p start;
 set pres [distmini res s1 s2 -parallel]
 dchrono p stop;