Rhinocommon- Surface Curvature Calculation

I am using rhinocommon C# for a development project.

  1. I need to know how principle Curvature for a surface is calculated in rhino.
  2. Am only able to extract mean and gauss curvature for any point on a surface (using CurvatureAt function).
    but i further need the direction of principle curvatures for my calculations.
    Can anyone help on how i can find these direction vectors. though it is available with pythonscript, its not available with rhinocommon .net

Hi,
The surface CurvatureAt method returns a SurfaceCurvature that has the direction vector.
Here is a sample: http://wiki.mcneel.com/developer/rhinocommonsamples/principalcurvature
Is that what you need?

yes. but i don’t know about which point the vector it returns is oriented. I may explain my exact problem.
I need to draw an ellipse about a center point( which i already know), such that the major axis should be oriented in the direction of maximum principle curvature of the above center point. Now, though i get this vector, its not working for me when i use it to draw the ellipse. I am using - minor radius,major radius,plane definition for constructing the ellipse where, in the plane definition i tried to define Yaxis of plane as the direction vector.
Please suggest me a solution

Hi,

I don’t know which way you want the 2nd radius of the ellipse to go but does this help?

var c = surface.CurvatureAt(u, v);
var max_princ_crv = c.Direction(0);
var min_princ_crv = c.Direction(1);
var normal = Vector3d.CrossProduct(max_princ_crv, min_princ_crv);

var xpoint = point_on_srf + max_princ_crv;
var ypoint = point_on_srf + normal;

var ell = new Ellipse(new Plane(point_on_srf, xpoint, ypoint), 4, 2);

thank you very much for the help. The issue got solved.