This web page was heavily inspired by the Numberphile video The Golden Ratio (why it is so irrational):
Algorithm
The Spiral Flower pattern is generated by placing circles along an Archimedean Spiral:
It uses the polar coordinate system, which defines a point by a distance r (radius) from the pole (origin) and an angle θ (theta) from the positive x-axis, represented as (r, θ).
This system is often used for circular symmetries, whereas Cartesian uses (x, y) for horizontal and vertical distances.
For each stepᵢ, each circleᵢ sits at (r, θ)ᵢ = (i × Δr, i × Δθ) and the circle's radius grows linearly from ○∧ to ○∨.
The polar coordinate (r, θ) is converted to Cartesian (x, y) coordinates using (x, y) = (r × cos(θ), r × sin(θ)) (the inverse conversion (r, θ) = (√(x²+y²), arctan(y/x)) is not used here).
The value of Δθ (with θ = frac(Δθ) × 360°) controls the pattern — rational fractions produce spokes, irrational ones fill the spiral more evenly.
How uniform the packing is depends on "how irrational" the number is — an irrational number with a good rational approximation will still create easily recognizable spokes, like π ≈ 22/7 or 355/113. The golden ratiofrac(φ) ≈ 0.618 gives the densest uniform packing — the sunflower pattern found in nature.
Page Creation
The whole page was created with Claude Code. These were the most significant prompts that shaped this page:
Create a D3 webpage with a center circle and a spiral using polar coordinates, theta += deltaTheta, radius += deltaRadius, count = 100
Add an input and slider to control deltaTheta
Change theta from degrees to radians
Change the input and slider to a fraction of 2π (0.5 = π, 1 = 2π)