HomeJournalThis post

Apollonian Gasket Art by Curvature

A curvature-led circle-packing study with a tested solver, duplicate controls, scale-aware recursion, visual hierarchy, and material proof.

JP
JP Casabianca
UI/UX designer and full-stack engineer · Bogotá

Apollonian gasket art begins with four mutually tangent circles and keeps filling each curved triangular gap with another tangent circle. The recursion can become hypnotic, but its real design material is curvature: radius, density, visual weight, and stopping depth all share one measurable axis.

This field note separates a verified packing from the crop, tone, and production choices layered over it. The numerical examples are worked fixtures; physical results belong to the output process you actually test.

Curvature fills every tangent gapOne enclosing circle contains three tangent circles and a hierarchy of smaller circles in their curved gaps. A highlighted chain shows increasing curvature. CURVATURE ↑stop below output radius
  • Curvature fills every tangent gap
  • Construction logic
  • Interpretive outcome
Figure 1: Curvature rises as circles shrink. The output threshold, not an arbitrary recursion count, decides which circles remain visible in the edition.

Apollonian gasket art starts with signed curvature

Curvature is the reciprocal of radius. For an enclosing circle, a common oriented convention uses negative curvature; the interior circles use positive curvature. Four mutually tangent circles satisfy a quadratic relation often associated with Descartes. State the sign convention before computing another circle because a correct-looking radius under the wrong orientation can place the solution on the wrong side of the gap.

The paper on Apollonian circle packings provides mathematical grounding for the packing's structure and arithmetic. The artifact uses the scalar Descartes circle theorem only to test candidate curvatures. A production solver also needs centers, often handled with complex coordinates or geometric intersection, and must verify tangency after placement.

For a simple equal-curvature fixture (1,1,1), the two candidate curvatures are (3 pm 2sqrt{3}). One identifies the small circle inside the gap; the other corresponds to the alternate solution. Apollonian gasket art should keep both mathematical candidates available until orientation and existing-circle identity select the correct geometric branch.

Runnable artifact: The curvature fixture checks the two Descartes branches, permutation invariance, radius conversion, increasing curvature, zero-curvature handling, and repeatability before center geometry is added.

Save this worked fixture as apollonian-curvature.test.mjs and run node apollonian-curvature.test.mjs. Expected final line: PASS: 10 curvature assertions.

import assert from "node:assert/strict";
const nextCurvature=(a,b,c,sign=1)=>a+b+c+sign*2*Math.sqrt(a*b+b*c+c*a);
const radius=k=>1/Math.abs(k);
let n=0;const check=fn=>{fn();n++};
check(()=>assert.equal(nextCurvature(1,1,1),3+2*Math.sqrt(3)));
check(()=>assert.equal(nextCurvature(1,1,1,-1),3-2*Math.sqrt(3)));
check(()=>assert.equal(radius(2),.5));
check(()=>assert.equal(radius(-1),1));
check(()=>assert.ok(nextCurvature(2,3,6)>6));
check(()=>assert.ok(Number.isFinite(nextCurvature(2,3,6))));
check(()=>assert.equal(nextCurvature(2,3,6),nextCurvature(6,2,3)));
check(()=>assert.throws(()=>{if(radius(0)===Infinity)throw Error("line")},/line/));
check(()=>assert.ok(radius(nextCurvature(2,3,6))<radius(6)));
check(()=>assert.equal(nextCurvature(1,1,1),nextCurvature(1,1,1)));
assert.equal(n,10);console.log("PASS: 10 curvature assertions");

Solve centers, then test tangency directly

Given a valid curvature, compute the candidate center using a declared method and orientation. Then measure distance between centers against the sum or signed difference of radii for every required tangent pair. Use a relative tolerance tied to coordinate scale. Reject NaNs, negative physical radii, and solutions that duplicate an existing circle within canonical tolerance.

The integral Apollonian packings paper explores the rich arithmetic structure of these systems. An art implementation may select integer-curvature seeds as a visual grammar, but it should not imply that every floating packing inherits those number-theoretic properties. Tangent-circle packing is the visible constraint; arithmetic classification is an optional, cited layer.

Store each circle with ID, center, signed curvature, radius, parent gap, generation, and three tangent neighbor IDs. Build a canonical gap key from sorted neighbor IDs. Once filled, mark that gap closed.

This prevents the same geometric circle from being rediscovered through different recursion paths. Apollonian gasket art needs this topological ledger because duplicate strokes can darken tiny regions and masquerade as intentional density.

ControlExpectedDetectsResponse
Three equal seed circlesknown curvature pairbranch/sign errorreject solver
Neighbor permutationsame candidatesorder dependencecanonicalize gap
Repeated gapno new circleduplicate recursionclose key
Below 0.4 pxnot emittedsubpixel overloadstop output
Figure 2: Each control isolates a distinct failure. A plausible image can still contain a wrong branch, duplicate gap, or visually meaningless subpixel recursion.

Stop recursion in visible units

A generation limit is convenient but not portable. The same depth produces very different visible detail under another seed, crop, or output size. Stop when projected radius falls below a minimum pixel, print point, pen width, or material feature.

Also cap circles, queue size, time, and numeric condition. Record which limit ended generation.

Use a priority queue ordered by projected radius so the most visually consequential gaps fill first. This supports progressive rendering and a graceful budget: if time expires, the image has all larger circles rather than a random subset of deep branches. Recursive circle art becomes art-directable when computational priority matches visible importance.

Quadtree mosaics offers a parallel lesson: subdivision should spend detail where the image and output can show it. Apollonian gasket art uses curvature rather than image error, but both need output-aware stopping. Test a tiny canvas, a large print, 200% zoom, and a very deep requested threshold. The generator should degrade by omitting invisible circles, not by freezing the interface or emitting an enormous inaccessible DOM.

  1. 1Choose seed

    Set enclosing geometry, initial tangencies, orientation, and symmetry.

  2. 2Grow by scale

    Fill canonical gaps largest first until the output threshold or budget stops.

  3. 3Map curvature

    Assign line, fill, tone, omission, and hierarchy from named curvature bands.

  4. 4Proof material

    Inspect smallest circle, dense gaps, crop tangencies, and production artifacts.

Figure 3: A packing becomes a composition through seed choice, visible-scale growth, tonal mapping, and proof. Recursion remains deterministic while visual roles stay editable.

Compose with curvature bands, not random color

Map large circles to structural anchors, middle circles to rhythm, and the smallest retained circles to texture. A three-band system can vary stroke, fill, opacity, or palette while keeping one variable responsible for meaning. Avoid scaling stroke exactly with radius until tiny circles vanish; a clamped stroke often preserves the packing while still letting large boundaries dominate.

Three purposeful editions can share one seed. “Contour” uses open circles and generous stopping radius. “Sediment” fills curvature bands with increasing tone.

“Eclipse” omits selected large interiors to make negative space collide with dense recursive edges. Apollonian gasket art proves authorship when those variants change spatial reading, not merely hue.

Voronoi stippling density distributes points to represent tone, while this system recursively fills tangent gaps; compare their density signatures instead of blending the methods without explanation. Superformula generative art treats parameter neighborhoods as a shape grammar. Here, seed curvatures and the output threshold form the grammar, and curvature-based composition keeps every visual role connected to the solver's native quantity.

Use inversion as a design and debugging lens

Circle inversion maps generalized circles to circles or lines and preserves tangency under suitable conditions. The Geometry Junkyard note on inversion and tangencies gives a concise route into that geometry. Inversion can turn a nested packing into a chain-like composition, reveal relationships, or offer an independent check that tangent pairs remain tangent after transformation.

Keep the inversion center away from sampled circle boundaries unless the line case is intentionally supported. A circle through the inversion center maps to a line, so code that only emits finite-radius circles must reject or explicitly represent that branch. Label the transformed edition; it is not the same crop under a lens effect. Apollonian gasket art benefits from transformations when their geometric invariants remain visible and documented.

Use inversion after the source packing validates. Preserve source circle IDs, transformed geometry, inversion center and radius, singular cases, and tangency residuals. This separation lets a reviewer decide whether a strange arc came from the packing or the transformation. It also creates composition families without restarting recursion until an attractive random result appears.

Proof circles as strokes, pixels, or paths

SVG can represent each circle semantically for a bounded explanatory sample, but a deep packing may require one combined path, canvas, or raster export. Retain the circle ledger independently from the rendering strategy. Provide a concise description of nesting, density, crop, and palette, plus a parameter table. Thousands of announced “circle” elements are not meaningful accessibility.

For plotting, circle approximation, chord error, pen width, travel, drying, and repeated boundary passes matter. Pen plotter hatching provides the physical receipt mindset: test the smallest retained radius and densest gap at one-to-one scale. For print, inspect moiré, fill gain, knockout, rasterization, and trim tangencies. A crop that nearly kisses a large circle can look like a registration error even when coordinates are exact.

Apollonian gasket art should have a static fallback and bounded interaction. A depth slider can update progressively, but reduced motion uses the final still. Loss of canvas should reveal the explanatory SVG or verified image, not a blank panel. Export dimensions and color profile belong in the edition manifest because visible stopping and tonal balance depend on them.

Publish the packing and its visual edit separately

The geometry receipt records seed circles, orientation, curvature convention, solver, tolerances, gap keys, circle count, stopping thresholds, duplicate checks, tangency residuals, and code revision. The visual receipt records crop, curvature bands, omissions, strokes, palette, renderer, output, accessibility text, and material proof. Apollonian gasket art remains reproducible because an aesthetic revision does not rewrite its mathematical source.

Reject a release with unexplained duplicate circles, high tangency error, a singular transformation hidden as a huge radius, subpixel overload, or styling that erases the packing's hierarchy. Retain a plain-outline control. If the decorated image is compelling only when the underlying geometry is invisible, call it circle-inspired texture rather than presenting solver validity as its thesis.

The strongest edition rewards three distances. Across a room, a few enclosing arcs organize the page. At hand distance, middle circles create rhythm and direction.

Up close, recursion dissolves into a mineral edge that stops exactly where the medium stops carrying it. The receipt makes that limit intentional: curvature generated the field, and material scale decided when the field was complete.