Fourier epicycles
Any shape redrawn by spinning circles: draw it, upload it, or pick a country or a city loop.
The numbers
Each circle is one sine wave in x and one in y. Turn on component sines and add them one at a time.
Live spectrum of music. Nothing starts until you pick a sound.
How it works
The shape is walked once at an even pace and sampled at 1,024 points, each one a complex number z = x + iy. The discrete Fourier transform turns those points into 1,024 spinning arrows. Arrow k turns k times per loop (negative k turns backwards), its length is |ck| and its starting angle is arg ck.
Put the arrows tip to tail, biggest first, and let them spin: the last tip traces the shape. A few big circles give the rough outline; the many small ones add the corners and the wiggly coast. The error left after N circles is just the energy of the circles left out.
Hear the shape plays the fit as sound: x goes to the left ear and y to the right, one loop 110 times a second. Every circle is one harmonic of that note, so adding circles adds overtones, and on an oscilloscope in XY mode the sound draws the shape back. More in oscilloscope music.
Any closed curve at all, a coastline, a city loop or your own scribble, is only a sum of circles turning at whole-number speeds.
Challenges
Fewest circles
The fit readout hides. Slide the circles down to the fewest you think still give a 95% fit, then lock it in.
Guess the shape
A country is drawn by circles only, one more every second or so. Name it early for more points.
Every visited country
Fit the outline of every country on the atlas. Tap a flag to load it.