Wolfram Computation Meets Knowledge

Twisted Architecture

I didn’t set out to tie knots in Norman Foster’s Hearst Tower or wrinkle his Gherkin, but I got carried away. It’s one of the occupational hazards of working with Mathematica.

It started with an innocent experiment in lofting, a technique also known as “skinning” that originated in boat-building. I wanted to explore some three-dimensional forms, and a basic lofting function seemed like a quick ticket to results. I dashed off the function Loft, which takes a stack of three-dimensional contours and covers it with a skin of polygons.

The results of the Loft function

Loft uses Mathematica‘s GraphicsComplex primitive to factor out the geometries of the polygons from their topologies. The contour point coordinates are collected in the first argument. The second argument is a list of Polygons whose coordinate values are replaced by integer indices into the coordinate list. My Loft function was straightforward to write, but required a little fancy footwork with indexing to get the polygons wired onto the points in the right way.

Loft code example

I tried out Loft by embedding it in a Manipulate, and was happily on my way discovering some interesting new forms. You can download the Demonstration to try it out yourself.

Manipulate code example

Manipulate code output

Even this trivial parameterization of a scaled and twisted half-sphere yields an amazing variety of forms, each of which suggests interesting avenues to explore.

A variety of forms

The last of those forms brought to mind Norman Foster’s Swiss Re building in London, nicknamed by the locals “the Gherkin.”

The Swiss Re building in London

I wondered how convincingly I could model the Gherkin in Mathematica. It was immediately obvious that my simple Loft function was not up to the task of replicating the white diagrid framing structure employed in the Gherkin, so I set out first to generalize Loft. One thing lead to another, and soon I had the much larger but much more flexible function Build, with which I could explore not only Foster’s Gherkin but a large number of other architectural forms based on the simple idea of hanging panes, panels, mullions, and framing members on grids of points.

My Build function works like Loft, but gives me much more flexibility in specifying elements like tubes and polygons and how they are repeated on the contour grid. Like Loft, Build‘s first argument is a set of contours. The second argument is a Graphics3D-style primitive list whose primitives contain an extra argument that specifies how they should be repeated on the contour grid.

If you imagine the contours numbered from bottom to top and the points in the contours numbered from left to right, {point, contour} indices correspond to coordinates in an integer coordinate system. The primitive
Polygon[{{0,0},{1,2},{1,0}}] appears on a contour grid like this.

A primitive polygon on a grid

A primitive that has no extra repetition argument is automatically repeated to tile the grid. Explicit control over the tiling is had by specifying a pair of tiling translations, as in Polygon[{{0,0},{1,2},{1,0}},{{2,0},{1,1}}]. That polygon tiles the grid like this:

Repetition of polygons on a grid

In linear primitives like Line and Tube, the repetition argument specifies the frequency with which the primitive is repeated horizontally, or for horizontal primitives, vertically. By combining repetitions of polygons, tubes, and lines, Build gives me great flexibility in describing assemblages of panes and structural members. Here’s an abstract structure I generated to exercise all of Build‘s primitives.

Code used to generate the abstract structure

The abstract structure

With Build in hand, my next task was to determine the shape of the Gherkin’s profile and build a corresponding contour grid. Always on the lookout for easy results, I experimented first with skinny ellipsoids, and discovered that the top of the Gherkin is too pointed for an ellipsoid to model. No other simple mathematical candidate shape occurred to me, so I resorted to freeform design using splines.

I recalled this Potter’s Wheel Demonstration written by my colleague Yu-Sung Chang for modeling freeform solids of revolution. It was just what I needed.

Potter's Wheel Demonstration preview

With a reference photo of the Gherkin in a separate notebook, I dragged the control points of the spline profile until I had an acceptable approximation of the Gherkin’s shape.

Dragging the control points into the correct shape

When I was satisfied with the result, I used the Manipulate‘s “Paste Snapshot” button to get the source code for the figure. From the source code, I cut the spline control-point coordinates and pasted them into a BSplineFunction that defines the profile.

The BSplineFunction

The final step was to slice the profile curve into equally spaced horizontal sections. Mathematica‘s versatile meshing functions do the trick.

Meshing function

Output of the meshing function

I extracted the mesh point coordinates from the plot output, appended the profile’s boundary points, and sorted in the y coordinate to obtain a list of points from which I could construct the Gherkin’s contour grid.

Sorting the y coordinate

The contours themselves correspond to a solid of revolution, with the contour radii given by the x coordinates of the profile points, the elevations by the y coordinates, and the number of points around a contour by twice the number of glass panes around the Gherkin.

Code to create the contours

I did a quick test Build to see if my contour points seemed correct. Indeed, they did.

Test Build code

Output of the test Build code

As a final step, I refined the contour points at the top to add the dome-like cap at the top of the Gherkin.

I won’t deny that from there it required a surprising amount of detailed work using Build to make a finished model. The Gherkin’s body, its cap, the topmost dome, the rings, and the boundaries of and transitions between the separate parts all required individual attention. To select material properties and lighting, I set up Manipulate rigs and exercised the sliders until I found the right values. Here is the result.

The finished model

Once I had the completed model, I could begin to explore. One of the unique strengths of Mathematica is the ability to post-process structures using replacement rules. The output of the Gherkin model contains the colors I used for the dark and light panes of the body. By replacing those colors with new ones, I created this color variation inspired by the Union Jack.

CountryData["UnitedKingdom", "Flag"]

Image of the Union Jack

Replacement rule code

Color replaced model

Post-processing via replacement rules can operate on the geometry of an object as well as its appearance attributes. Because all of the coordinate data of my model resides in the first argument of GraphicsComplex, coordinate transformations are particularly easy. And since all of the graphics primitives are all wired to the same coordinates, the primitives automatically move in concert and remain connected when the coordinates are transformed.

Using that technique, I wrote this Manipulate to explore variations in the radial geometry of the Gherkin.

This Manipulate code explores the variations in the radial geometry of the Gherkin

Output of the code

Now I could find the answers to some pressing questions. What if the Gherkin were two-sided rather than round? Three-sided? Four-sided?

Variations on the Gherkin

What if the Gherkin’s dark ventilation shafts were recessed into the building? What if the recesses ran counter to the direction of the shafts? What if London were shaken by a really violent earthquake?

More variations on the Gherkin

You can cover territory quickly with Mathematica‘s Manipulate. Surreality is a mere slider’s length away from reality. My explorations ended somewhere around this Dali-esque vision of the Gherkin tangoing with itself.

A Dali-esque vision of the Gherkin

Energized by my results with the Gherkin, I turned my attention to another of Foster’s buildings that employs diagrid framing, the Hearst Tower in New York.

The Hearst Tower

Compared to the Gherkin, modeling the Hearst Tower was a piece of cake. The only part that required much thought was generating the floor polygons, which undulate back and forth between two shapes. The rest was straightforward use of the Build function. Here is my model of the main tower structure, rendered with Mathematica‘s default lighting.

Mathematica render of the Hearst Tower

The tower structure is generated by repeatedly translating polygons. On a whim, I substituted rotations for translations, and after adding a few floors, generated this bent tower that wraps around on itself to form a torus.

The Hearst Tower twisted into a torus

On the theory that one good turn deserves another, I took a couple of seconds to add a second rotation about an axis perpendicular to the first and created this Möbius building. I love the beautiful rhythm set up by the interaction of the diagrid frame with the curved and winding Möbius surfaces.

The Hearst Tower twisted into a Möbius

On Earth, the Möbius building would be a difficult sell. But I imagine it floating in space, housing a gallery of the finest in cosmic art—a sort of orbital Guggenheim with a twist. Don your Velcro slippers and padded headgear a la 2001: A Space Odyssey and pay attention to artwork on the wall to your right. Once around the gallery, you’ll be hanging from the ceiling looking at the opposite wall, which of course is the same wall, the only wall in the gallery. Enjoy the backdrop of the Milky Way, and perhaps the Earth floating in the distance.

A final render in space

A close-up of the final render

You can explore the universe of architectural possibilities with me at this year’s ACADIA conference on October 21 in Chicago, where I’ll be giving a one-day workshop on how to use Mathematica for parametric, algorithmic, and generative architectural design. Join me and your colleagues for a day of hands-on form exploration by registering for the conference.


Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.


  1. Impressive mathematica skills! Congratulations, amazing work!

  2. Really, really enjoyed reading this!

  3. Very nice. I’d like to try the Build function myself, for personal and non-commercial use only.

  4. Great Space! I wish I could command math like that! I’m inspired and impressed!

  5. Author’s post is always beautiful and creative.
    We love to read.

  6. Really amazing. I especially like the Möbius gallery concept.

    It would be really cool if instead of the “normal” starry background you had a sweet Hubble shot of some nebula that would transparently show through pieces of the building/spacecraft.

  7. Good ideas and pretty results!

    Incidentally, premium customers should also receive an additional USB device and the function Create3Dmodel[x] which would create a colorful plastic model of a 3D object. ;-)

    A bigger version of this gadget could be used instead of construction workers, too. :-)

  8. pretty amazing, and a great walk from simple drawing towards recreating the gherkin — you’ve rediscovered parametric architecture! =)

    don’t be too doubtful about the selling points of the mobius building though. BIG architects recently sold kazakhstan a similarly formed library:


  9. I’ve run across a couple of Möbius proposals, including the Kazakhstan library, since I wrote this post. But they’re all slaves to gravity, hiding horizontal floors inside Möbius shells. You can’t walk on the ceiling of any one of them!

  10. Fantastic! It seems to me like formulating … sentences ?

  11. wonderful work. I experiment with similar forms with another parametric design program. I only wish I understood computer language and the math associated with it to manipulate it as you do. Have you used Rhino’s Grasshopper at all? Grasshopper allows you to graphically construct definitions with any mastery of mathematics (thank goodness). It also has full script / algorithm capabilities as well as plug ins for quick and simple fabrication. The rendering quality here is also impressive. Great work!

  12. How did you the lighting and polished look for the final graphics?

  13. Chris very impressive!
    Enjoy very much reading what you wrote!

  14. Fosters, I understand, use GenerativeComponents from Bentley that is really quite sweet.

  15. I could almost hear Strauss as you described the möbius building…

  16. Awesome ART Chris…!! :)

    Really, really an inspired piece of work…that can go a long long way in inspiring people like me (or otherwise too!) who’re already inspired by what Mathematica can do…!

    Keep up the great work..! :)


  17. Hi,

    I was wondering if I can use some of the images in this post for a lecture (which has nothing to day with math)

  18. Hi there. love your work.

    I am a uni student at bournemouth uni.

    I am doing a arch assignment on the gherkin and was wondering if you could help me with it. Give me some tips etc.

  19. Very impressive, how did you manage to get the lighting and polished look for the final graphics. Would be great if we can use these images for teaching.

  20. Very creative and inspiting.

  21. Hi Chris,
    very nice work, congratulations!
    I am also working in the field between math and architecture. You migth be interested:

  22. very interesting, that London building is weird!

  23. amazing mathematical skills..and nice article as well..

  24. I am so very happy at reading the above post. Do write more entries in the future. I shall be anticipating articles like this with keen interest. Israel Kerce

  25. i just wanted to say : WOW

  26. You’ve just became my role model. By the way, These are great examples of how mathematics are beautiful.

  27. This building so shiny!! I want to lick it!

  28. really impressive indeed. whenever somebody is asking what mathematica is capable of i show him this. :)

  29. Very skillfully done and a delight to read. We want more!

  30. Wow, I love the Möbius-ring-concept
    Taking this thought further, it’s probably the most fascinating “shape” to build, presumed gravity is not a problem anymore. Imagine raceways shaped as a Möbius-ring, just as one possibility to create things which have never been there before

  31. The Russian Kremlin onion domes came way before…
    Spiral staircases were something every circular tower maker
    had to have.
    This work is first class and awesome.
    I had been doing some twisted Menger cubes
    about this time.
    Lately I have used some start functions
    of mine to make twisted gears.
    Gear making using this sort of math is a practical
    application of this technology.
    Roger Bagula

  32. if they would have actually told me about ways like this to apply math skills, I would have paid attention in high school ;)

  33. I do not live in London or the UK, but see this gherkin building and am facinated by its beauty. Who works or lives in it? When was it built.
    Thank you for your perseverence
    Marilyn S.

  34. Waww… Amazing skills !!! mathematics have never been my preferable subject, but after seeing this, I believe that its the first important science…

  35. всё гениальное – просто!

  36. Wooow !!! … Impressive !!

    Hi, Im trying to do this exercise but I dont know how to make the output shows :S
    This is my first time using Mathematica.
    Does anyone knows where I can get instructions for beginners ?