mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-26 10:19:45 +03:00
0024200: Wrong result obtained by Exterma Curve/Curve
changed number of nodes in case of GeomAbs_Line in Extrema_GExtCC::Perform() function. changed number of nodes in case of GeomAbs_Line in Extrema_GExtCC::Perform(). fixed incorrect indexes and Coeff check in Extrema_CurveCache::Extrema_CurveCache added to avoid int overflow. Added test case bugs/modalg_5/bug24200 Added check if (aNbS[i] * Coeff[i]) too big in Extrema_GExtCC::Perform().
This commit is contained in:
parent
62f225930c
commit
84f4830127
@ -57,7 +57,9 @@ Extrema_CurveCache::Extrema_CurveCache(const Curve& theC,
|
|||||||
myTrimFirst = myFirst = theUFirst;
|
myTrimFirst = myFirst = theUFirst;
|
||||||
myTrimLast = myLast = theULast;
|
myTrimLast = myLast = theULast;
|
||||||
|
|
||||||
Standard_Integer Nbp = (Standard_Integer) (2 * Coeff);
|
Standard_Integer Nbp = 2;
|
||||||
|
if (2 * Coeff < 10000.0)
|
||||||
|
Nbp = (Standard_Integer) (2 * Coeff);
|
||||||
myNbSamples = (EndIndex - StartIndex)*Nbp + 1;
|
myNbSamples = (EndIndex - StartIndex)*Nbp + 1;
|
||||||
|
|
||||||
const Standard_Integer aNbSTresh = 10000;
|
const Standard_Integer aNbSTresh = 10000;
|
||||||
|
@ -301,7 +301,8 @@ void Extrema_GExtCC::Perform()
|
|||||||
rl = (Tool1::BSpline(*((Curve1*)myC[i])))->LastParameter();
|
rl = (Tool1::BSpline(*((Curve1*)myC[i])))->LastParameter();
|
||||||
aNbS[i] = (Standard_Integer) ( aNbS[i] * ((mySup[i] - myInf[i]) / (rl - rf)) + 1 );
|
aNbS[i] = (Standard_Integer) ( aNbS[i] * ((mySup[i] - myInf[i]) / (rl - rf)) + 1 );
|
||||||
case GeomAbs_OtherCurve:
|
case GeomAbs_OtherCurve:
|
||||||
//adjust number of sample points for B-Splines and Other curves
|
case GeomAbs_Line:
|
||||||
|
//adjust number of sample points for Lines, B-Splines and Other curves
|
||||||
aNbInter[i] = aC.NbIntervals (GeomAbs_C2);
|
aNbInter[i] = aC.NbIntervals (GeomAbs_C2);
|
||||||
aNbS[i] = Max(aNbS[i] / aNbInter[i], 3);
|
aNbS[i] = Max(aNbS[i] / aNbInter[i], 3);
|
||||||
LL[i] = 0.;
|
LL[i] = 0.;
|
||||||
@ -323,10 +324,12 @@ void Extrema_GExtCC::Perform()
|
|||||||
if(LL[0] > 0. && LL[1] > 0.) {
|
if(LL[0] > 0. && LL[1] > 0.) {
|
||||||
if(LL[0] > 4.*LL[1]) {
|
if(LL[0] > 4.*LL[1]) {
|
||||||
Coeff[0] = LL[0]/LL[1]/2.;
|
Coeff[0] = LL[0]/LL[1]/2.;
|
||||||
|
if (aNbS[0] * Coeff[0] <= 10000.0)
|
||||||
aNbS[0] = (Standard_Integer) ( aNbS[0] * Coeff[0] );
|
aNbS[0] = (Standard_Integer) ( aNbS[0] * Coeff[0] );
|
||||||
}
|
}
|
||||||
else if(LL[1] > 4.*LL[0]) {
|
else if(LL[1] > 4.*LL[0]) {
|
||||||
Coeff[1] = LL[1]/LL[0]/2.;
|
Coeff[1] = LL[1]/LL[0]/2.;
|
||||||
|
if (aNbS[1] * Coeff[1] <= 10000.0)
|
||||||
aNbS[1] = (Standard_Integer) (aNbS[1] * Coeff[1] );
|
aNbS[1] = (Standard_Integer) (aNbS[1] * Coeff[1] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
37
tests/bugs/modalg_5/bug24200
Normal file
37
tests/bugs/modalg_5/bug24200
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC24200"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#################################################
|
||||||
|
# Wrong result obtained by Extrema Curve/Curve
|
||||||
|
#################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug24200_c1] c1
|
||||||
|
restore [locate_data_file bug24200_c2] c2
|
||||||
|
set info_1 [extrema c1 c2]
|
||||||
|
|
||||||
|
if { [regexp "ext_15" $info_1] != 1 } {
|
||||||
|
puts "Error : Extrema is wrong"
|
||||||
|
} else {
|
||||||
|
puts "OK : Extrema is correct"
|
||||||
|
}
|
||||||
|
|
||||||
|
trim c1t c1 677.8 678.8
|
||||||
|
trim c2t c2 2477 2479
|
||||||
|
extrema c1t c2t
|
||||||
|
|
||||||
|
cvalue c1t 678.34269564178146 x y z
|
||||||
|
vertex v1 x y z
|
||||||
|
cvalue c2t 2478.1205500811761 x y z
|
||||||
|
vertex v2 x y z
|
||||||
|
distmini d v1 v2
|
||||||
|
regexp {([-0-9.+eE]+)} [dump d_val] full dist
|
||||||
|
|
||||||
|
set checkdist 2.54211497292521e-013
|
||||||
|
|
||||||
|
if { [expr 1.*abs($checkdist - $dist)/$checkdist] > 0.1 } {
|
||||||
|
puts "Error : Distance is wrong"
|
||||||
|
} else {
|
||||||
|
puts "OK: Distance is correct"
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user