# How I Made Wine Glasses from Sunflowers

July 28, 2011 — Christopher Carlson , Senior User Interface Developer, User Interfaces

Eons ago, plants worked out the secret of arranging equal-size seeds in an ever-expanding pattern around a central point so that regardless of the size of the arrangement, the seeds pack evenly. The sunflower is a well-known example of such a “spiral phyllotaxis” pattern:

It’s really magical that this works at all, since the spatial relationship of each seed to its neighbors is unique, changing constantly as the pattern expands outwardly—unlike, say, the cells in a honeycomb, which are all equivalent. I wondered if the same magic could be applied to surfaces that are not flat, like spheres, toruses, or wine glasses. It’s an interesting question from an aesthetic point of view, but also a practical one: the answer has applications in space exploration and modern architecture.

To reproduce the flat sunflower pattern mathematically, you need to know three secrets of the arrangement:

- Seeds spiral outward from the center, each positioned at a fixed angle relative to its predecessor.
- The fixed angle is the golden angle,
*γ*=*2π*(*1*–*1*/*Φ*), where*Φ*is the golden ratio. - The
*i*th seed in the pattern is placed at a distance from the center proportional to the square root of*i*.

You can make a picture of that arrangement easily if you think in polar coordinates, with the *i*th seed placed at coordinate {*r*, *θ*} = {√*i*, *i* *γ*}:

The reason that the radial distance of the *i*th seed is proportional to √*i* is not difficult to understand. Suppose the *i*th seed is at distance *d* from the center. Then the disk of radius *d* contains *i* seeds. In order to achieve an even density of seeds, the number of seeds *i* in a disk must stand in constant proportion to its area *π**d*^{2}, or:

i∝d^{2}

Inverting that relationship gives:

d∝√i

You can apply the same reasoning to the problem of distributing seeds evenly on a hemisphere. To deal with hemispherical surfaces, it helps to think of the positions of the seeds in fixed-radius spherical coordinates {*φ*, *θ*}, where *θ* plays the same angular role as in polar coordinates and *φ*—the angular distance from the north pole along the hemisphere to a point—plays the role of *r* in polar coordinates. This figure shows the correspondence between polar coordinates and fixed-radius spherical coordinates:

The relationship between the area of a spherical cap and its angular radius is not the square root, as in the plane, but something else. To determine what it is, I started with the expression given in *MathWorld* for the area of a surface of revolution generated by rotating the parametric curve {*x*(*t*), *z*(*t*)} about the *z*-axis:

For a spherical cap with angular radius *φ*, the generating curve is the circular arc defined by

as *t* goes from 0 to *φ*.

To find the formula for the cap’s area, you don’t need to know anything about integration. You just plug the values of *x*, *z*, *t*_{0} = 0, and *t*_{1} = *φ* into the area formula, and out pops the cap’s area:

As in the planar case, I wanted *i*, the number of seeds, to stand in constant proportion to the area of the hemispherical cap, or:

i∝(1-Cos[φ])

Introducing *c* as the constant of proportionality, I found the relationship I sought using `Solve`:

The two solutions differ in the direction that the seeds spiral around the center.

The constant of proportionality *c* governs the density of the seeds. I solved for its value as a function of the total number of seeds *n* and the maximum angular radius *φ*_{max}:

Thus if I want 1,000 seeds in the entire hemisphere, which corresponds to an angular radius *φ* of 90°, I set *c* to

Putting all these results together yields the seed-covered hemisphere. The forms of the coordinate and graphics expressions here are analogous to the forms in the planar case above:

If you were building a hemispherical house, this would be the basis of a good roofing pattern, since each equal-sized shingle overlaps the joint between the two below it. Or, if you wanted to design approximately equal-area flat panels to assemble into a dome, this distribution would be a starting point. This problem of “tectonics”—how to realize curved surfaces with flat materials—is a hot topic in current architectural research. A similar problem arose in the Starshine 3 student satellite project, which required a spherical satellite to be evenly covered with reflective mirrors. The folks at the U.S. Naval Research Laboratory solved that problem with a phyllotaxic pattern.

Computing a custom function to cover each new kind of surface was an interesting mathematical journey, but a lot of work. What I really wanted was a single function that would, once and for all, distribute points evenly on any surface of revolution whose generating curve I could describe parametrically.

As with the disk and hemisphere, the secret to achieving an even distribution of points on an arbitrary surface of revolution is to make the number of points in an area proportional to the area. Unfortunately, the integral that describes that relationship often has no closed-form solution, even for simple parametric curves. But fortunately, we don’t need a closed-form solution to obtain a result. Numerical integration does nicely.

The numerical analog of the area integral above for generating functions *x* and *z*, and parameter interval *t*_{0} to *t*_{1}, uses the `NIntegrate` function in place of `Integrate`:

This function gives area as a function of curve parameter *t*, but I needed the inverse relationship: given an area, I wanted to know what *t* is. Since I couldn’t invert this function directly, I made a table of {area, *t*} pairs and interpolated that to give myself a function that, from empirical evidence, approximates the inverse sufficiently well:

With those components, I assembled the function for rendering arbitrary phyllotaxic surfaces. Parameters `x` and `z` give the parametric description of the generating curve, {`t`0,`t`1} specifies the interval of the curve that generates the surface, `density` specifies the density of points, and `radius` gives the radius of the spheres that render the points.

I tested the function with a covering of a complete sphere:

As on a sunflower’s disk, the points on the sphere group into spirals that regroup as you move from the poles toward the equator. To make that structure more apparent, I modified the rendering function so I could specify that every *n*th point should have a given color, and rendered spheres with *n* = 2, 3, …, 13. The resulting images revealed a variety of spiral structures lurking within the pattern.

Combinations of colorings layered on top of one another show the complex interplay of spiral structures:

Since *Mathematica*‘s integration functions are completely general, I could explore generating curves of all sorts, including piecewise and interpolated curves. Here’s a sample of some phyllotaxic surfaces of revolution I encountered (click an image to see an enlargement):

Curious what a phyllotaxic wine glass would look like, I grabbed an image of a Peugeot wine glass from the web and used the `Get Coordinates` function to digitize its outline, which I fed to `Interpolation` to get the *x* and *z* parametric functions of the curve. This is the resulting parametric curve:

With those functions, it’s a no-brainer to make a phyllotaxic wine glass.

The spiral structures in this form, with its concave and convex surfaces and wide variation of diameters, were especially interesting to explore. Here’s one study that I particularly liked. It exploits the fact that when you color every seventh point, you get three distinct spirals at small diameters. I omitted the other six points entirely so that those spirals stood on their own in the stem, and gave each of them a different color. By choosing cyan, yellow, and magenta, the base and bowl of the glass are a neutral gray when viewed from a distance, and yet it shimmers almost iridescently as it moves, due to the moiré patterns induced by the patterns on the opposite sides. The magic of spiral phyllotaxis unites all the parts into one festive whole.

Alas, the effect requires spheres too tiny to bond together, so they’d have to be embedded in a clear glass matrix. When the day arrives that clear glass can be 3D-printed, I’ll be first in line. Meanwhile, there are plenty of other intriguing phyllotaxic surfaces waiting to be discovered.

## 21 Comments

Some of your phyllotaxic surfaces of revolution reminded me very much of the green shells of sea urchins. The spiral perhaps isn’t obvious but the equal density spacing of the quills would make sense biologically.

It might also be interesting to see what happens when, instead of varying the colours of points (or in addition to), you also vary the size of spheres.

Thanks for another very cool creative post. Looking forward to your next one!

Nice post!!

A simple test is to plot the histogram of the distances between each point and the nearest, for the first graph. All points are about 1.7 from each other.

Very nice post! Keep the posts coming!

Very nice work, I like to make renders, now i am going to try the same but with Pov Ray,

1. If each point on the surface was a magnet with N and S poles, how would they align?

2. Would it be possible to apply this approach to packing in a volume vs. a surface?

Dear Christopher,

I teach design at Penn State, and I am working on how to teach the creative process to scientists, mathematicians and engineers. What I would appreciate is a clarification about your process. Do you start with, “I see mathematical process in this sunflower” so how can I apply it to something else? Or, I’ve got this problem, now I’m going out and looking for organic solutions to the problem at hand. I realize it’s probably a bit of both- Your thoughts?

thanks

Renee -

In this case it was the first way around. I was intrigued by the mathematics and spatial organization of the sunflower pattern and wondered if that structure could be generalized to non-planar surfaces and if so, what it would look like. I was aware of practical applications, but that’s not what drove me to explore.

As far as creativity goes, it’s analogy that drives much of what I do. When I run across an interesting phenomenon, I like to extract it from its context and think about how it could be explored in completely different ones. What would a Steve Reich piece look like if it were layers of frieze symmetries? What would the Op artists have done with interactive graphics? What if mullion patterns were musical rhythms? …

I really appreciate the contribution of each one who are working with wolfram alpha this not site not only to obtain the information but its the world develop by some of the most interesting and intelligent person in the earth .i really appreciate the work of each one.

Fantastic post. Have to admit the math went a bit over my head, but absolutely fascinating never the less.

Like Jamie, straight over my head but truly fascinating post.Wine glass looks good too!

Being a big Fibonacci fan I have some experience with this stuff. I unashamedly used your Peugeot wine glass data

to make 3d models in straight Manifolds.

The difference in a connected Cuboid Model and one with Sphere in 3ds memory use is 50 to 1: 44.4 megabytes

for the Spheres and 0.827 for the Cuboids.

Yes, your sphere model is too big for present technology,

but probably not for long.

I remember well when I was using a Commodore 64

and a I megabyte Amiga right after that.

You do good elegant programming.

Roger Bagula

Could you pl explain how you did the following step

“I grabbed an image of a Peugeot wine glass from the web and used the Get Coordinates function to digitize its outline, which I fed to Interpolation to get the x and z parametric functions of the curve”

I can get the coordinates and copy it but what do I do next to get Parametric Curve Pl explain. It’s NOT a no brainier for me :-)

Superb demonstration. Could you actually pack the sphere with little spheres using a Fibonacci packing approach. In other words, you nicely show the surface of a sphere packed by spheres in a 3-D Sunflower pattern – what would the inside of such a sphere look like if it were filled with the smaller spheres?

That’s an interesting question. The sphere packing on the surface depends on the structure of the spiral traced out on the surface. I don’t see any obvious way to continue it into the interior. Alternatively, perhaps you could lay spheres along a curve that loosely “fills” the surface and interior of the sphere, arriving at a 3D, spherical analog of the the 2D packed disk. Good question, though, what that curve would be.

My feeling is that for an efficient packing you will need to increase the sphere radius as you move out from the centre (actually it is more than a feeling, I know you will need to do this as I have played with models of this type made up of ball bearings). But I do have a feeling that this Fibonacci sphere packing will give you the highest sphere packing density possible for a spherical container – but unlike the conventional sphere packing problem you will need to use spheres of different radii.

Very awesome post!

very interesting spirals

I like to do 3D models with blender which use python

so wondering if you have the equivalent math functions in python ?

I was able to do the first 2D multi spirals

but the 3D one seems to use some special function = Solve ect.

Note: I’m not in math but like to do math functions with blender 3D

thanks for any feedback

I’ve been looking for a way to cite the golden angle spiral on a sphere. It appears to be known by others at least in 2006 but they also don’t cite a source.

http://www.softimageblog.com/archives/115

Any idea on the provenance of this algorithm?

By the way – thanks for this post, it’s very insightful and a neat generalization to arbitrary phi (not just 180 degrees). In terms of minimizing the size of gaps between points (i.e. the furthest distance from any point) I’ve found it does extremely well. Much better than Saff’s algorithm and within a whisker of the electrostatic repulsion methods, which are iterative and much slower.

The provenance of _this_ algorithm is my head. It’s not difficult to develop the math from first principles, as I show in the post.

Thanks for this walkthrough. I plan to use the 2D phyllotactic pattern to create a base mesh for variations of puzzles like Slitherlink.

Minor point of syntax: the adjective form of phyllotaxis is phyllotactic.