1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0

Improve tolerance criteria to check values of extremas for equality: use multiplier, which depends on the value, instead of magic number
This commit is contained in:
azv 2022-03-18 23:46:44 +03:00 committed by smoskvin
parent 3425e83f4b
commit 9b337ad8e5
2 changed files with 27 additions and 2 deletions

View File

@ -678,7 +678,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
aMinSqD = Min(aMinSqD, ExtPCir.SquareDistance(anExtID));
}
if (aMinSqD <= aMinSquareDist + 10.* Epsilon(1. + aMinSqD))
if (aMinSqD <= aMinSquareDist + (1. + aMinSqD) * Epsilon(1. + aMinSqD))
{
ClearSolutions();
mySqDist.Append(aMinSqD);
@ -778,7 +778,7 @@ void Extrema_ExtCC::PrepareParallelResult(const Standard_Real theUt11,
imin = k;
}
}
if (aDmin <= aMinSquareDist + 10.* Epsilon(1. + aDmin))
if (aDmin <= aMinSquareDist + (1. + aDmin) * Epsilon(1. + aDmin))
{
if (imin == 0)
{

View File

@ -0,0 +1,25 @@
puts "================================================="
puts "0032874: IsParallel() method of Extrema_ExtCC does not give same results in OCC 7.6.0 vs OCC 7.5.0"
puts "================================================="
puts ""
set distExpected 10
circle c1 0 0 0 100
circle c2 0 0 0 100+$distExpected
set nbSteps 72
for {set i 1} {$i < $nbSteps} {incr i} {
trim cc1 c1 0 2.*pi/$nbSteps*$i
trim cc2 c2 0 2.*pi/$nbSteps*$i
set extr [extrema cc1 cc2]
if {[regexp {Infinite number of extremas, distance = ([-0-9.+eE]+)} $extr full dist]} {
if {[expr abs($dist - $distExpected)] < 1.e-7} {
puts "OK"
} else {
puts "Error: wrong distance $dist instead of $distExpected expected"
}
} else {
puts "Error: non-parallel curves"
}
}