Generating a recursive Romanesco broccoli

Romanesco broccoli is an edible flower of the species Brassica oleracea which includes cabbage, broccoli, Brussel sprouts, cauliflower, collard greens, and numerous other “cultivars”. It was first documented in Italy (as broccolo romanesco) in the sixteenth century. In French it is known as chou Romanesco, which translates to “Romanesco cabbage”, but it is by no means a cabbage. The Germans call it Pyramidenblumenkohl, or “pyramid cauliflower”. Romanesco broccoli is what could be termed a self-similar vegetable. There are vegetables which are composed of smaller copies of themselves ad infinitum, or at least until some limit where the similarity breaks down.

Equiangular spirals (also known as logarithmic spiral, Bernoulli spiral, and logistique) describe a family of spirals. It is defined as a curve that cuts all radii vectors at a constant angle.

How do we build a visualization of this vegetable? In Processing of course! Here is the Processing code to generate the Romanesco broccoli. The first piece of code handles setting up the Processing environment, and defining constants like the Golden ratio, the number of florets. It also sets up the Processing draw() function, which executes drawRomanesco(), and takes a snapshot of the final picture.

The remainder of the code deals with the function drawRomanesco() [1].

This is a nice recursive function, which as the base case draws a circle, using the function ellipse(). The recursive case, sets up some parameters, then uses a loop to derive the florets, which internal to the loop, recursively calls itself. The depth of the Romanesco is controlled by the number of levels, which in the case of the example above is 3. The first level is the overall Romanesco with 60 florets, the second level builds each of 60 florets within those florets, and the third level builds the florets within the florets, within the florets. The resulting image of the Romanesco broccoli, is below, showing the Romanesco from above. Of course it is not perfect, because the florets on the real Romanesco are angled out from the main axis.

[1] Code derived from algorithm on


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.