How to get length of line

So I iterator through the edges of a face using the TopExp_Explorer object and for each edge I get a Geom_Curve via BRep_Tool::Curve(...) call. I then use a GeomAdapter_Curve object to get the type of curve which is used in a switch statement. In the case of a line I can get the position of the line as well as a direction but the direction is always normalized. How do I find out the length of the line? I use GeomAdaptor_Curve::Line() function to get a gp_Lin object. Thanks.

me_dulanga's picture

U can get the fist point & the last point
then calculate the length

nitchman2383's picture

Thank you!

Artem Mishenkov's picture

Hello, this link doesn't work for me, can you please tell me how I can find the first and last point for the gp_Lin object?

Benjamin Bihler's picture

I compute the length of curves like this:

CPnts_AbscissaPoint::Length(curve, parameter1, parameter2, 1.0e-4);


Eugene Zaliznyak's picture

Sorry, but length of a line is INFINITE )

Mikhail Sazonov's picture

Compute edge length?

Way 1.

  double length = CPnts_AbscissaPoint::Length(BRepAdaptor_Curve(edge));


  GProp_GProps props;
  BRepGProp::LinearProperties(edge, props);
  double length = props.Mass();