End Points of a line

Hi,

I have a TopoDS_Edge and could get its underlying Geom2d_Curve. I know, that the Geom2d_Curve is a Geom2d_Line. How can I get the start and end point of this line? In the docu it says, a Geom2d_Line is infinite, but my TopoDS_Edge is not infinite. Is there any way to get my start and end points?

Thanks for any help,
Stefan

Gerard Gartside's picture

Stefan

This may not be the best way to do it but if you know the edge to be a line then use a TopExp_Explorer to explore for TopAbs_VERTEX then get the TopoDS_Vertex for each vertex. You can then get the gp_Pnt and finally the gp_XYZ, sort of like this...

for (ex.Init(E, TopAbs_VERTEX); ex.More(); ex.Next()) {

const TopoDS_Vertex &V = TopoDS::Vertex(ex.Current());
gp_Pnt pnt = BRep_Tool::Pnt(V);
gp_XYZ coord = pnt.Coord();
}

Francois Lauzon's picture

Hi Stefan,
there is a lots of tools to do stuff like you want in the class BRep_Tool. If you have your TopoDS_Edge and the TopoDS_Face or Geom_Surface on which the 2d curve is lying, you could use BRep_Tool::CurveOnSurface, and you will get the start and end parameter and the 2d curve that lie on the surface. BRep_Tool::Range could return you the range only also. Look at the class to see all the possibilities.

Good Luck,
Francois.