Skip to main content

triangle_coverage

Function triangle_coverage 

Source
pub fn triangle_coverage(px: f32, py: f32, half: f32, aa: f32) -> f32
Expand description

Upward triangle coverage as the intersection of three half-planes (bottom + two slanted sides). Each edge contributes a signed distance; the max is the convex polygon SDF (negative inside). Apex at (0, −half), base corners at (±half, +half). Robust + cheap — and identical to sdf.wgsl’s triangle.