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
Half length curve
Re: Half length curve
This should work:
Use
if you need to keep the original curve
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
Code: Select all
IObject_DG obj = curve.As<IObject_DG>();
IObject_DG objClone = obj.Clone();
ICurve_DG curveClone = objClone.As<ICurve_DG>();