Skip to main content

MITER_LIMIT

Constant MITER_LIMIT 

Source
pub const MITER_LIMIT: f32 = 4.0;
Expand description

The sharpest corner a miter is drawn for, as a multiple of the half-width the miter would reach (ADR-0158).

A corner of interior angle theta needs width / sin(theta / 2), which grows without bound as the corner sharpens: a spike that doubles back on itself would reach to infinity and paint a spear across the frame. Past the limit the joint reverts to the flat half-width — a bevel, which is what stroke-miterlimit selects in SVG and what an unmitred joint always drew. It is a fallback and not a truncation: clamping to MITER_LIMIT * width instead leaves the stroke reaching four half-widths past the vertex along its own direction, which reads as a burr rather than as a corner.

4.0 is adopted, not measured. It is SVG’s stroke-miterlimit default, and it draws exactly every corner at or above 2 * asin(1 / 4) = 28.96 degrees — that is the angle at which 1 / sin(theta / 2) reaches 4, so the limit is a statement about which corners are mitred and which are bevelled, not a tuned number (ADR-0071). diamond’s 61.9-degree vertex needs 1.9437 and is well inside it; a Maurer chord web’s near-reversals are the population outside it.