Bspline-Curves Parametrization

Dear All,
How can I set the parameter of a bspline curve from arbitrary u0 to u1?
Actually I have a bspline curve which its parameter defined from 1 to 105 and I want it to be from 1 to 100 or 0 to 1.

Regards,

Benjamin Bihler's picture

Hello,

I don't know how to do that. But for me it is not necessary, since there are several methods that allow you to use curves without depending on their parameterization.

- CPnts_AbscissaPoint::Length(GeomAdaptor_Curve(curve), parameter1, parameter2); computes the length of the curve between two curve points with the given parameters.
- CPnts_AbscissaPoint pointOnCurveAlgorithm(curve, distance, referenceParameter, Precision::Confusion()); computes the parameter of a curve point in a certain distance from a reference curve point given by its parameter. Use pointOnCurveAlgorithm.Parameter() to get this value.
- The parameter of a given point in space with respect to a curve can be found by projecting. Check ShapeAnalysis_Curve for that.

I hope that this helps.

Benjamin

Mauro Mariotti's picture

You can apply a linear transformation to the knots, the curve will not change.
So you just have to
1) get the knots, by
void Geom_BSplineCurve::Knots (TColStd_Array1OfReal &K) const
2) transform them
3) set the new knots, by
void Geom_BSplineCurve::SetKnots (const TColStd_Array1OfReal &K)

Regards.
Mauro

akbari1358_31365's picture

Thank you Mauro,

That's the right solution man.

Regards,
Akbari

Benjamin Bihler's picture

I still wonder why someone would like to do that. Some time before, I had also written code that relied on the parameterization of curves. When curves have natural parameterization this is handy because the interpolation parameter is equivalent to the length.

But my code did not work with arbitrarily parameterized curves, so it was very inflexible. I have changed that and now my code is much more flexible and convenient to use.

Benjamin