Possible Curve.DivideByLength(Double, Boolean, Boolean) bug?

Rhino V6 SR13 / RhinoCommon

Let’s say I would like to divide an open curve into a fixed number of segments (i.e. 10) of the same length:

Curve workingCurve;

Double curveLength = workingCurve.GetLength();
Double segmentLength = curveLength / 9.0;

Calling

Double curveParams = workingCurve.DivideByLength(segmentLength , true, false);

I get 10 curve parameters, and that’s ok.
But if I call

Double curveParams = workingCurve.DivideByLength(segmentLength , true, true);

I get 9 curve parameters!
Is this a bug?

Hi @software_comas,

Can you post the curve that you are testing?

– Dale

Of course…
DivideByLength Curve.3dm (39.1 KB)

Hi @software_comas,

My guess is you are seeing a floating point rounding error. If you really want to divide the curve from end to start, make a copy of the curve and reverse it before calculating the length and then dividing.

– Dale

Thanks, @dale! :slight_smile: