A lot of control points

Hi All,
I made a bspline from 18 control points (Poles). And then I made a topods_Edge from this bspline curve.
When I approximate this topods_edge to a bspline curve even by removing some knots, it had 65 control points. Is there any way to find the bspline curve from topods_edge that has the least control points?
Regards,
Akbari

Vaclav Smilauer's picture

If you want just getting the underlying geometry back, have a look at BRep_Tool. Like this:

Standard_Real p1,p2;
Handle(Geom_BSplineCurve) curve=Handle(Geom_BSplineCurve)::DownCast(BRep_Tool::Curve(edge,p1,p2));

Tony's picture

Hi Sir,
Thanks for your response.
You are right, but it doesn't help reduce the control points of the curve. I mean is there any advance method to reduce them by some method like iteration?
Regards,
Tony

Vaclav Smilauer's picture

I think that an edge created from 18-cp bspline will keep _that_ bspline in itself; if you get it back by BRep_Tool, it should be a completely identical spline.

If you still want to reduce number of control points, have a look at GeomConvert_ApproxCurve. You can specify maximum degree and maximum segments in the constructor. (That's what I use to make a wire with multiple edges into C2-continuous curve; it works very well).

Regards, Vaclav

Tony's picture

Hi Smilauer,
Thanks for your response.
This way I should initialize segments, if i take it less than the value the result will be wrong. do you have any recommendation about initializing the segments in GeomConvert_ApproxCurve?
Regards,
Tony