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.