Get the new control point index which insert by ON_NurbsCurve::InsertKnot() function (c++)

Hi;
Is there a way to get the new control point index which inser by ON_NubrsCurve::InsertKnot() function ?


CRhinoGetObject go;
go.SetCommandPrompt(L"select curve");
go.SetGeometryFilter(CRhinoGetObject::curve_object);
go.GetObjects(1, 1);
if (go.CommandResult() != success)
{
	return nothing;
}
ON_NurbsCurve cur = * go.Object(0).Curve()->NurbsCurve()->Duplicate();
CRhinoGetPoint gp;
gp.SetCommandPrompt(L"get point on curve");
gp.Constrain(cur);
gp.GetPoint();
double t;
cur.GetClosestPoint(gp.Point(),&t);

// this function return a Boolean value, can not get the index of knot or control point
cur.InsertKnot(t, 1);  

RhinoApp().ActiveDoc()->ReplaceObject(go.Object(0), cur);
context.m_doc.Redraw();
return success;

Hi @suc_kiet,

Insert a knot in a cubic curve with 4 control points, and you get a result with 5 control points. The first and last stay the same (if it is not periodic). I don’t think there is a notion of which of the middle three is the new one. There’s just three where there used to be two. So, I can only suggest comparing the before and after curves.

– Dale

Hi @dale,
OK, thank you.
I have compared the control points location.