mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0025407: Exception in extrema operation.
Special handling of curve / surface of extrusion case is deleted. Corresponding test case fixed. Test cases for issue CR25407
This commit is contained in:
parent
50d0e1cefd
commit
032d027214
@ -203,52 +203,7 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
|
||||
TUVsup(1) = mytsup;
|
||||
TUVsup(2) = trimusup;
|
||||
TUVsup(3) = trimvsup;
|
||||
// 18/02/02 akm vvv : (OCC163) bad extremas - extrusion surface versus the line.
|
||||
// Try to preset the initial solution as extrema between
|
||||
// extrusion direction and the curve.
|
||||
if (myS->GetType() == GeomAbs_SurfaceOfExtrusion)
|
||||
{
|
||||
gp_Dir aDir = myS->Direction();
|
||||
Handle(Adaptor3d_HCurve) aCurve = myS->BasisCurve();
|
||||
Standard_Real dfUFirst = aCurve->FirstParameter();
|
||||
// Create iso line of U=U0
|
||||
GeomAdaptor_Curve anAx(new Geom_Line(aCurve->Value(dfUFirst), aDir),
|
||||
trimvmin, trimvsup);
|
||||
Extrema_ExtCC aLocator(C, anAx);
|
||||
if (aLocator.IsDone() && aLocator.NbExt()>0)
|
||||
{
|
||||
Standard_Integer iExt;
|
||||
// Try to find all extremas
|
||||
Extrema_POnCurv aP1, aP2;
|
||||
for (iExt=1; iExt<=aLocator.NbExt(); iExt++)
|
||||
{
|
||||
aLocator.Points (iExt, aP1, aP2);
|
||||
// Parameter on curve
|
||||
TUV(1) = aP1.Parameter();
|
||||
// To find parameters on surf, try ExtPS
|
||||
Extrema_ExtPS aPreciser (aP1.Value(), *myS, mytol2, mytol2);
|
||||
if (aPreciser.IsDone())
|
||||
{
|
||||
// Managed to find extremas between point and surface
|
||||
Standard_Integer iPExt;
|
||||
for (iPExt=1; iPExt<=aPreciser.NbExt(); iPExt++)
|
||||
{
|
||||
aPreciser.Point(iPExt).Parameter(TUV(2),TUV(3));
|
||||
math_FunctionSetRoot S1 (myF,TUV,Tol,TUVinf,TUVsup);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Failed... try the point on iso line
|
||||
TUV(2) = dfUFirst;
|
||||
TUV(3) = aP2.Parameter();
|
||||
math_FunctionSetRoot S1 (myF,TUV,Tol,TUVinf,TUVsup);
|
||||
}
|
||||
} // for (iExt=1; iExt<=aLocator.NbExt(); iExt++)
|
||||
} // if (aLocator.IsDone() && aLocator.NbExt()>0)
|
||||
} // if (myS.Type() == GeomAbs_ExtrusionSurface)
|
||||
else
|
||||
{
|
||||
|
||||
// Number of particles used in PSO algorithm (particle swarm optimization).
|
||||
const Standard_Integer aNbParticles = 32;
|
||||
|
||||
@ -335,7 +290,6 @@ void Extrema_GenExtCS::Perform (const Adaptor3d_Curve& C,
|
||||
aPSO.Perform(aParticles, aNbParticles, aValue, TUV);
|
||||
|
||||
math_FunctionSetRoot anA (myF, TUV, Tol, TUVinf, TUVsup, 100, Standard_False);
|
||||
}
|
||||
|
||||
myDone = Standard_True;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ puts "========"
|
||||
puts ""
|
||||
###########################################################
|
||||
## The result of extrema command is not correct.
|
||||
## We have only two "max" extrema, but we should have "min" and "max".
|
||||
## Extrema command return max, but it acceptable because relative error near 1.0e-30.
|
||||
###########################################################
|
||||
|
||||
restore [locate_data_file OCC130.brep] res
|
||||
@ -17,14 +17,31 @@ mksurface s res
|
||||
|
||||
set che [extrema l s]
|
||||
set err [llength $che]
|
||||
if { $err < 2} {
|
||||
puts "Error OCC163 (amount): command extrema does NOT work properly"
|
||||
|
||||
# Amount Check
|
||||
if { $err != 1} {
|
||||
puts "Error: Invalid extrema number"
|
||||
}
|
||||
|
||||
set dum1 [dump [lindex $che 0]]
|
||||
set dum2 [dump [lindex $che 1]]
|
||||
set status 0
|
||||
set info [dump ext_1]
|
||||
regexp "Parameters : 0 +(\[-0-9*\.+eE\]+)" $info full extLength
|
||||
|
||||
if { $dum1 == $dum2} {
|
||||
puts "Error OCC163 (dump): command extrema does NOT work properly"
|
||||
# Test max
|
||||
if { $extLength > 35 && $extLength < 36} {
|
||||
set good_dist 35.6687907545308
|
||||
checkreal "Max distance:" ${extLength} ${good_dist} 0.01 0.01
|
||||
set status 1
|
||||
}
|
||||
|
||||
# Test min
|
||||
if {$extLength > 0 && $extLength < 1} {
|
||||
set good_dist 0.0
|
||||
checkreal "Min distance:" ${extLength} ${good_dist} 0.01 0.01
|
||||
set status 1
|
||||
}
|
||||
|
||||
# Not min or max
|
||||
if {$status == 0} {
|
||||
puts "Error: wrong extrema point"
|
||||
}
|
||||
|
24
tests/bugs/moddata_3/bug25407_1
Executable file
24
tests/bugs/moddata_3/bug25407_1
Executable file
@ -0,0 +1,24 @@
|
||||
puts "================"
|
||||
puts "OCC25407"
|
||||
puts "================"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Exception in extrema operation.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25407_e2.brep] e
|
||||
restore [locate_data_file bug25407_f2.brep] f
|
||||
|
||||
mkcurve c e
|
||||
mksurface s f
|
||||
|
||||
extrema c s
|
||||
|
||||
if { [isdraw ext_1] } {
|
||||
mkedge result ext_1
|
||||
set length 1.88322e-11
|
||||
} else {
|
||||
puts "Error: invalid result"
|
||||
}
|
||||
|
||||
set 2dviewer 1
|
27
tests/bugs/moddata_3/bug25407_2
Executable file
27
tests/bugs/moddata_3/bug25407_2
Executable file
@ -0,0 +1,27 @@
|
||||
puts "================"
|
||||
puts "OCC25407"
|
||||
puts "================"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Exception in extrema operation.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25407_e2.brep] e
|
||||
restore [locate_data_file bug25407_f2.brep] f
|
||||
|
||||
mkcurve c e
|
||||
mksurface s f
|
||||
|
||||
trim st s -0.168011130695572 0. -16.5 0.
|
||||
trim ct c 1.1167213545471877e-008 0.033333343614041021
|
||||
|
||||
extrema ct st
|
||||
|
||||
if { [isdraw ext_1] } {
|
||||
mkedge result ext_1
|
||||
set length 1.00005e-07
|
||||
} else {
|
||||
puts "Error: invalid result"
|
||||
}
|
||||
|
||||
set 2dviewer 1
|
Loading…
x
Reference in New Issue
Block a user