⭕ Apollonius Gasket — Fractal Circle Packing
Fill gaps between three mutually tangent circles recursively with new tangent circles using the Descartes Circle Theorem: (k1+k2+k3+k4)^2 = 2(k1^2+k2^2+k3^2+k4^2).
About Apollonius Circles
An Apollonius gasket (Apollonian gasket) is an infinitely complex fractal built from mutually tangent circles. Starting with three mutually tangent circles, Descartes' Circle Theorem — (k₁+k₂+k₃+k₄)² = 2(k₁²+k₂²+k₃²+k₄²) where k = 1/radius — uniquely determines the curvature of a fourth circle tangent to all three. Each new circle creates three new gaps, which are filled recursively, generating a self-similar pattern whose Hausdorff dimension is approximately 1.3057. When the initial four curvatures are integers, every subsequent curvature in the entire infinite gasket is also an integer — a remarkable number-theoretic property connecting circle packing to the theory of quadratic forms.
Scroll to zoom and drag to pan the canvas. The Max depth and Min radius sliders control how many recursion levels are rendered before circles become too small to draw. Four colour palettes (Violet, Spectrum, Ember, Ice) colour each circle by its generation depth, making the fractal hierarchy immediately visible. Choose from four seed configurations — including the classic integer packing with curvatures −1, 2, 2, 3 — to see how the initial geometry shapes the final pattern.
Frequently Asked Questions
What exactly is Descartes' Circle Theorem?
Published by René Descartes in a 1643 letter to Princess Elisabeth of Bohemia, the theorem states that if four circles are mutually tangent their curvatures k₁, k₂, k₃, k₄ satisfy (k₁+k₂+k₃+k₄)² = 2(k₁²+k₂²+k₃²+k₄²). Solving for k₄ gives k₄ = k₁+k₂+k₃ ± 2√(k₁k₂+k₂k₃+k₃k₁), yielding two solutions — the two circles that can be tangent to the given triple.
Why is the outer bounding circle given negative curvature?
Curvature k = 1/r is positive when a circle curves towards its own interior (ordinary circles), and negative when the other circles are packed inside it. The outer bounding circle encloses everything, so the packed circles touch its inner surface. Using k = −1/r for the outer circle makes Descartes' theorem work correctly with the same formula for all configurations.
What is the Hausdorff dimension of an Apollonius gasket?
The Hausdorff dimension of an Apollonian gasket is approximately 1.3057, independent of which initial configuration was chosen — a value rigorously established by Thomas McMullen in 1998. It lies between 1 (a curve) and 2 (a filled area), reflecting the fact that the gasket fills the plane neither as sparsely as a curve nor as densely as a solid region.
What are Apollonian integers and why are they remarkable?
When the first four curvatures are integers, every curvature generated by the recursion is also an integer, proved directly from Descartes' theorem. The classic example starts with −1, 2, 2, 3 and produces circles with curvatures 6, 11, 14, 15, 18, 23, … Which positive integers appear is an active research question connected to quadratic forms and thin groups in number theory.
How is the centre of each new tangent circle computed?
The complex extension of Descartes' theorem gives the centre via k₄z₄ = k₁z₁ + k₂z₂ + k₃z₃ ± 2√(k₁k₂z₁z₂ + k₂k₃z₂z₃ + k₃k₁z₃z₁), where z = x + iy encodes each circle's centre. This elegant formula computes both the position and the two tangent-circle choices in one step, discovered by Philip Beecroft (1842) and later by Frederick Soddy (1936).
Who was Apollonius of Perga and what did he actually prove?
Apollonius (c. 262–190 BC) was a Greek mathematician from Perga in modern Turkey, best known for his eight-book treatise Conics. His lost work On Tangencies addressed finding circles tangent to three given circles — the Problem of Apollonius — which has up to eight solutions. The gasket named after him was formalised much later using Descartes' curvature formula.
Is there a connection between Apollonian gaskets and hyperbolic geometry?
Yes — a deep one. The tangency points of an Apollonian gasket form the limit set of a Kleinian group — an infinite group of Möbius transformations of the Riemann sphere. The gasket lives on the boundary of hyperbolic 3-space, and the packing symmetries are the isometries of a hyperbolic tetrahedron. This has driven major advances in spectral theory and ergodic theory on hyperbolic manifolds.
Why does the simulation stop before circles become infinitely small?
The recursion is theoretically infinite, but circles below about 1 pixel in screen radius are imperceptible. The simulation halts when a circle's screen radius falls below the minimum radius threshold. Decreasing the threshold reveals more fractal detail at the cost of longer computation; the depth slider adds an independent hard cap to prevent runaway recursion.
What is Soddy's hexlet and how is it related?
Soddy's hexlet (1936) is a 3D analogue: given two spheres internally tangent to a third, exactly six spheres can be simultaneously tangent to all three and to each other, forming a ring. Frederick Soddy discovered this and announced it in a poem in Nature alongside the 3D Descartes theorem for spheres — both the hexlet and the Apollonian gasket are manifestations of the same inversive geometry.
What is the connection between Apollonian packings and number theory?
Apollonian packings have deep connections to the Local-Global Conjecture: it is conjectured (and partially proved by Bourgain, Kontorovich and others) that every sufficiently large integer satisfying a finite set of congruence conditions actually appears as a curvature. The packing group is a "thin group" in the sense of number theory, making this one of the most active research frontiers in arithmetic geometry.
How do the palette colours map to fractal depth?
Each circle is assigned a generation depth (0 for the seed circles, 1 for the first new circles, and so on). The palette function maps depth linearly to a hue or brightness value, so the oldest, largest circles have one colour and the newest, smallest circles have another. This makes the recursive structure immediately perceptible — each visible colour boundary marks one step deeper in the infinite hierarchy.
Fill gaps between three mutually tangent circles recursively with new tangent circles using the Descartes Circle Theorem: (k1+k2+k3+k4)^2 = 2(k1^2+k2^2+k3^2+k4^2).
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install