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;