mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0025660: Project command produce wrong 2dcurve
Changed starting point of Newton optimization. Test case for issue CR25660
This commit is contained in:
parent
fa89e0828b
commit
4f0d73a918
@ -756,18 +756,24 @@ void ProjLib_CompProjectedCurve::Init()
|
||||
t = Triple.X() + Step;
|
||||
if (t > LastU) t = LastU;
|
||||
|
||||
Standard_Real U0, V0;
|
||||
gp_Pnt2d aLowBorder(mySurface->FirstUParameter(),mySurface->FirstVParameter());
|
||||
gp_Pnt2d aUppBorder(mySurface->LastUParameter(), mySurface->LastVParameter());
|
||||
gp_Pnt2d aTol(myTolU, myTolV);
|
||||
//Here we are trying to prolong continuous part
|
||||
while (t <= LastU && new_part)
|
||||
{
|
||||
Standard_Real U0, V0;
|
||||
|
||||
U0 = Triple.Y();
|
||||
V0 = Triple.Z();
|
||||
U0 = Triple.Y() + (Triple.Y() - prevTriple.Y());
|
||||
V0 = Triple.Z() + (Triple.Z() - prevTriple.Z());
|
||||
// adjust U0 to be in [mySurface->FirstUParameter(),mySurface->LastUParameter()]
|
||||
U0 = Min(Max(U0, aLowBorder.X()), aUppBorder.X());
|
||||
// adjust V0 to be in [mySurface->FirstVParameter(),mySurface->LastVParameter()]
|
||||
V0 = Min(Max(V0, aLowBorder.Y()), aUppBorder.Y());
|
||||
|
||||
aPrjPS.Perform(t, U0, V0, gp_Pnt2d(myTolU, myTolV),
|
||||
gp_Pnt2d(mySurface->FirstUParameter(),mySurface->FirstVParameter()),
|
||||
gp_Pnt2d(mySurface->LastUParameter(), mySurface->LastVParameter()),
|
||||
FuncTol, Standard_True);
|
||||
|
||||
aPrjPS.Perform(t, U0, V0, aTol,
|
||||
aLowBorder, aUppBorder, FuncTol, Standard_True);
|
||||
if(!aPrjPS.IsDone())
|
||||
{
|
||||
|
||||
|
49
tests/bugs/moddata_3/bug25660
Normal file
49
tests/bugs/moddata_3/bug25660
Normal file
@ -0,0 +1,49 @@
|
||||
puts "================"
|
||||
puts "OCC25660"
|
||||
puts "================"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Project command produce wrong 2dcurve
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25660_c3d.draw] c3d
|
||||
restore [locate_data_file bug25660_surf.draw] surf
|
||||
|
||||
project c2d c3d surf
|
||||
|
||||
set log [dump c2d]
|
||||
|
||||
regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
|
||||
puts "Degree=${Degree}"
|
||||
puts "Poles=${Poles}"
|
||||
puts "KnotsPoles=${KnotsPoles}"
|
||||
puts ""
|
||||
|
||||
set tol_abs 1.e-7
|
||||
set tol_rel 0.01
|
||||
set V_i 0
|
||||
|
||||
for {set i 1} {${i} <= ${Poles}} {incr i} {
|
||||
set V_i_1 ${V_i}
|
||||
set exp_string " +${i} : +(\[-0-9.+eE\]+), +(\[-0-9.+eE\]+)"
|
||||
regexp ${exp_string} ${log} full U_i V_i
|
||||
#puts "i=${i} U_i=${U_i} V_i=${V_i}"
|
||||
if { ${i} == 1 } {
|
||||
# First pole
|
||||
puts "V_first=${V_i}"
|
||||
set expected_V_first 0.0
|
||||
checkreal "V_first" ${V_i} ${expected_V_first} ${tol_abs} ${tol_rel}
|
||||
}
|
||||
if { ${i} == ${Poles} } {
|
||||
# Last pole
|
||||
puts "V_last=${V_i}"
|
||||
set expected_V_last 6.96771797765
|
||||
checkreal "V_last" ${V_i} ${expected_V_last} ${tol_abs} ${tol_rel}
|
||||
}
|
||||
if { ${i} > 1 } {
|
||||
#puts "i=${i} U_i=${U_i} V_i=${V_i} V_i_1=${V_i_1}"
|
||||
if { ${V_i_1} >= ${V_i} } {
|
||||
puts "Error: Bad value of V in string: ${i} :${U_i}, ${V_i}"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user