computing the normal of a curve fails ( using BRepLProp_CLProps | GeomLProp_CLProps )


Something puzzling; of a planar curve, I can compute its tangent, but not its normal, if I try to do so, a LProp_NotDefined is raised.
I'm sure that the parameter is within scope, and also I initialized the *LProp_CLProps with a resolution of 1e-6, and maximum degree of 4.
Perhaps someone could enlighten me why no normal is returned, or did I stumble upon a bug?



Charles McCreary's picture

Likewise. Anybody?

Steph's picture

Same for me. It crash when trying to compute the Normal vector of a TopoDS_Edge.

Game Milky's picture

I face the same problem while computing curvature using BRepLProp_CLProps. The program crash after some where in between by dumping :

1 -0
terminate called after throwing an instance of 'LProp_NotDefined'

Any idea!

Would you help if you solve the problem!



Mikkel Nøhr Løvgreen's picture


This post is old and I don't think you still have the problem, but it seams like others are having the same issue so thought I would help out.

A 3d curve/edge do not have a normal so that is why you get a not defined response.

If you have a edge and face it is defined on you will be able to get a normal though. Actually you can get both a 2d and a 3d normal but I think it is the 3d normal you all want.

TopoDS_Edge edge;
TopoDS_Face face;
Standard_Real parameter;

Standard_Real firstParameter, lastParameter;

// First get the 2d curve of the edge on the face:
Handle_Geom2d_Curve curve2d = BRep_Tool::CurveOnSurface(edge, face, firstParameter, lastParameter);

//Then get the 2d point on the face and the surface of the face
gp_Pnt2d point2d = curve2d->Value(parameter);
Handle_Geom_Surface surface = BRep_Tool::Surface(face);

// Now you can get the tangets of the surface in the u and v directions
gp_Pnt point3d;
gp_Vec uTan, vTan;
surface->D1(point2d.X(), point2d.Y(), point3d, uTan, vTan);

// Make sure the the vectors are unit vectors

// Surface/face normals is calculated as the cross product of the tangets in the u and v direction
gp_Dir surfaceNormal = vTan.Crossed(uTan);

// There you go! The face normal on the edge at the specified parameter location

// Tip: For 2d normals see Geom2dLProp_CLProps2d

I hope it can help