Getting points on a loop

Can anybody tell me how to get(the coordinates of) a particular no. of regularly spaced points on a loop or a curve.
thanx in advance

Rob Bachrach's picture

Check out GCPnts_UniformAbscissa

Siddhartha's picture

Hi Rob
Thanx for being for so helpful and replying promptly.
Your opinion of using GCPnts_UniformAbscissa for getting the points on loop seems to be useful but there is a small problem.
The loop which am intended to work upon is obtained from BRepAlgo_Section.So there is some problem with the 'type' of the loop.
The following error is occuring;
--------------------Configuration: box - Win32 Debug--------------------
D:\naga\CODE\siddhartha\box\boxDoc.cpp(353) : error C2665: 'GCPnts_UniformAbscissa::GCPnts_UniformAbscissa' : none of the 10 overloads can convert parameter 1 from type 'class BRepAlgo_Section'
Error executing cl.exe.

box.exe - 1 error(s), 0 warning(s)
Please guide me to some way to do a type cast or another function which can give the ouput in a desired type.

Rob Bachrach's picture

According to the documentation, GCPnts_UniformAbscissa takes an Adaptor3d_Curve (or 2D) which can be created from a Geom_Curve. BRepAlgo_Section (by the way, you should use BRepAlgoAPI_Section) creates a TopoDS_Shape. This shape could contain many edges, each of which contains a curve. You would need to iterate through all the edges of the shape (TopExp_Explorer), get the curve from each edge (BRep_Tool::Curve), create an Adaptor3d_Curve from the resulting curve, and then call GCPnts_UniformAbscissa. If you need to get the points in order around the loop, you could use TopExp_Explorer to explore the wires of the section shape and then either use a BRepTools_WireExplorer or traverse the wire manually to get the edges in order and use the process above. If your uniform distance needs to nicely transition from edge to edge, you may need to ignore GCPnts_UniformAbscissa and do it all manually.