]> OCCT Git - occt.git/commitdiff
0033515: Modeling Algorithm - BRepExtrema_DistShapeShape poduces wrong result
authorakaftasev <akaftasev@opencascade.com>
Mon, 6 Nov 2023 14:54:33 +0000 (14:54 +0000)
committerakaftasev <akaftasev@opencascade.com>
Mon, 6 Nov 2023 14:54:33 +0000 (14:54 +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

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 b0c5c67d839b484cc9224b269ed3528a6a799426..ca7cc9ea950bde87e72d24959efbb375a4b9c9e1 100644 (file)
@@ -45,7 +45,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;
 }
 
@@ -66,7 +66,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]