Expand description
The geometry of sketch entities, generic over Scalar so every formula
serves both the residuals (differentiated with crate::dual::Dual)
and plain evaluation (profiles, rendering).
An arc is stored as (start, end, sweep). Its signed curvature follows
from those as k = 2 sin(sweep / 2) / |end - start|, so (start, end, sweep) and (start, end, curvature) describe the same arc — but only the
sweep is smooth through a straight arc (k = 0) and a half circle, and
only the sweep tells a major arc from the minor arc with the same
curvature. The formulas below are written in the half sweep θ and never
divide by sin θ where avoidable, so a nearly straight arc stays
well-conditioned.
Every division and square root here is fallible — [Scalar::div] and
Scalar::sqrt refuse a divisor or radicand that could be zero/negative
— so a degenerate configuration (a zero-length chord, a collapsed arc)
surfaces as a GeopResult error instead of silently producing an
inf/nan that would then have to be caught downstream.
Structs§
- Arc
- A circular arc from
stoe, turning counter-clockwise by2 * half(clockwise if negative). - V
- A 2-D vector.
Functions§
- line_
distance - Signed distance of
pfrom the line throughaandb, positive on its left.