4 posts
BrunoF (brunofletcher) wrote:
Hi ,
I'm calling rs.SurfaceCurvature() in python to obtain the surface normal vector at a particular point at a surface. After rendering the normal vector (see code below), the normal vector seems to be always pointing in the same direction, even if the surface is flipped via the command "dir" or its python equivalent. The vector is definitely normal to the surface, but it does not particularly point in the correct direction...
@stevebaer, is this the expected behavior? Or is this a bug?
import rhinoscriptsyntax as rs
srf = rs.GetObject("Select a surface", rs.filter.surface)
def renderVector(vecdir, base_point):
tip_point = rs.PointAdd(base_point, vecdir)
line = rs.AddLine(base_point, tip_point)
if line: return rs.CurveArrows(line, 2)
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]
renderVector(data[1], data[0])
I don't know if this is pertinent info, but the particular surface that I'm observing this was created with 4 edges using rs.AddEdgeSrf().
Thanks,
Bruno