How to insert a control point into a existing bspline curve?

Hi All,

I want to edit a bspline curve/surface by dragging, adding or removing the control points. I've searched lots of materials, and there are no more information about adding or removing control points. There are lots of knots inserting and removing algorithms and APIs, but knots' operations are not intuitive. I remember some CAD software have the ability to add or remove control points rationally.
Does anybody have any idea? Any suggestion or paper reference is welcome. Thanks in advance.

Ding

PG's picture

hi, picked from Test harness fucntions:
try this commands, cmovep,insertpole,etc.
------------------------------------
Handle(Geom_BSplineCurve) G2 = DrawTrSurf::GetBSplineCurve(a[1]);
if (!G2.IsNull()) {
gp_Pnt P = G2->Pole(Index);
P.SetCoord(P.X()+dx, P.Y()+dy, P.Z()+dz);
G2->SetPole(Index,P);
Draw::Repaint();
return 0;
}

reg
-PG

Cauchy Ding's picture

Hi PG,

Thanks for your suggestion. However, the insertpole is only applied to bezier curve. Thank you all the same.

Ding

Komal's picture

use InsertKnot function three times...!

Cauchy Ding's picture

Hi Komal,

Would you please explain it more? The key of InsertKnot is how to determine a rational U parameter.
Thanks in advance.

Ding

Komal's picture

Lets suppose i want to insert knot in Bspline curve. Lets suppose its linear dimension is from 0 to 1 & i want to insert knot at .8. u need to calculate .8 location on curve then i used below code. Bspline got knot inserted with tangents...

ld_KnotVal = .8;
go_BSplineOutlineCrv->InsertKnot(ld_KnotVal);
go_BSplineOutlineCrv->InsertKnot(ld_KnotVal);
go_BSplineOutlineCrv->InsertKnot(ld_KnotVal);

Hope this helps?
-Komal

Sharjith Naramparambath's picture

Does inserting knots make the same sense as inserting control points? Mathematically, knots only influence the control/behavoir of control points over a particular region of the curve and knots are not control points themselves. Inserting control points can effectively change the shape of the curve but inserting knots don't. They (knots) only provide finer control over the shape of the curve when the control points are moved. From what has been provided by the API, the only way to have more/less control points is to construct a fresh B-Spline with the list of control points with the newly inserted/removed points. Modification of existing points in terms of position is possible though.