how to get the curvatures on a curve

Hi guys,

I am trying to get the curvatures value of a a curve, what should I use? anywa ideas?

Thanks for your help!

JeanmiB's picture

Hello,

You can have a look at GeomLProp_CLProps class and LProp_CLProps.

Regards.

Jean Michel.

wyiya's picture

can anyone show how to use the function LProp_CLProps::curvatures().
i try to use it as the function ::mass() but it's wrong.

Rob Bachrach's picture

Try this (note-curvature requires the first & second derivatives). "u" should be set to the parameter along the curve where you want the curvature.

GeomLProp_CLProps props(myCurve, 2);
props.SetParameter(u);
Standard_Real curvature = props.Curvature();

Note the exception of LProp_NotDefined. This can happen if the curvature can not be computed at the specified parameter.

Don't use LProp_CLProps directly. It is a base class intended to be used from its derived classes like GeomLProp_CLProps and BRepLProp_CLProps.

wyiya's picture

TopoDS_Edge E;
E = TopoDS::Edge(aShape);

Standard_Real First;
Standard_Real Last;
Handle(Geom_Curve) myCurve =BRep_Tool::Curve (E, First, Last);

GeomLProp_CLProps props(myCurve, 2);
// props.SetParameter(u);
Standard_Real mycurvature = props.Curvature();
i want to select a edge and gain its curvature,but the code don't work.
error:C:\OpenCASCADE5.1\projects\STViewer\STViewerDoc.cpp(1009) : error C2664: '__thiscall GeomLProp_CLProps::GeomLProp_CLProps(const int,const double)' : cannot convert parameter 1 from 'class Handle_Geom_Curve' to 'const int'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

help me ,,thanks in advance!!

John W's picture

hi wyiya,

GeomLProp_CLProps props(myCurve, 2);
you have used it incorrectly

GeomLProp_CLProps (const Handle(Geom_Curve)& C,
const Standard_Integer N,
const Standard_Real Resolution);

and I think you are missing one of the parameter

or

you might have used a wrong type

GeomLProp_CLProps (const Standard_Integer N,
const Standard_Real Resolution);

hope this helps

good luck

wyiya's picture

thanks John W:
i edit the code.
Standard_Real Resolution;

GeomLProp_CLProps props(myCurve, 2,Resolution);

Standard_Real mycurvature = props.Curvature();

TCollection_AsciiString string("Curvature of the selected edge :");
TCollection_AsciiString string1(" Curvature=");
string +="\n";
string += string1;
string1 = props.Curvature();

it's successful to execute.but it don't output the Curvature when i select a edge (line or circle). any idea? thanks^

wyiya's picture

i think the key is how to deal with the current point,in the other woed , how to deal with the parameter U. i'm not sure.