How 50 states find their places
Each state is resized until its area matches its seat count, then moved into a hand-drawn slot, then pushed apart until nothing touches. Step through it below — the map is the real geometry the build produces, not a diagram of it.
Why the collision test is the whole problem
Once states are sized to their seat counts they collide, and something has to push them apart. Every reasonable solver does roughly the same thing; what decides the outcome is what you call a collision. Measured over the same 1,225 state pairs:
| Collision test | Pairs it flags | States moved | Result |
|---|---|---|---|
| One circle per state (d3.forceCollide) | 80 | — | Demands 117px of separation. The country comes apart. |
| One box per state (rectangle cartogram) | 34 | 37 of 50 | Tennessee ends up between Kentucky and North Carolina. |
| The outlines themselves | 1 | 2–4 | Correct, but the gap is whatever falls out. |
| A chain of discs along each outline | 1 | 3–11 | Correct, and the gap is a number you set. |
California is why. It is a diagonal sliver whose bounding circle has a 148px radius against a 155px width, so a circle test believes it collides with half the West. Its bounding box overlaps Nevada's while the shapes come nowhere near each other.
Where placement sits in the build
Placement is one stage of a longer pipeline. mapshaper owns anything topological — projection, simplification, dissolve, polygon intersection. Base R owns everything numerical, with no packages beyond what ships with R.
The three highlighted steps are what this page covers. Everything downstream — subdividing each state into equal-area district cells, matching those cells to real districts — happens inside the shapes once they have stopped moving.