Find the nearest floor edge without reading every edge

Dragging an agent snaps its cone out of wall ink and back onto the floor
(standablePointNear). When the point was off the floor, _pulledIn looked
for the nearest edge of the floor footprint by measuring every edge of it:
9,000 to 13,500 edges on Lotus, Breeze, Bind and Ascent, with an Offset
allocation and a modulo per edge. On the web, where no native library
runs, that cost 384 us per drag frame in a browser CPU profile of the
drag harness (5.7% of busy time).

The footprint already files its edges in rows one unit tall for its
containment test. The nearest-edge search now reads those rows outward
from the point's own and stops once the nearest edge found is no farther
than the rows not yet read; an edge outside them is more than that far.
Ties still go to the first edge in ring order, and a non-finite point
reads every edge in order as before, so the chosen edge, foot and
snapped point are the same. Edge endpoints are kept in one Float64List
that the containment test and the search both read.

Measured on the four maps above:
- Browser drag (CPU profile, 4 maps x 8 s): 384 -> 83 us per frame
  under standablePointNear.
- Browser, per call on drag paths through walls: mean 190-310 -> 10-17
  us, p99 575-935 -> 60-115 us.
- VM, per call: mean 170-220 -> 10-17 us, p99 790-1170 -> 80-120 us.

An old-against-new comparison over 299,234 points on all 26 map sides
(drag paths, points beside wall and floor vertices, off-map, NaN and
infinite points) found no difference in the snapped point.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
be6b59525dDara Adedeji committed on 10/6/2026, 3:44:12 AMparent0fca2d1

Checks

Some checks failed
1 file changedLine totals unavailable