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

0024633: Incorrect projection of a curve on a surface

Test cases for issue CR24633
This commit is contained in:
jgv 2014-03-27 16:51:39 +04:00 committed by abv
parent 0d3bd50c5f
commit a4f8324b73
3 changed files with 101 additions and 2 deletions

View File

@ -1059,14 +1059,59 @@ Handle(Adaptor2d_HCurve2d)
(pntproj, Surf->Surface(), U0, V0, TolU, TolV) ;
if (aLocateExtPS.IsDone())
if (aLocateExtPS.SquareDistance() < DistTol3d * DistTol3d) { //OCC217
//if (aLocateExtPS.SquareDistance() < Tol3d * Tol3d) {
{
if (aLocateExtPS.SquareDistance() < DistTol3d * DistTol3d)
{ //OCC217
//if (aLocateExtPS.SquareDistance() < Tol3d * Tol3d) {
(aLocateExtPS.Point()).Parameter(U0,V0);
U1 = U0 + usens*uperiod;
V1 = V0 + vsens*vperiod;
Pts2d(i).SetCoord(U1,V1);
myProjIsDone = Standard_True;
}
else
{
Extrema_ExtPS aGlobalExtr(pntproj, Surf->Surface(), TolU, TolV);
if (aGlobalExtr.IsDone())
{
Standard_Real LocalMinSqDist = RealLast();
Standard_Integer imin = 0;
for (Standard_Integer isol = 1; isol <= aGlobalExtr.NbExt(); isol++)
{
Standard_Real aSqDist = aGlobalExtr.SquareDistance(isol);
if (aSqDist < LocalMinSqDist)
{
LocalMinSqDist = aSqDist;
imin = isol;
}
}
if (LocalMinSqDist < DistTol3d * DistTol3d)
{
Standard_Real LocalU, LocalV;
aGlobalExtr.Point(imin).Parameter(LocalU, LocalV);
if (uperiod > 0. && Abs(U0 - LocalU) >= uperiod/2.)
{
if (LocalU > U0)
usens = -1;
else
usens = 1;
}
if (vperiod > 0. && Abs(V0 - LocalV) >= vperiod/2.)
{
if (LocalV > V0)
vsens = -1;
else
vsens = 1;
}
U0 = LocalU; V0 = LocalV;
U1 = U0 + usens*uperiod;
V1 = V0 + vsens*vperiod;
Pts2d(i).SetCoord(U1,V1);
myProjIsDone = Standard_True;
}
}
}
}
if(!myProjIsDone && uperiod) {
Standard_Real Uinf, Usup, Uaux;
Uinf = Surf->Surface().FirstUParameter();

View File

@ -0,0 +1,27 @@
puts "============"
puts "OCC24633"
puts "============"
puts ""
#######################################################################
# Incorrect projection of a curve on a surface
#######################################################################
restore [locate_data_file bug24633_comp_49.brep] a
explode a
mkcurve c a_1
mksurface s a_2
pcurve a_2
project prj c s
set prj_length [lindex [length prj] end]
set good_length 7.2662499016218058
checkreal "prj_length" ${prj_length} ${good_length} 0.01 0.01
#v2d2
view 1 -2D- 728 20 400 400
2dfit
set only_screen_axo 1

View File

@ -0,0 +1,27 @@
puts "============"
puts "OCC24633"
puts "============"
puts ""
#######################################################################
# Incorrect projection of a curve on a surface
#######################################################################
restore [locate_data_file bug24633_comp_50.brep] a
explode a
mkcurve c a_1
mksurface s a_2
pcurve a_2
project prj c s
set prj_length [lindex [length prj] end]
set good_length 7.2662499016218058
checkreal "prj_length" ${prj_length} ${good_length} 0.01 0.01
#v2d2
view 1 -2D- 728 20 400 400
2dfit
set only_screen_axo 1