An exercise about Phyllotaxis variation using VB script code in Grasshopper, working on variables with a few changes of the values "i" in the math formula of spiral: x= cos(i), y=sin(i), z=i
"In mathematics, a spiral is a curve which emanates from a central point, getting progressively farther away as it revolves around the point.(via wikipedia)"
Here the VB code that plots the spiral points:
Sub RunScript(ByVal n As Integer)
'your code here…
Dim r_list As New List (Of on3dpoint)
Dim p_list As New List (Of on3dpoint)
Dim q_list As New List (Of on3dpoint)
For i As int32=1 To n
Dim r As New on3dpoint(cos(i) * i, sin(i) * i, i / 1000)
Dim p As New on3dpoint(cos(i + 0.5) * i, sin(i + 0.5) * i, i + 1 / 1000)
Dim q As New on3dpoint(cos(i) * (i + 1), sin(i) * (i + 1), i / 1000 + (i + 4))
r_list.add(r)
p_list.add(p)
q_list.add(q)
Next
A = r_list
B = p_list
C = q_list
End Sub
Download code at: http://www.co-de-it.com/wordpress/code/grasshopper-code
And the Rhinoscript code, but it's a wip...
///////
Dim i,arrpoint1,arrPoint2,strSphere
For i=0 To 500
arrPoint1 = Array(cos(i)*i,sin(i)*i,i/1000)
arrPoint2 = Array((cos(i+1)*i),(sin(i+1)*i)+1,(i+1/1000))
Rhino.AddPoint arrPoint1
Rhino.AddPoint arrPoint2
'Rhino.AddSphere arrPoint1, i*0.1
rhino.AddLine arrPoint1,arrPoint2
Next
//////////
And the Rhinoscript code, but it's a wip...
///////
Dim i,arrpoint1,arrPoint2,strSphere
For i=0 To 500
arrPoint1 = Array(cos(i)*i,sin(i)*i,i/1000)
arrPoint2 = Array((cos(i+1)*i),(sin(i+1)*i)+1,(i+1/1000))
Rhino.AddPoint arrPoint1
Rhino.AddPoint arrPoint2
'Rhino.AddSphere arrPoint1, i*0.1
rhino.AddLine arrPoint1,arrPoint2
Next
//////////
2 commenti:
Awesome!
THX Pier!
Post a Comment