3D modeling & numerical simulation

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

computing the normal of a curve fails ( using BRepLProp_CLProps | GeomLProp_CLProps )
 jelle 2009/05/28 16:07 Hi, 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? Thanks, -jelle
 Charles McCreary 2010/01/22 03:10 Likewise. Anybody?
 Steph 2011/01/05 13:50 Same for me. It crash when trying to compute the Normal vector of a TopoDS_Edge.
 Game Milky 2013/03/22 18:21 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! Regards Game
 Mikkel Nøhr Løvgreen 2014/12/05 12:20 Hi, 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 vTan.Normalize(); uTan.Normalize(); // 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