Grasshopper

algorithmic modeling for Rhino

Possibility for iteration / repeated transformations?

Hello everyone,

Another newbie question.  Is there any kind of possibility for iterations / looping in Grasshopper?  As I understand, recursive stuff is not possible, but perhaps there is some other, more limited way to achieve similar results.

Specifically I am looking for a way to apply a transformation (not necessarily geometric, but a general one) to a data stream a pre-defined number of times, and collect all the partial results.  For example, take a point, apply the transformation "rotate by 30 degrees around the origin" 11 times to get 12 points on a circle (of course this specific problem can be solved in other ways, it is just an illustration of what I mean).  This would allow creating fractal-like structures.

An unrelated question: is there a built-in constant for π (pi), or is it necessary to type the value explicitly every time when setting it as a number somewhere?

Views: 1406

Replies to This Discussion

You can find Pi in GH 0.7.30 in Math.Util.Pi. For iterative loops and recursion you can go into a vb.net or c#.net component, through you can achieve quite a lot with the general component set. For your particular example, you could use polar points with a range component driving the rotation value to get multiple points. How many levels of recursion are you looking for? If its less than 10 then you could do it by repeating component sets GH, for more, it might be better to script it.
What you asking is pretty much what Grasshopper does for every component. If you supply a series of values to which you want a point rotated (copied) then each value will be used. See below for the example.

1.) Generate a series of 11 values.
2.) Multiply series by 30 degrees.
3.) Convert to Radians
4.) Rotate Point A about Point B 11 x 30

PI is available from the Maths Tab Utility Section or alternatively double click on the canvas and type PI hit enter.

If you haven't seen the Icons view with Fancy Wires before then these are available from the View Menu and are optional depending on your personal preference. Fancy Wires display the contents of a data stream in a graphical way. single wire = single data, double wire = multiple data on a single branch, double dashed wire = multiple data on multiple branches.

In the example below there are now two pivot points each generating a different 11 points in a circle.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service