Phyllotaxis LED sculpture

I’ve been fascinated by understanding patterns that appear in nature, through code. Communing with the inherent emergent patterns that exist in the universe.

The phyllotaxis is one such pattern, the expanding double-spiral shape that appears in the center of sunflowers, succulents, other plants. It’s surprisingly simple code:

// Inner and outer are throw-away,
// just for spacing the cells that are used
float[][] points = new float[numCells + numOuter + numInner][2];
float outerRadius = width / 2;
final int total = numCells + numInner + numOuter;
for (int i = 0; i < total; i++)
{
    float f = i / float(total);
    float a = i * 1.6180339887;
    
    float distance = f * outerRadius;
    
    float x = -cos(a * TWO_PI) * distance;
    float y = sin(a * TWO_PI) * distance;
    
    points[i][0] = x;
    points[i][1] = y;
}