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 Tue, 05/26/2015 - 15:17

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.

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)

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.

Tue, 05/26/2015 - 15:17

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

Tue, 05/26/2015 - 17:10

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

Mon, 06/01/2015 - 09:05

Thank you Mauro,

That's the right solution man.

Regards,

Akbari

Mon, 06/01/2015 - 11:55

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