1 Dec

My daughter recently bought me a paperweight for my birthday made from a mold of a romanesco broccoli. I made this sketch in tribute to that mathematically inspiring vegetable, shown here.

Most of the code comes from the Fibonacci Spiral I wrote about in part 2 of my Circles, Spirals and Sunflowers tutorial.

In this version of the code, I made the spiral into a recursive function. In the spot where I would normally draw a circle, I instead draw an equivalently sized spiral, by having the function call itself. This continues ad-infinitum until the radius of the dots gets so small, that you can’t see the spiral, in which case I draw a tiny circle.

I was able to get an ersatz 3D effect (without using actual 3d) by offsetting the y coordinate in octaves, based on the level of recursion.

y += pow(2,level)*ratio;

I imagine there is probably an elegant L-System that will draw the same pattern, but I haven’t worked it out yet.

Tags: , , , , , ,

No comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *