Expand description
P11.8 — Arrangements, point-line duality, and topological sweep. P11.8 — Arrangements, point-line duality, and topological sweep.
The acceptance gate requires: “Full line arrangement has correct V/E/F counts, zone traversal matches a direct oracle, and dual transforms round-trip finite/non-vertical cases.”
§Algorithms
§Line arrangement
Given n lines, the arrangement is the planar subdivision induced by their
pairwise intersections. For n lines in general position (no three
concurrent, no two parallel):
- V =
n(n-1)/2intersection points. - E =
n²edges (each line is split intonsegments/rays by the othern-1lines, givingnedges per line ×nlines =n²). - F =
n(n-1)/2 + 1faces (by Euler: V − E + F = 2).
Unbounded edges (rays) are clipped to a bounding box enclosing all vertices with a margin, so the arrangement is treated as a bounded subdivision with a single unbounded face wrapping around the box.
§Zone traversal
The zone of a curve γ in an arrangement A is the sequence of faces
that γ passes through. For a line crossing an arrangement of n lines,
the zone has at most 2n faces (the Zone Theorem). The traversal finds
every intersection of γ with arrangement edges, sorts them along γ,
and reports the face between each consecutive pair by locating a
midpoint in the arrangement.
§Point-line duality
The standard point-line duality transform:
- Point
p = (a, b)↔ dual linep* : y = a·x − b. - Line
l : y = m·x + c↔ dual pointl* = (m, −c).
Key property: p is above l ⟺ l* is above p*. The round-trip
dual(dual(p)) = p holds for all finite, non-vertical cases.
§Zero-heap contract
Tier-2 cold construction (AGENTS.md §0-A): Vec during build; typed struct
output. The orientation predicate path is zero-heap.
Structs§
- Arrangement
- A line arrangement: the planar subdivision induced by a set of lines.
- Arrangement
Counts - Summary counts for verification.
- Arrangement
Edge - One edge of a line arrangement: a segment along one line between two vertices (or between a vertex and a bounding-box clip point for unbounded edges).
- Arrangement
Face - One face of a line arrangement: a polygon (possibly unbounded, clipped to the bounding box).
- Line2
- A 2-D line in slope-intercept form. Vertical lines have
is_vertical = trueand usex_constinstead of slope/intercept.
Enums§
Functions§
- build_
line_ arrangement - Build a line arrangement from a set of lines.
- dual_
incidence_ holds - Check the incidence-preserving property: point
pis on linel⟺ dual linep*passes through dual pointl*. - dual_
line_ to_ point - Dual of a non-vertical line
l : y = m·x + c: the point(m, −c). - dual_
point_ to_ line - Dual of a point
p = (a, b): the liney = a·x − b. - dual_
round_ trip - Round-trip the duality:
dual(dual(p))should equalpfor all finite, non-vertical points. - line_
line_ intersection - Compute the intersection point of two lines. Returns
Noneif parallel. - zone_
traversal - The zone of a query line through an arrangement: the sequence of face indices that the line passes through, in order along the line.
- zone_
traversal_ oracle - Brute-force zone traversal: for a fine sample of points along the query
line, locate the containing face. Returns the distinct face indices in
order of first encounter. Used as an independent oracle to verify
zone_traversal.