Half length curve

Everything DG Kernel: Technical discussions and issues
Post Reply
Eric Holt
Posts: 1
Joined: Thu Jan 29, 2026 12:03 am

Half length curve

Post 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
VJay
Posts: 2
Joined: Thu Aug 29, 2024 7:15 am

Re: Half length curve

Post 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
Post Reply