Skip to main content

Module curve

Module curve 

Source

Structs§

Curve
a curve: its origin (a point of it, so that the spans’ numbers stay small), its spans end to end, closed (its end joins its start)
Flat
the flattened curve: points (absolute), the arc length at each from the curve’s start, and for a closed one the length all around (where the closing segment ends)
Span
a rational Bézier span of degree 1 to 3: homogeneous control points (w x, w y, w) relative to the curve’s origin

Constants§

CURVE_MAX
the most segments of one curve (beyond: a coarser tolerance)
FLAT_TOL
the flattening’s tolerance at the finest scale of a zoom band (px): a chord lies at most this far inside its curve (2/3 of it on average); within a band and its hysteresis at most HYST times it (docs/RENDER2D.md “Kurven”)
FULL_MAX
a curve whose whole flattening takes more segments than this is flattened in view plus a margin only
HYST
a curve is flattened again when the scale leaves its band [2^b, 2^(b+1)) by more than this factor

Functions§

band_of
floor(log2(x)) for x > 0 (normal numbers), from its exponent
flatten
the curve’s points within tol (drawing units) of it; window (absolute, None: all of it): finely only where the spans meet it, max_leaf the longest chord there; None when it takes more than budget points
pow2
2^b