Skip to content

PlaygroundSignals · 02

Drawing with circles

Shape

Circles

Each circle turns a whole number of times per lap, and they are added tip to tail.

What's going on

Imagine a pen going once around a drawing. That movement can be rebuilt from circles: a big, slow one for the overall shape, and smaller, faster ones spinning on top of it, each carried by the one before, for the details.

This is Fourier's idea again, the one from Harmonics: complicated motion as a sum of simple rotations. A handful of circles gives a soft sketch; the sharp corners need many tiny, fast ones. Keeping only the biggest circles and dropping the rest is the same idea compression formats like MP3 and JPEG use: keep what matters most, throw away detail you will not miss.

Press Listen and the drawing becomes a sound, with the left and right ears following the pen. With fewer circles the sound gets duller, because fewer circles means fewer harmonics.

Why it matters: describing a shape, an image or a sound by a few of its strongest frequencies is how much of signal processing and compression works, from audio codecs to medical imaging.

The maths behind itFor the curious · formulas and details

Write the drawing as a moving point in the complex plane, z(t) = x(t) + i·y(t), going once around for t from 0 to 1. Its Fourier series is a sum of rotating circles:

z(t) = Σ cₙ · e^(2πi·n·t)    cₙ = ∫₀¹ z(t) · e^(−2πi·n·t) dt

Circle n turns n times per lap (negative n turns the other way), with radius |cₙ| and starting angle arg cₙ. Since e^(iθ) = cos θ + i·sin θ, every circle is a pair of sine waves, which is why the same maths describes harmonics.

Why the biggest circles are the best choice

The circles eₙ(t) = e^(2πi·n·t) are an orthonormal basis, so the squared error of any partial sum is exactly the energy of the terms left out:

‖z − Σ_(n∈S) cₙ·eₙ‖² = Σ_(n∉S) |cₙ|²

To draw as accurately as possible with K circles, keep the K with the largest radius. That is what the circle buttons do. Here the drawing is sampled at 400 points, so the transform is discrete and all 400 circles pass exactly through all 400 points.