Friday, February 1, 2013

like i don't have anything more important to do than drawing mandelbrot set in rhino



Sub Main()
Rhino.EnableRedraw False
For x0 = -2.5 To 1 Step 0.01
rhino.Print x0  
For y0 = -1 To 1 Step 0.01
x = 0
y = 0
iteration = 0
maxIt = 1000
Do While (x*x + y*y < 2*2) And iteration < maxIt
xtemp = x*x - y*y + x0
y = 2*x*y + y0
x = xtemp
iteration =iteration  + 1
Loop
c = int(iteration / 1000 *  16777216) 
If iteration < maxIt Then
pt = rhino.addpoint(array(x0,y0,0))
Rhino.ObjectColor pt, c
End If
Next
Next
Rhino.EnableRedraw True
End Sub

2 comments: