curvature

i write these codes,but it can't work.when i run it , it shows "curvature =0". why?
TopoDS_Edge E;
E = TopoDS::Edge(aShape);
Standard_Real First;
Standard_Real Last;
Handle(Geom_Curve) myCurve =BRep_Tool::Curve (E, First, Last);
Standard_Real Resolution=2;
Standard_Real U;
U=0.5*First+0.5*Last;
GeomLProp_CLProps props(myCurve,U,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();
string += string1;

thanks !!

wyiya's picture

when i select a edge(line or circle), it always shows the "curvature =0". for help^

Rob Bachrach's picture

If you look in the documenation, Resolution is the null vector tolerance. In other words, if a vector magnitude is less than Resolution, it considers it to be a NULL vector (0 magnitude). 2 is probably way too big. You might want to try Precision::Confusion, or even something like 1.0e-12. See if that helps.

wyiya's picture

thanks ,,,Resolution=1.0e-12,it is ok.thanks