Hi,
I am confused as to why this code is not working. I believe it has to do with the fact that Rhino draws circles with radii rather than diameter. I am simply trying a simple recursion where circles are scaled by half the diameter and moved by half of the diameter. Attached is an image I made in processing.
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
a = []
x = 2
y = 0
p1 = rs.coerce3dpoint([x,y,0])
def recursiveCircle(p1, r, num): #input variables
r = 3
print r/2
p2 = rs.AddPoint(x + r, 0, 0)
a.append(p2)
cir1 = rs.AddCircle(p1, r)
a.append(cir1)
if (num > 1):
#counter
#recursive function ; needs to be diameter
recursiveCircle(p1 + rg.Point3d(x + r*.5, y, 0), r*.5, num-1)
recursiveCircle(p1, r, 2) #input parameters
I am sure that I am missing something silly. I just don’t totally understand the hierarchy of the recursive functions.
- declare the function with the variables
- call the function outside the function with parameters
- pass the outside parameters through the insider recursive function.
Thank you for the help!
Erik