# Surface and platform anchors

Ground, ceiling, freestanding walls, and platforms use the same percentage
syntax: `(S.family-0)` is the start of an edge, `(S.family-50)` its midpoint,
and `(S.family-100)` its end. Any integer from 0 through 100 works. The node
name `S` is only needed when another command refers to its anchors.

`surface-0..100` always follows the usable contact face. For ground and every
platform floor it runs left to right across the top. For ceiling it runs left
to right across the underside. For either freestanding wall it runs bottom to
top: on the right face of `wall-left`, and on the left face of `wall-right`.
The named anchor `surface` is the midpoint of that contact face.

## Edge map

All horizontal edge families run left to right. All vertical edge families
run bottom to top. A platform wall's long edges run from root to free tip;
its short edges run from the contact side to the back side.

| Shape | Contact family | Other boundary families | Useful named anchors |
| --- | --- | --- | --- |
| `ground` | `surface` (top) | `bottom`, `left`, `right` | `surface`, `top-left`, `top-right`, `bottom-left`, `bottom-right` |
| `ceiling` | `surface` (underside) | `top`, `left`, `right` | `surface`, the four corners |
| `wall-left` | `surface` (right face) | `left`, `top`, `bottom` | `surface`, the four corners |
| `wall-right` | `surface` (left face) | `right`, `top`, `bottom` | `surface`, the four corners |
| `platform-left` or `platform-right` | `surface` (floor top) | Floor: `bottom`, `left`, `right`; wall: `wall-surface`, `wall-back`, `wall-base`, `wall-tip`; `transition` | `surface`, `floor-center`, `pulley-center`, `wall-root`, `wall-center` |
| `platform` (two walls) | `surface` (floor top) | Floor: `bottom`, `left`, `right`; each wall: `left-transition`, `left-wall-surface`, `left-wall-back`, `left-wall-base`, `left-wall-tip`, and the matching `right-` families | `surface`, `floor-center`, `left-pulley-center`, `right-pulley-center`, `left-wall-root`, `right-wall-root`, `left-wall-center`, `right-wall-center` |

`wall-surface` is the wall's contact side; `wall-back` is its opposite side.
`wall-base` spans the end at the root and `wall-tip` spans the free end.
`transition-0` is the projecting floor tip (`pulley-center`), while
`transition-100` is `wall-root`. On an ordinary sharp corner with zero inset
and drop, those two transition endpoints coincide.

For the two-wall platform, prefix every wall and transition family with
`left-` or `right-`. The floor families remain unprefixed. The same rule
applies to the named pulley, wall-root, and wall-center anchors.

## Show the anchors in a diagram

`show anchors` draws numbered red markers and a table mapping those numbers
to anchor names. Markers at the same position share a number. Select a few
families at a time to keep the drawing legible; `anchor samples` controls
which percentages are marked, not which percentages exist.

```latex
\begin{tikzpicture}
  \node[ground,ground width=7cm,show anchors,
    physics debug/anchor list={surface,top-left,top-right},
    physics debug/anchor families={surface,bottom,left,right},
    physics debug/anchor samples={0,50,100}] (G) {};
\end{tikzpicture}
```

Use one of these alternatives at a time for the other flat surfaces:

```latex
\node[ceiling,ceiling width=7cm,show anchors,
  physics debug/anchor families={surface,top,left,right},
  physics debug/anchor samples={0,50,100}] (C) {};

\node[wall-left,wall height=4cm,show anchors,
  physics debug/anchor families={surface,top,bottom,left},
  physics debug/anchor samples={0,50,100}] (WL) {};

\node[wall-right,wall height=4cm,show anchors,
  physics debug/anchor families={surface,top,bottom,right},
  physics debug/anchor samples={0,50,100}] (WR) {};
```

For a platform, inspect the floor and a wall in separate drawings if the
labels crowd one another. This example shows the left wall and its transition:

```latex
\node[platform-left,platform width=7cm,platform depth=2.5cm,
  wall angle=-135,wall inset=0.7cm,wall drop=0.5cm,
  show anchors,
  physics debug/anchor list={pulley-center,wall-root,wall-center},
  physics debug/anchor families={transition,wall-surface,wall-back,
    wall-base,wall-tip},
  physics debug/anchor samples={0,50,100}] (P) {};
```

Use `platform-right` with `wall angle=-45` for the mirrored wall. For a
two-wall `platform`, select `left-wall-surface` and its other `left-` families
or the corresponding `right-` families. To inspect the floor of any platform,
use `physics debug/anchor families={surface,bottom,left,right}`. To show every
family, set `physics debug/anchor families=all`; this is useful for checking a
shape, but it produces a larger table.

An upward wall meets the floor at a sharp corner. Use `wall angle=135` for a
left upward wall or `wall angle=45` for a right upward wall, with both
`wall inset` and `wall drop` left at zero. A positive inset or drop on an
upward wall would make its outline cross the floor and is rejected.

## Complete visual reference

The [13-page show-anchors gallery](surface-anchor-coverage.pdf) marks every
boundary family at 0, 50, and 100. Its copy-ready source is
[`examples/surface-anchor-coverage.tex`](../examples/surface-anchor-coverage.tex).
Pages 1–4 cover ground, ceiling, and both freestanding walls. Pages 5–8
separate the floor and wall anchors of the one-wall platforms. Pages 9–11
cover the two-wall platform. Pages 12–13 show clean upward corners on the
left and right. Compile the source from the package root with:

```sh
pdflatex -interaction=nonstopmode -halt-on-error examples/surface-anchor-coverage.tex
```

The gallery uses `show anchors` itself, so the red numbers and the table are
the same overlay available in your own TikZ picture.
