How to Dance with a Tree

Ever wondered what it might feel like to be a tree for an evening, with your branches waving and the wind in your leaves?

It was this question that led scientists, researchers and educators Aatish Bhatia and Upasana Roy to produce the art work below.

Discover the beauty and movement of one of the most fundamental mathematical patterns in nature. And to wave your arms in the air!

Words by Aatish Bhatia. From Wired, 2014

Here’s a fun project that my partner Upasana and I put together. It’s a visual exploration of fractals through dance, a piece of generative art that’s part performance and part mathematical exploration.

The two ingredients that went into creating this were the Microsoft Kinect sensor, which lets your computer track how your body moves, and Processing, a programming language that lets you create interactive visuals with code. Put the two together, and you can use your body to control virtual shapes and objects.

The idea for this project came about while I was walking home from work late October, idly watching the recently bare tree branches swaying in the wind. And for some reason that made me wonder, what would it be like to be a tree for an evening? Imagine lifting your arms, and a tree waves its branches.

And then I remembered reading about fractals in Daniel Shiffman’s book Nature of Code. Fractals are those wonderfully intricate structures that look the same as you keep zooming in to them. Benoit B. Mandelbrot was one of the earliest explorers of the fractal world. He coined the word fractal to mean a kind of geometric shape whose parts resemble “a reduced-size copy of the whole.” (Some fractal humor: What does the B in Benoit B. Mandelbrot stand for? Benoit B. Mandelbrot.)

At the heart of being a fractal is self-similarity, the idea that each piece appears similar to the whole. Think of how a coastline on a map appears similarly wrinkly across different levels of zoom. The same could be said of the jagged terrain of a mountain.

Or picture the ever branching paths that lightning follows as it travels down to the Earth.

When high voltage electricity passes through an insulator, it branches out in fractal like patterns. Image: Bert Hickman / Wikimedia

Or the nested arrangement of leaves within a fern.

Image: Sanjay ach / Wikimedia

Or the buds in a head of Romanesco broccoli. Each bud contains smaller buds upon it, arranged in the same spiraling pattern.

Fractal Brocolli. Image: Jon Sullivan / Wikimedia

From coastlines to broccoli, and lightning to trees, many of nature’s patterns are better described by fractals than by the usual cast of shapes like lines, circles, and triangles. In the real world, objects can only be roughly fractal, because at some level of zoom the repetition will end. But in mathematics, the self-similarity can continue forever.

While shapes like circles and triangles are the essence of simplicity, fractals, on the other hand, capture a kind of organic complexity with their infinite fuzziness. There’s a world of difference between a triangle and a mountain.

Which brings me back to the tree. You can think of a tree as being fractal-like. Here’s a sketch of a tree.

Image: Daniel Shiffman / Nature of Code

But look closely, and each branch is kind of a “reduced-size copy of the whole”, to use Mandelbrot’s words.

Image: Daniel Shiffman / Nature of Code

For example, take a look at this picture.

Image: Aatish Bhatia

You might think you’re looking at an entire tree, but actually, it’s a picture of a branch sticking out sideways. (I was lying down and looking up when I took the picture.) The branch looks like a smaller-scale tree, and it’s this self-similarity that we’re trying to capture.

In his book, Daniel Shiffman implements a simple algorithm to draw such fractal trees.

Image: Daniel Shiffman / Nature of Code

I slightly tweaked his code so that the angle at which the branches form is controlled by the position of my mouse. So by moving my mouse around, I could animate the tree.

The next step was to incorporate the Kinect sensor bar, so you can control this tree with your body. To do this, I used the Simple-OpenNI library. My partner Upasana Roy willingly volunteered to play the role of dancer, choreographer, and high-tech puppeteer.

Image: Upasana Roy and Aatish Bhatia
Image: Upasana Roy and Aatish Bhatia

And voila, by waving her hands about, she animates the tree. The angle of her hands (measured from her hip) controls the branching angles in the fractal. The physical space that her body inhabits is mapped onto an abstract mathematical space (in this case, the space of all fractals you get by varying the branching angles of this tree).

We stopped there, but there are endless other virtual shapes, objects, and spaces that you might be interested in exploring.

I asked Upasana how she felt as she started to play with this program.

Aatish: What did you experience when you first started using it?

Upasana: It was frustrating at first. A lot of times my moves didn’t get any response from the fractal, and the few times it did the changes were jerky and sudden. Even when I moved my arm in one smooth motion, the fractal tree would spasm so I didn’t know what was going on.

Aatish: What changed as you spent more time using it?

Upasana: I realized that when I dance I use all the space around me with my arms. But in this case the fractal responded to motion in some parts of space more than others. For example, moving my arms up and down made the fractals change much more than moving them side-to-side.

Aatish: How did you go about choreographing the dance? What was challenging about it and what was fun about it?

Upasana: After spending some time I could figure out a relationship between my arm positions and the fractal design. So then I could move it in a predictable way. After that it was about playing around with the fractal patterns and the music – that was the fun part. The hard part was keeping my arms up the entire time!

I remember feeling a bit like a hi-tech puppeteer, because I was moving my hands around in the air but you weren’t seeing THAT movement, but a transformed version of it. That felt pretty cool, to control the tree with abstract hand movements in the air.

Upasana Roy is a research scientist at Columbia University, and co-president of the Columbia University Postdoctoral Society. Her research focuses on understanding how cells repair their damaged DNA. 

Aatish Bhatia is an award-winning science writer, educator, and physicist. Previously, he taught courses on Engineering & the Arts and the Science of Music at Princeton University. He currently works as a freelance science communicator and explores the creative and educational possibilities of the web. 

Leave a comment

Your email address will not be published. Required fields are marked *