Curvature.Kappa questions

Hi,

It was my understanding that Surface.Curvature.Kappa(0) will return the highest found curvature and Kappa(1) the lowest.

So if I want to find the highest curvature and its direction on the surface I’d get Surface.Curvature.Kappa(0) and Surface.Curvature.Direction(0).

However this implementation gave me an unexpected result and looking at the documentation on Surface.Curvature I found the python example to imply that Kappa(0) will give curvature in U direction.
See this page:
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_SurfaceCurvature_Kappa.htm

the python example in question:

import rhinoscriptsyntax as rs

surface_id,_,_,_,_,_ = rs.GetSurfaceObject("Select surface for curvature measurement")
point = rs.GetPointOnSurface(surface_id, 
    "Select point on surface for curvature measurement")
u,v = rs.SurfaceClosestPoint(surface_id, point)

#point, normal, kappa_u, direction_u, kappa_v, direction_v, gaussian, mean =
surface_curvature = rs.SurfaceCurvature(surface_id, (u,v))

point, normal, kappa_u, direction_u, kappa_v, direction_v, gaussian, mean = surface_curvature

print "Surface curvature evaluation at parameter: ({0}, {1})".format(u,v)

print "  3-D Point: ({0}, {1}, {2})".format(point.X, point.Y, point.Z)

print "  3-D Normal: ({0}, {1}, {2})".format(normal.X, normal.Y, normal.Z)

print "  Maximum principal curvature: {0} ({1}, {2}, {3})".format(
  kappa_u, direction_u.X, direction_u.Y, direction_u.Z)

print "  Minimum principal curvature: {0} ({1}, {2}, {3})".format(
  kappa_v, direction_v.X, direction_v.Y, direction_v.Z)

print "  Gaussian curvature: {0}".format(gaussian)
print "  Mean curvature: {0}".format(mean)

for reference the rhinoscriptsyntax method SurfaceCurvature():

def SurfaceCurvature(surface_id, parameter):
    """Returns the curvature of a surface at a U,V parameter. See Rhino help
    for details of surface curvature
    Parameters:
      surface_id (guid): the surface's identifier
      parameter (number, number): u,v parameter
    Returns:
      tuple(point, vector, number, number, number, number, number): of curvature information
        [0]   point at specified U,V parameter
        [1]   normal direction
        [2]   maximum principal curvature
        [3]   maximum principal curvature direction
        [4]   minimum principal curvature
        [5]   minimum principal curvature direction
        [6]   gaussian curvature
        [7]   mean curvature
      None: if not successful, or on error
    Example:
      import rhinoscriptsyntax as rs
      srf = rs.GetObject("Select a surface", rs.filter.surface)
      if rs.IsSurface(srf):
          point = rs.GetPointOnSurface(srf, "Pick a test point")
          if point:
              param = rs.SurfaceClosestPoint(srf, point)
              if param:
                  data = rs.SurfaceCurvature(srf, param)
                  if data:
                      print "Surface curvature evaluation at parameter", param, ":"
                      print " 3-D Point:", data[0]
                      print " 3-D Normal:", data[1]
                      print " Maximum principal curvature:", data[2], " ", data[3]
                      print " Minimum principal curvature:", data[4], " ", data[5]
                      print " Gaussian curvature:", data[6]
                      print " Mean curvature:", data[7]
    See Also:
      CurveCurvature
    """
    surface = rhutil.coercesurface(surface_id, True)
    if len(parameter)<2: return scriptcontext.errorhandler()
    c = surface.CurvatureAt(parameter[0], parameter[1])
    if c is None: return scriptcontext.errorhandler()
    return c.Point, c.Normal, c.Kappa(0), c.Direction(0), c.Kappa(1), c.Direction(1), c.Gaussian, c.Mean

I’m going to scutinize my code because it could very well be I’m in the wrong somewhere else, but I wanted to bring this up, at least to maybe correct the python example to avoid confusion.

Thanks
-Willem