algorithmic modeling for Rhino
Hi,
I used python script to create a component, which can draw curvature graphic, because I want its outputs.
I did some research from [uto] post, they did a vb script component here:
http://www.grasshopper3d.com/forum/topics/curve-division-density-wi...
And here it describes how it works:
http://learn.lboro.ac.uk/ludata/cd/cad/mod_level2/section_curvature...
So when I transferred them into python script everything was fine on "Curve".
However, on "Surface", when I tried to use it on surface's iso curve, it looks different from Rhino's curvature graphic command...... I can not figure out the reason.
Anyone has suggestion? thanks~
Here are my files:
Tags:
I wonder if Rhino uses surface curvature measurements instead of isocurve curvature...
--
David Rutten
david@mcneel.com
Hi David,
I have tried as many surface curvature method as I could, but none of them fit........
methods include:
Gaussian
Mean
Kappa
SurfaceCurvature in rhinoscriptsyntax
Maximum principal curvature
Minimum principal curvature
by the way, look at this picture.... if I only use surface curvature the result doesn't seems right as well. Maybe I did some mistakes? thanks :)
Gene
import rhinoscriptsyntax as rs
import Rhino as rc
a = []
b = []
if ((u or v) is None):
u = 0.5
v = 0.5
c_u = Srf.IsoCurve(0,u)
c_v = Srf.IsoCurve(1,v)
if (Density span class="s4">2 or Density is None):
Density = 2
if Scale is None:
Scale = 6
ScaleFactor = -Scale
for i in range(0, Density+1):
Normal_u = Srf.NormalAt(i/Density, u)
su = Srf.CurvatureAt(i/Density, u)
#s = Srf.CurvatureAt(0.5, 0.5)
#print(s.Kappa(0.5))
Normal_u_length = rs.VectorLength(c_u.CurvatureAt(i/Density))
#Normal_u_length = Normal_u_length*rs.VectorLength(s.Direction(0))
Normal_u_length = Normal_u_length * su.Kappa(0.5)
Normal_u= Normal_u*Normal_u_length
#print(type(Normal_u))
Point_u = c_u.PointAt(i/Density)
a.append(Point_u)
b.append(Point_u + Normal_u*ScaleFactor)
for i in range(Density+1):
Normal_v = Srf.NormalAt(v, i/Density)
sv = Srf.CurvatureAt(v, i/Density)
Normal_v_length = rs.VectorLength(c_v.CurvatureAt(i/Density))
Normal_v_lengthTuple = rs.SurfaceCurvature(Srf, [v,i/Density])
Normal_v_length = Normal_v_length * Normal_v_lengthTuple[7]
Normal_v = Normal_v*Normal_v_length
Point_v = c_v.PointAt((i)/Density)
a.append(Point_v)
b.append(Point_v + Normal_v*ScaleFactor)
mid = int(len(b)/2)
bu = b[:mid]
bv = b[mid:]
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by