Thursday, August 27, 2009

Dividing a curve


import py2rhino as p2r

#------------------------------------------------------------------------------
#globals
points = ((0,0,0), (10,0,0), (5,5,0))
#------------------------------------------------------------------------------
elp = p2r.obj.Ellipse.create_by_3pt(points[0], points[1], points[2])

#------------------------------------------------------------------------------
#METHOD 1
domain = elp.prop.domain()
domain_range = domain[1] - domain[0]
step = domain_range / 10.0

for i in range(10):
param_t = step * i
pnt = elp.eval.evaluate(param_t)
p2r.obj.Sphere.create(pnt, 0.3)

#------------------------------------------------------------------------------
#METHOD 2
points = elp.func.divide_crv(10)

for pnt in points:
p2r.obj.Sphere.create(pnt, 0.3)

print "done"

No comments:

Post a Comment