Skip to main content

classify_uv

Function classify_uv 

Source
pub fn classify_uv(uv: &[(f64, f64)]) -> EdgeLink
Expand description

Classify a projected polyline (in plane (u, v)) as a straight line, a circle / arc, or a polyline fallback. Tolerances are RELATIVE to the polyline’s extent so the same thresholds work at any sketch scale:

  • STRAIGHT when every interior sample lies within 1e-4·extent of the chord between the endpoints (a 2-sample polyline is trivially straight).
  • CIRCULAR when a circle fit through 3 well-spaced samples has a max radial residual under 1e-3·extent (and a non-degenerate radius). Coincident endpoints → a closed Circle; else an Arc.
  • else the Polyline fallback.