Dynamic Drawing of BSpline Curve

Hi. Todays, I work to create BSpline Curve. In OCC example, Geometry, they use TColgp_Array1OfPnt and Geom_BSplineCurve class. So i try to make a BSpline Curve using that.

But, I have a question during making BSpline Curve.

Does TColgp_Array1OfPnt class object only allocate memory static?

I want to make it similar to CATIA. it's mean create Point dynamically. of course, first make a point and then order to make BSpline Curve, we get the BSpline curve.

But I don't want to it. do you have a idea?? if you share it, i thanks to you

have a nice day!!

Sharjith Naramparambath's picture

I do it by maintaining a dynamic list, for the coordinates, that can grow as the user clicks the screen and then create a TColgp_SequenceOfPnt and append all the points in the list. Then I use a TColgp_Array1OfPnt with range 1,nbPoints and copy points from the sequence to it and then send it to GeomAPI_PointsToBSpline. My application has an interactive dialog with a multicolumn list box that keeps track of all the points clicked/selected by the user. The list cells are editable and the user may enter coordinates manually. While the user is entering or adding points, it is stored in the dynamic list. Every event of entering the coordinate or a click on the screen or a selection of existing point forces a refresh on the curve building routine in a local AIS context. Once the user commits the Apply/Ok button on the dialog the final curve is built and displayed after closing the local contexts.

shudolf's picture

thanks to Sharjith!!!

yesterday, i study STL like List, Map and Vector etc... So I think using this class and make another class inherited by that. But, After reading your comment, it's not necessary. Very thanks you!!! But i worry about using this class because there is not explanation of these class in document. Maybe i learn to use this class by trial and error.

have a nice day~

Sharjith Naramparambath's picture

Which class do you worry using about?

shudolf's picture

I success the dynamic Drawing using by Handle_TColgp_HSequenceOfPnt. As i use this, TColgp_SequenceOfPnt doesn't have a function which return the Count of Point. Of course, it's not perfetly right. Becuase, there is a count, but It's Private member.

shudolf's picture

i worry about the TColgp_SequenceOfPnt, Because there is not explanation..

But I learn to use this classs by Trial an error.


sergey zaritchny's picture

You may easy find the explanation in HSequence from TCollection (TColgp_SequenceOfPnt
instantiates HSequence from TCollection).

shudolf's picture

Hi Regards!!!

Thanks to advice.

Sharjith Naramparambath's picture

The Length() method returns the number of points.

shudolf's picture

hi!! Sharjith

thanks! as your kind, I solve this problem

Yeon Cheol