Page 1 of 1

Half length curve

Posted: Thu Jan 29, 2026 12:07 am
by Eric Holt
Hi everyone,

I am working on the task of splitting a curve in two sections of equal length. Is there any native DG Kernel functionality that can help me in this?

Thank you in advance for your help!
Regards, Eric

Re: Half length curve

Posted: Thu Jan 29, 2026 1:40 am
by VJay
This should work:

Code: Select all

ICurve_DG curve;
// ... definition of curve
double L = curve.GetLength();
double paramMiddle = curve.GetParameterAtLength(0.5*L);
RangeDg rg = curve.parameterRange;
curve.SetParameterRange(rg.Min, paramMiddle);
// Or curve.SetParameterRange(paramMiddle, rg.Max); for the other half
Use

Code: Select all

IObject_DG obj = curve.As<IObject_DG>();
IObject_DG objClone = obj.Clone();
ICurve_DG curveClone = objClone.As<ICurve_DG>();
if you need to keep the original curve