GeomAPI_PointsToSpline oscillations.

Hello,

Does anyone has same oscillations whet convert set of points to b-spline by GeomAPI_PointsToSpline?

Standard_Integer nUSteps = 100;

TColgp_Array1OfPnt Points(1, nUSteps + 1);

double U1, U2;

U1 = BS->FirstParameter();
U2 = BS->LastParameter();

double dU = (U2 - U1) / nUSteps;

for (Standard_Integer i = 1; i <= nUSteps + 1; i++)
BS->D0(dU * (i - 1) + U1, Points(i));

GeomAPI_PointsToBSpline NewBSpline(Points, Approx_ParametrizationType::Approx_IsoParametric, 3, 3);
BS = NewBSpline.Curve();

red color line is original line I use for points calculation.

Attachments: 
Mikhail Sazonov's picture

The algorithm is very sensitive to ratio of neighboring segments lengths of the approximated polygon. When your input curve has non-regular parameterization the method you use to get points from it will give polygon with very large ratios. In this case in order to give uniform distribution of points you should use some tessellation algorithm, like GCPnts_UniformAbscissa.