FA-70609 / GIS polygon topology / Member archive
Douglas-Peucker simplification of a topology arc: first maximum tie-break · case 04
Among equally distant vertices the last one is kept, changing the simplified shape.
Case contract
Input [points, tol]: an arc as integer [x, y] positions (possibly closed, first == last). Keep both endpoints; recursively (explicit stack) find the interior vertex farthest from the SEGMENT between the current endpoints (projection clamped to the segment; distance to the point itself if the endpoints coincide), taking the first maximum; keep it and split when that distance is strictly greater than tol. Return kept positions in order.
Why this case matters
Shared arcs are simplified once so adjacent polygons stay gap-free; distance and split errors change which boundary vertices survive.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression #24 | [[0, 0], [3, 5], [4, 0], [20, 0]] | [[0, 0], [1, 5], [2, 0], [3, 5], [4, 0], [20, 0]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗