Grasshopper

algorithmic modeling for Rhino

Hi Guys,

 

Would you know how to create a Fibonacci sequence of spiralling squares using GH?

I have tried to use the fibonacci component available on GH to draw boxes spiraling towards the outside but didn't manage.

 

Since it is a recursive logic wouldn't it be more appropriate to script it?

 

Hope you can help,

 

Arthur

 

Views: 25717

Replies to This Discussion

It can be expressed recursively, but if you structure it in the correct manner, you can get GH to do it. There are two things that are really needed in order to get this done. The first is to properly orient the arcs. You can either do this by reorienting the planes that the arcs fall in so that the same domain actually yields different orientations, or create different domains to get the different orientations. The second thing that you need to do is change the location of the arc's center point. This is probably the most "recursive" part, but if you have the fibonacci sequence, its just some inventive multiplication, list segmentation, and mass addition to locate the points.

The attached defnition should take care of this for you, with the ability to define the number of items in the sequence along with the start point of the spiral. Enjoy.
Attachments:
Brilliant! Thanks a lot.

Someone sent me a script doing this which doesn't work with the latest Rhino:

Option Explicit

Dim fiboAnteLast ' the currently antelast value in the row
Dim fiboLast ' the currently last value in the row... See More
Dim fiboTemp ' temporary value, required for calculating the row
Dim fiboRelation ' relation between last and antelast value

Dim xPt,yPt,zPt ' first corner of cube
Dim x,y,z ' length, height and depth of box
Dim zMove ' movment of boxes in z-direction

xPt = 0
yPt = 0
zPt = 0

z = 5
zMove = 1

'-------------------------------------------------------------------------------

Sub DeleteEverything

Rhino.Command "SelAll "
Rhino.Command "Delete "

End Sub

'-------------------------------------------------------------------------------

Sub FiboValues

Dim i ' counter

'---

fiboAnteLast = 1 ' set start value of row

fiboLast = fiboAnteLast + fiboAnteLast ' calculate second value
fiboRelation = fiboLast / fiboAntelast ' calculate relation from second and first value

For i = 0 to 10
fiboTemp = fiboLast ' store the last value in the row
fiboLast = fiboTemp + fiboAntelast ' calculate the next value in the row
fiboAntelast = fiboTemp ' make the former last value the antelast value
fiboRelation = fiboLast / fiboAntelast ' calculate relation from last and antelast value

Call FiboBoxes
Next

Rhino.PrintEx " "

End Sub

'-------------------------------------------------------------------------------

Sub FiboBoxes

x = fiboLast
y = fiboAntelast

zMove = zMove + z

Rhino.Command "Box " & xPt & "," & yPt & "," & zPt & " " & x & " " & y & " " & z

Rhino.Command "SelLast "
Rhino.Command "Move 0,0,0 0,0," & 1.2 * zMove & " enter"
Rhino.Command "SelNone "

End Sub

'-------------------------------------------------------------------------------

DeleteEverything
FiboValues

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service