Tuesday, April 24, 2012

multiple spirals


import rhinoscriptsyntax as rs
from math import *
import random


a = 5
points = []
for i in range(0,40):
    x = a* 100/(i+1) * sin(pi/4*i)
    y = a * 100/(i+1) * cos(pi/4*i)
    z = i*5
    
    points.append([x,y,z]) 
curve = rs.AddCurve(points)
rotatedcurves = []
numberofcurves = 5


for i in range(0,5):
    rotatedcurves.append(rs.RotateObject(curve,[0,0,0],360/numberofcurves*i,None,True))
divisions = 20
radius = 2




for j in range (0,len(rotatedcurves)):
    circles = []
    for i in range(divisions+1):
        parameter = i / divisions 
        evaluationparam = rs.CurveParameter(rotatedcurves[j],parameter)
        perpframe = rs.CurvePerpFrame(rotatedcurves[j],evaluationparam)
        circles.append(rs.AddCircle(perpframe,radius+i/4+random.randint(1,10)))
        
    
    rs.AddLoftSrf(circles)

No comments:

Post a Comment