Wolfram Blog
Christopher Carlson

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:

A sunflower as an example of 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:

  1. Seeds spiral outward from the center, each positioned at a fixed angle relative to its predecessor.
  2. The fixed angle is the golden angle, γ = (11/Φ), where Φ is the golden ratio.
  3. The ith 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 ith seed placed at coordinate {r, θ} = {√i, i γ}:

γ = 2π(1 - 1/φ)
PolarCoordinate[r_, θ_] : = r {Cos [θ], Sin [θ]}
Graphics[Point[Table[PolarCoordinate[√i, i γ], {i, 1, 1000}]]]
Result showing spiral phyllotaxis pattern

The reason that the radial distance of the ith seed is proportional to √i is not difficult to understand. Suppose the ith 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 πd2, or:

i d2

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:

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:

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

Definition of the generating curve of a circular arc

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, t0 = 0, and t1 = φ into the area formula, and out pops the cap’s area:

Using the area formula to calculate the cap's area
Result of 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:

Solve[i = c(1 - Cos[φ]), φ]
{{φ → -ArcCos[(c - i)/c]}, {φ → ArcCos[(c - i)/c]}}

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:

Solve[φmax == ArcCos[(c - n)/c], c]
{{c → - n/(-1 + Cos[φmax])}}

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

-(n/(-1 + Cos[φ max])) /. {n → 1000, φmax → 90°}

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:

FRSphericalCoordinate[φ_, θ_] := {Sin[φ] Cos[θ], Sin[φ]Sin[θ], Cos[φ]}
Graphics3D[Sphere[Table[FRSphericalCoordinate[ArcCos[1 - (i/1000)], iγ], {i, 1, 1000}], .04], Boxed → False]
Seed-covered hemisphere

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.

Starshine 3

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 t0 to t1, uses the NIntegrate function in place of Integrate:

NIntergrate function gives area as a function of the curve parameter t

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:

Using a table of {area, t} to show a function that approximates the inverse

With those components, I assembled the function for rendering arbitrary phyllotaxic surfaces. Parameters x and z give the parametric description of the generating curve, {t0,t1} 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.

SetAttributes[PhyllotaxicSurface, HoldAll]Function for rendering arbitrary phyllotaxic surfaces

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

Testing the function with a covering of a complete sphere
Complete sphere with phyllotaxic surface

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 nth 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.

Function showing every nth point should have a different color
Grid[Partition[spheres, 4], Spacings → {1, 1}]
Grid of spheres showing spiral structures

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

Function showing colorings layered on top of one another
Illustration of sphere with combinations of colorings layered on top of one another

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):

Multiple phyllotaxic surfaces

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:

Parametric curve of Peugeot wine glass

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

Function building a phyllotaxic wine glass
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.

Function making phyllotaxic wine glass with multiple colors
Phyllotaxic wine glass with multiple colors

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.

Click here to download this post as a Mathematica Notebook.

More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge More Manipulate output—click each to enlarge

Leave a Comment


Mark D

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.

Posted by Mark D    July 28, 2011 at 9:49 am
Mark D

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!

Posted by Mark D    July 28, 2011 at 10:00 am

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.

Posted by igo    July 28, 2011 at 3:40 pm

Very nice post! Keep the posts coming!

Posted by Lou    August 23, 2011 at 8:07 am
Jorge Gamaliel Frade Chávez

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

Posted by Jorge Gamaliel Frade Chávez    September 8, 2011 at 4:16 pm
Lance Otis

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?

Posted by Lance Otis    September 16, 2011 at 12:23 am
Renee Kredell

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?

Posted by Renee Kredell    September 18, 2011 at 8:47 am
Christopher Carlson

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? …

Posted by Christopher Carlson    September 19, 2011 at 9:19 am

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.

Posted by yogesh    September 23, 2011 at 2:36 am
Jamie Welding

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

Posted by Jamie Welding    October 4, 2011 at 5:48 am
George Wroblewski

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

Posted by George Wroblewski    October 14, 2011 at 11:05 am
Roger Bagula

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

Posted by Roger Bagula    October 23, 2011 at 12:11 pm
Prof. Greg Parker

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?

Posted by Prof. Greg Parker    April 5, 2013 at 9:50 am
    Christopher Carlson

    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.

    Posted by Christopher Carlson    April 29, 2013 at 3:50 pm
      Prof. Greg Parker

      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.

      Posted by Prof. Greg Parker    July 25, 2013 at 2:47 pm
Tal Einav

Very awesome post!

Posted by Tal Einav    January 27, 2014 at 5:57 pm

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

Posted by Rickyblender    August 21, 2014 at 11:26 am
Eguh Renob

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.


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.

Posted by Eguh Renob    September 16, 2015 at 5:07 pm
Christopher Carlson

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.

Posted by Christopher Carlson    September 22, 2015 at 4:00 pm

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.

Posted by Lars    August 3, 2016 at 7:01 pm
Wine Design

Thanks for useful information. I was just looking this kind of post as i’m big lover of wine and i love to read information related to this topic. Keep up the good work ??

Posted by Wine Design    October 24, 2019 at 7:00 am

Leave a comment