Turn a needle all the way around in a disk, a deltoid, then sprouting Perron trees.
Kakeya asked in 1917 for the smallest region in which a unit needle can be turned through 180 degrees. A disk needs pi/4, a three-point turn in a triangle 1/sqrt(3), and the deltoid pi/8, with the needle always tangent. Besicovitch showed there is no minimum, and this demo builds his sets: each corner fan of the triangle is cut into 2^n thin triangles that are slid together level by level (the Perron tree construction), and the union's area is measured live with scanlines. The needle pivots inside each sliver and hops between them with Pál joins, sliding about 200 needle lengths out along its own line so the hop costs almost no area. The trees beat the triangle at n = 5 and the deltoid at n = 8, and the area keeps falling, slowly, toward zero.
Try it. Click a construction in the panel (or press 1 to 4) to watch the needle turn in it. Drag the n slider or use the arrow keys to sprout more triangles and see the area meter and chart respond. Space pauses, R restarts the turn.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build an animated illustration of the Kakeya needle problem with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
The problem: what is the smallest area in which a needle of length 1 can be turned all the way around (through 180 degrees)?
Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens, and maps world coordinates (units of the needle length, y up) to the screen.
- Show three solutions one after another. A disk of diameter 1: spin the needle about its center. An equilateral triangle of height 1: pivot 60 degrees about a corner, slide along a side to the next corner, and repeat three times. The deltoid z(t) = r (2e^(it) + e^(-2it)) with r = 1/4: the needle's ends are z(s) and z(s + pi), and as s goes from 0 to pi the needle turns all the way around while staying tangent.
- Animate the needle as a list of motion segments (rotate about a point, or slide along a vector) played back in order.
- Show each shape's area beside it: pi/4, 1/sqrt(3) and pi/8.
Once that works, make it beautiful:
- Give it the look of an old engraving: cream paper, sepia ink, shapes filled with fine hatching clipped to their outline, and a steel needle with an eye at one end.
- Leave a fading trail of the needle's recent positions so you can see the region it sweeps.
- Draw an area meter with a bar for each shape.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as Perron trees that cut the triangle into 2^n slivers and slide them together to shrink the area, Pál joins that move the needle between parallel lines at almost no cost, or measuring the union's area with scanlines.