Skip to main content

validate_arc_ring

Function validate_arc_ring 

Source
pub fn validate_arc_ring(
    ring: &ArcRing,
    tolerance: Tolerance,
) -> Result<(), OverlayError>
Expand description

Validate an arc ring against the same contract as crate::Ring, plus the arc-specific degeneracies.

Refused, each with a reason the caller can act on:

  • fewer than two vertices: a circle needs two, a polygon needs three, and one vertex cannot describe either
  • a polygonal ring with fewer than three vertices: two straight edges enclose no area
  • non-finite coordinates or a non-finite bulge
  • a zero-length edge, which leaves the arc centre undefined
  • an arc whose implied radius is below tolerance, the zero-radius case ADR 0050 flagged: such an arc is a point, not a boundary
  • a ring enclosing no measurable area: at most tolerance.linear()^2, decided exactly for a ring without arcs (one on a line included, as the arc path has no rule leaving it out), and from arc_ring_area otherwise (#274)

Self-intersection is NOT checked here: a cheap approximation would either reject valid input or pass invalid input. check_arc_polygon decides it exactly, for a ring and for the holes nested in it (#352).