Expand description
Chord deviation computation for circular arc discretization.
Given a circle of radius r, the chord deviation (sag) at the midpoint
of an arc subtending angle θ is r*(1 - cos(θ/2)). This module
provides the inverse: given a maximum deflection, compute the number
of segments needed to discretize an arc.
Two independent tolerances drive density: the linear sag deflection
and an angular cap angular_tol (max tangent turn per segment). The
linear criterion alone lets a small-radius arc take a near-π turn per
segment, under-tessellating sharp rounded features; the angular cap
floors the segment count independently of radius.
Constants§
- DEFAULT_
ANGULAR_ TOL - Default angular deflection cap (radians) when a caller has no preference.
Functions§
- segments_
for_ chord_ deviation - Compute the number of segments needed to discretize a circular arc
so that the chord-height deviation stays below
deflection. - segments_
for_ chord_ deviation_ with_ angle - Compute the number of segments to discretize a circular arc so that both
the chord-height deviation stays below
deflectionand the per-segment tangent turn stays belowangular_tol.