Getting geometric points from TopoDS_Edge

Is there a way to get the geometric points from a curved TopoDS_Edge? I know I can use TopExp_Explorer to get the endpoints, but I want to get the geometric coordinates of a series of intermediate points by a certain tolerance.

Arjan Schouten's picture

Hello Sam,

CheckOut GCPnts_UniformAbscissa

BRepAdaptor_Curve curveAdaptor;
curveAdaptor.Initialize(yourEdge);

GCPnts_UniformAbscissa uniformAbscissa;
uniformAbscissa.Initialize(curveAdaptor, yourTolerance);

if(uniformAbscissa.IsDone())
{
}

Sam Shrum's picture

Hi Arjan,

I think I'm missing something. Are there any initializers which take only the curve adaptor and the tolerance? It looks like they all require either a NbPoints value or Abscissa value; I don't know ahead of time how many points I want (I need them within a physical tolerance, however many that requires), nor do I understand what the Abscissa value would be.

However if I understand correctly, could I then get the points out via something like this?

Standard_Real parameter = uniformAbscissa.Parameter(i);
gp_Pnt p = curveAdaptor.Value(parameter);

Thanks!

Arjan Schouten's picture

Hi Sam,

My mistake, I confused tolerance with abscissa.

If you use it like,

GCPnts_UniformAbscissa uniformAbscissa;
uniformAbscissa.Initialize(curveAdaptor, 5.0);

it will generate points evenly spaced at 5mm along your edge.

You then loop through the number of generated points.

Kind Regards,

Arjan

Sam Shrum's picture

Hi Arjan,

That makes sense, but what's the call to get each point out? The function "Parameter" returns a double/Standard_Real, but I don't really understand what it's in terms of- is it a U or V parameter I can use to get a point? Is there a function I'm missing that returns a geometric point?

Thanks!