Wolfram Blog
Christopher Carlson

Twisted Architecture

September 11, 2009 — Christopher Carlson, Senior User Interface Developer, User Interfaces

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.

Posted in: * Best of Blog *, Design
Leave a Comment



Impressive mathematica skills! Congratulations, amazing work!

Posted by kylekatarn    September 11, 2009 at 4:08 pm
Onkar Singh

Really, really enjoyed reading this!

Posted by Onkar Singh    September 11, 2009 at 8:12 pm

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

Posted by Shears    September 12, 2009 at 7:25 am

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

Posted by Martin    September 12, 2009 at 12:38 pm

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

Posted by FreddyMusic    September 13, 2009 at 10:16 pm
Kovas Boguta

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.

Posted by Kovas Boguta    September 14, 2009 at 3:22 am
Luboš Motl

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

Posted by Luboš Motl    September 14, 2009 at 9:44 am
Chris Ing

Very artistic/mathematistic!

Posted by Chris Ing    September 15, 2009 at 10:13 am

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:


Posted by sha    September 15, 2009 at 9:34 pm
Christopher Carlson

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!

Posted by Christopher Carlson    September 16, 2009 at 8:40 am
Herbert Exner

Fantastic! It seems to me like formulating … sentences ?

Posted by Herbert Exner    September 17, 2009 at 5:01 am
Arch. Student

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!

Posted by Arch. Student    September 28, 2009 at 6:17 pm

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

Posted by aa    September 29, 2009 at 8:36 am
Julio de la Yncera

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

Posted by Julio de la Yncera    October 6, 2009 at 8:08 pm
lawrence eaton

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

Posted by lawrence eaton    October 16, 2009 at 4:28 pm

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

Posted by JMO    October 24, 2009 at 9:39 am
Raghu Ugare

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


Posted by Raghu Ugare    November 3, 2009 at 6:57 am
Diederik Martens


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

Posted by Diederik Martens    December 9, 2009 at 2:19 pm

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.

Posted by Chris    December 27, 2009 at 7:43 pm
Londen bezienswaardigheden

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.

Posted by Londen bezienswaardigheden    December 29, 2009 at 10:48 am
Raul Huertas

Very creative and inspiting.

Posted by Raul Huertas    January 24, 2010 at 4:32 pm
Lorenz Lachauer

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

Posted by Lorenz Lachauer    February 11, 2010 at 3:49 am
Parental Control

very interesting, that London building is weird!

Posted by Parental Control    April 20, 2010 at 3:56 pm

amazing mathematical skills..and nice article as well..
how about these towers in the picture http://archibuild.org/eco-architecture/building-the-future/

Posted by Archibuild.org    June 21, 2010 at 5:04 pm
Israel Kerce

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

Posted by Israel Kerce    August 10, 2010 at 12:16 pm
Mohammad Hossein

i just wanted to say : WOW

Posted by Mohammad Hossein    May 15, 2011 at 10:23 am

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

Posted by Masum    May 22, 2011 at 7:46 pm

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

Posted by Mark    May 26, 2011 at 2:19 am

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

Posted by George    June 18, 2011 at 8:46 am

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

Posted by Hans    June 27, 2011 at 1:54 pm
fajas colombianas

The beauty of math.

Posted by fajas colombianas    July 28, 2011 at 11:39 am

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

Posted by MechMK1    July 30, 2011 at 5:07 pm
Roger Bagula

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

Posted by Roger Bagula    October 23, 2011 at 1:12 pm

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

Posted by adpe    November 13, 2011 at 4:03 pm

Very cool….

Posted by Meleca    January 30, 2012 at 2:49 am

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.

Posted by Marilyn    April 16, 2012 at 3:40 am

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

Posted by Danielle    August 23, 2012 at 7:11 am

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

Posted by Andrey    September 11, 2012 at 6:20 pm
Victoria Sanchez

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 ?

Posted by Victoria Sanchez    December 7, 2012 at 11:49 am
Imelda FB Maguire

My, o’h my… beautiful work and ever so inspiring. Really enjoyed the 3d tour through Sistine Chapel.

Thank you so much for sharing your passion, I believe you are brilliant!



Posted by Imelda FB Maguire    January 17, 2013 at 12:34 am
Tony Wills

Great, Can Mathematica draw D-Forms?

Posted by Tony Wills    March 3, 2013 at 2:25 pm

Just wonderful !

Posted by Steve    August 8, 2014 at 4:07 am

Leave a comment