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());
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()]
// 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;
Step = WalkStep;
t += Step;
if (t > (LastU-MinStep/2) )
- {
+ {
Step =Step+LastU-t;
t = LastU;
}
Standard_Real LastPar = C->LastParameter();
GeomAbs_SurfaceType SType = mySurface->GetType();
GeomAbs_CurveType CType = myCurve->GetType();
+ Standard_Boolean isAnalyticalSurf = Standard_True;
switch (SType)
{
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;
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[1])
- {
- //Add segment after end of curve
- l = myCurve->LastParameter();
- ExtendC2d(aRes, l, dt, U1, U2, V1, V2, 1, SingularCase[1]);
+ 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);
}
- 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;
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])
- {
- //Add segment before start of curve
- ExtendC2d(aRes, f, -dt, u1, u2, Vsingular[0], v2, 0, 3);
- }
- if(IsTrimmed[1])
+ if(IsTrimmed[0] || IsTrimmed[1])
{
- //Add segment after end of curve
- ExtendC2d(aRes, l, dt, u1, u2, v1, Vsingular[1], 1, 4);
+ // 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[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);
}
- 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();
}
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