mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-09 18:50:54 +03:00
0025892: Wrong result obtained by projection algorithm.
1) Treatment of case when projection algorithm to BSpline surface return null 2d curve. 2) Changed approximation of next step in default projection algorithm. 3) Special handling of surface of revolution added. "Period jump" handling evaded in case when curve not computed. Test cases for issue CR25892 Small correction of test cases fot CR25892
This commit is contained in:
parent
4e2914a6a0
commit
1cdee2a613
@ -767,7 +767,7 @@ void ProjLib_CompProjectedCurve::Init()
|
||||
|
||||
t = Triple.X() + Step;
|
||||
if (t > LastU) t = LastU;
|
||||
|
||||
Standard_Real prevStep = Step;
|
||||
Standard_Real U0, V0;
|
||||
gp_Pnt2d aLowBorder(mySurface->FirstUParameter(),mySurface->FirstVParameter());
|
||||
gp_Pnt2d aUppBorder(mySurface->LastUParameter(), mySurface->LastVParameter());
|
||||
@ -776,8 +776,8 @@ void ProjLib_CompProjectedCurve::Init()
|
||||
while (t <= LastU && new_part)
|
||||
{
|
||||
|
||||
U0 = Triple.Y() + (Triple.Y() - prevTriple.Y());
|
||||
V0 = Triple.Z() + (Triple.Z() - prevTriple.Z());
|
||||
U0 = Triple.Y() + (Step / prevStep) * (Triple.Y() - prevTriple.Y());
|
||||
V0 = Triple.Z() + (Step / prevStep) * (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()]
|
||||
@ -837,9 +837,27 @@ void ProjLib_CompProjectedCurve::Init()
|
||||
// Go further
|
||||
else
|
||||
{
|
||||
prevTriple = Triple;
|
||||
prevTriple = Triple;
|
||||
prevStep = Step;
|
||||
Triple = gp_Pnt(t, aPrjPS.Solution().X(), aPrjPS.Solution().Y());
|
||||
|
||||
if (mySurface->GetType() == GeomAbs_SurfaceOfRevolution &&
|
||||
(Abs (Triple.Z() - mySurface->FirstVParameter()) < Precision::Confusion() ||
|
||||
Abs (Triple.Z() - mySurface->LastVParameter() ) < Precision::Confusion() ))
|
||||
{
|
||||
// Go out from possible attraktor.
|
||||
|
||||
Standard_Real U,V;
|
||||
InitialPoint(myCurve->Value(t), t, myCurve, mySurface, myTolU, myTolV, U, V);
|
||||
if (Abs (Abs(U - Triple.Y()) - mySurface->UPeriod()) < Precision::Confusion())
|
||||
{
|
||||
// Handle period jump.
|
||||
U = Triple.Y();
|
||||
}
|
||||
Triple.SetY(U);
|
||||
Triple.SetZ(V);
|
||||
}
|
||||
|
||||
if((Triple.X() - mySequence->Value(myNbCurves)->Value(mySequence->Value(myNbCurves)->Length()).X()) > 1.e-10)
|
||||
mySequence->Value(myNbCurves)->Append(Triple);
|
||||
if (t == LastU) {t = LastU + 1; break;}//return;
|
||||
@ -854,7 +872,7 @@ void ProjLib_CompProjectedCurve::Init()
|
||||
Step = WalkStep;
|
||||
t += Step;
|
||||
if (t > (LastU-MinStep/2) )
|
||||
{
|
||||
{
|
||||
Step =Step+LastU-t;
|
||||
t = LastU;
|
||||
}
|
||||
|
@ -332,6 +332,7 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
|
||||
Standard_Real LastPar = C->LastParameter();
|
||||
GeomAbs_SurfaceType SType = mySurface->GetType();
|
||||
GeomAbs_CurveType CType = myCurve->GetType();
|
||||
Standard_Boolean isAnalyticalSurf = Standard_True;
|
||||
|
||||
switch (SType)
|
||||
{
|
||||
@ -384,6 +385,7 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
|
||||
case GeomAbs_BezierSurface:
|
||||
case GeomAbs_BSplineSurface:
|
||||
{
|
||||
isAnalyticalSurf = Standard_False;
|
||||
Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
|
||||
Standard_Integer SingularCase[2];
|
||||
Standard_Real f, l, dt;
|
||||
@ -431,34 +433,38 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
|
||||
|
||||
Handle(Geom2d_BSplineCurve) aRes = polar.BSpline();
|
||||
|
||||
if(IsTrimmed[0] || IsTrimmed[1])
|
||||
if (!aRes.IsNull())
|
||||
{
|
||||
if(IsTrimmed[0])
|
||||
if( (IsTrimmed[0] || IsTrimmed[1]))
|
||||
{
|
||||
//Add segment before start of curve
|
||||
f = myCurve->FirstParameter();
|
||||
ExtendC2d(aRes, f, -dt, U1, U2, V1, V2, 0, SingularCase[0]);
|
||||
if(IsTrimmed[0])
|
||||
{
|
||||
//Add segment before start of curve
|
||||
f = myCurve->FirstParameter();
|
||||
ExtendC2d(aRes, f, -dt, U1, U2, V1, V2, 0, SingularCase[0]);
|
||||
}
|
||||
if(IsTrimmed[1])
|
||||
{
|
||||
//Add segment after end of curve
|
||||
l = myCurve->LastParameter();
|
||||
ExtendC2d(aRes, l, dt, U1, U2, V1, V2, 1, SingularCase[1]);
|
||||
}
|
||||
Handle(Geom2d_Curve) NewCurve2d;
|
||||
GeomLib::SameRange(Precision::PConfusion(), aRes,
|
||||
aRes->FirstParameter(), aRes->LastParameter(),
|
||||
FirstPar, LastPar, NewCurve2d);
|
||||
aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
|
||||
}
|
||||
if(IsTrimmed[1])
|
||||
{
|
||||
//Add segment after end of curve
|
||||
l = myCurve->LastParameter();
|
||||
ExtendC2d(aRes, l, dt, U1, U2, V1, V2, 1, SingularCase[1]);
|
||||
}
|
||||
Handle(Geom2d_Curve) NewCurve2d;
|
||||
GeomLib::SameRange(Precision::PConfusion(), aRes,
|
||||
aRes->FirstParameter(), aRes->LastParameter(),
|
||||
FirstPar, LastPar, NewCurve2d);
|
||||
aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
|
||||
myResult.SetBSpline(aRes);
|
||||
myResult.Done();
|
||||
myResult.SetType(GeomAbs_BSplineCurve);
|
||||
}
|
||||
myResult.SetBSpline(aRes);
|
||||
myResult.Done();
|
||||
myResult.SetType(GeomAbs_BSplineCurve);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
isAnalyticalSurf = Standard_False;
|
||||
Standard_Boolean IsTrimmed[2] = {Standard_False, Standard_False};
|
||||
Standard_Real Vsingular[2] = {0.0 , 0.0}; //for surfaces of revolution
|
||||
Standard_Real f = 0.0, l = 0.0, dt = 0.0;
|
||||
@ -546,39 +552,44 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
|
||||
|
||||
Handle(Geom2d_BSplineCurve) aRes = appr.Curve2d();
|
||||
|
||||
if(IsTrimmed[0] || IsTrimmed[1])
|
||||
if (!aRes.IsNull())
|
||||
{
|
||||
// Treatment only for surface of revolution
|
||||
Standard_Real u1, u2, v1, v2;
|
||||
u1 = mySurface->FirstUParameter();
|
||||
u2 = mySurface->LastUParameter();
|
||||
v1 = mySurface->FirstVParameter();
|
||||
v2 = mySurface->LastVParameter();
|
||||
if(IsTrimmed[0] || IsTrimmed[1])
|
||||
{
|
||||
// Treatment only for surface of revolution
|
||||
Standard_Real u1, u2, v1, v2;
|
||||
u1 = mySurface->FirstUParameter();
|
||||
u2 = mySurface->LastUParameter();
|
||||
v1 = mySurface->FirstVParameter();
|
||||
v2 = mySurface->LastVParameter();
|
||||
|
||||
if(IsTrimmed[0])
|
||||
{
|
||||
//Add segment before start of curve
|
||||
ExtendC2d(aRes, f, -dt, u1, u2, Vsingular[0], v2, 0, 3);
|
||||
if(IsTrimmed[0])
|
||||
{
|
||||
//Add segment before start of curve
|
||||
ExtendC2d(aRes, f, -dt, u1, u2, Vsingular[0], v2, 0, 3);
|
||||
}
|
||||
if(IsTrimmed[1])
|
||||
{
|
||||
//Add segment after end of curve
|
||||
ExtendC2d(aRes, l, dt, u1, u2, v1, Vsingular[1], 1, 4);
|
||||
}
|
||||
Handle(Geom2d_Curve) NewCurve2d;
|
||||
GeomLib::SameRange(Precision::PConfusion(), aRes,
|
||||
aRes->FirstParameter(), aRes->LastParameter(),
|
||||
FirstPar, LastPar, NewCurve2d);
|
||||
aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
|
||||
}
|
||||
if(IsTrimmed[1])
|
||||
{
|
||||
//Add segment after end of curve
|
||||
ExtendC2d(aRes, l, dt, u1, u2, v1, Vsingular[1], 1, 4);
|
||||
}
|
||||
Handle(Geom2d_Curve) NewCurve2d;
|
||||
GeomLib::SameRange(Precision::PConfusion(), aRes,
|
||||
aRes->FirstParameter(), aRes->LastParameter(),
|
||||
FirstPar, LastPar, NewCurve2d);
|
||||
aRes = Handle(Geom2d_BSplineCurve)::DownCast(NewCurve2d);
|
||||
|
||||
myResult.SetBSpline(aRes);
|
||||
myResult.Done();
|
||||
myResult.SetType(GeomAbs_BSplineCurve);
|
||||
}
|
||||
|
||||
myResult.SetBSpline(aRes);
|
||||
myResult.Done();
|
||||
myResult.SetType(GeomAbs_BSplineCurve);
|
||||
}
|
||||
}
|
||||
if ( !myResult.IsDone())
|
||||
|
||||
if ( !myResult.IsDone() && isAnalyticalSurf)
|
||||
{
|
||||
// Use advanced analytical projector if base analytical projection failed.
|
||||
ProjLib_ComputeApprox Comp( myCurve, mySurface, myTolerance);
|
||||
myResult.Done();
|
||||
|
||||
@ -602,8 +613,7 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C)
|
||||
}
|
||||
myTolerance = Comp.Tolerance();
|
||||
}
|
||||
|
||||
else
|
||||
else if (myResult.IsDone())
|
||||
{
|
||||
// On remet arbitrairement la tol atteinte a une valeur
|
||||
// petite en attendant mieux. dub lbo 11/03/97
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
ProjLib_Projector::ProjLib_Projector()
|
||||
{
|
||||
isDone = Standard_False;
|
||||
myType = GeomAbs_BSplineCurve;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#puts "TODO OCC12345 ALL: An exception was caught"
|
||||
#puts "TODO OCC12345 ALL: \\*\\* Exception \\*\\*.*"
|
||||
puts "TODO OCC12345 ALL: TEST INCOMPLETE"
|
||||
puts "TODO OCC12345 ALL: xception"
|
||||
#puts "TODO OCC12345 ALL: TEST INCOMPLETE"
|
||||
#puts "TODO OCC12345 ALL: xception"
|
||||
puts "TODO OCC25892 ALL: Faulty shapes in variables"
|
||||
puts "TODO OCC25892 ALL: The square of result shape is"
|
||||
|
||||
puts "========================"
|
||||
puts " OCC469 "
|
||||
|
20
tests/bugs/moddata_3/bug25892_01
Normal file
20
tests/bugs/moddata_3/bug25892_01
Normal file
@ -0,0 +1,20 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c001] c
|
||||
restore [locate_data_file bug25892_f001] f
|
||||
|
||||
mksurface s f
|
||||
|
||||
catch {project cx c s}
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
20
tests/bugs/moddata_3/bug25892_02
Normal file
20
tests/bugs/moddata_3/bug25892_02
Normal file
@ -0,0 +1,20 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c002] c
|
||||
restore [locate_data_file bug25892_f002] f
|
||||
|
||||
mksurface s f
|
||||
|
||||
catch {project cx c s}
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_03
Normal file
18
tests/bugs/moddata_3/bug25892_03
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c003] c
|
||||
restore [locate_data_file bug25892_s003] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_04
Normal file
18
tests/bugs/moddata_3/bug25892_04
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c004] c
|
||||
restore [locate_data_file bug25892_s004] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_05
Normal file
18
tests/bugs/moddata_3/bug25892_05
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c005] c
|
||||
restore [locate_data_file bug25892_s005] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_06
Normal file
18
tests/bugs/moddata_3/bug25892_06
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c006] c
|
||||
restore [locate_data_file bug25892_s006] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_07
Normal file
18
tests/bugs/moddata_3/bug25892_07
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c007] c
|
||||
restore [locate_data_file bug25892_s007] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_08
Normal file
18
tests/bugs/moddata_3/bug25892_08
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c008] c
|
||||
restore [locate_data_file bug25892_s008] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_09
Normal file
18
tests/bugs/moddata_3/bug25892_09
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c009] c
|
||||
restore [locate_data_file bug25892_s009] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_10
Normal file
18
tests/bugs/moddata_3/bug25892_10
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c010] c
|
||||
restore [locate_data_file bug25892_s010] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_11
Normal file
18
tests/bugs/moddata_3/bug25892_11
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c011] c
|
||||
restore [locate_data_file bug25892_s011] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_12
Normal file
18
tests/bugs/moddata_3/bug25892_12
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c012] c
|
||||
restore [locate_data_file bug25892_s012] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_13
Normal file
18
tests/bugs/moddata_3/bug25892_13
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c013] c
|
||||
restore [locate_data_file bug25892_s013] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
18
tests/bugs/moddata_3/bug25892_14
Normal file
18
tests/bugs/moddata_3/bug25892_14
Normal file
@ -0,0 +1,18 @@
|
||||
puts "============"
|
||||
puts "OCC25892"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Wrong result obtained by projection algorithm.
|
||||
#######################################################################
|
||||
|
||||
restore [locate_data_file bug25892_c014] c
|
||||
restore [locate_data_file bug25892_s014] s
|
||||
|
||||
project cx c s
|
||||
|
||||
#v2d2
|
||||
view 1 -2D- 728 20 400 400
|
||||
|
||||
2dfit
|
||||
set only_screen_axo 1
|
Loading…
x
Reference in New Issue
Block a user