Trait kurbo::ParamCurveArea

source ·
pub trait ParamCurveArea {
    // Required method
    fn signed_area(&self) -> f64;
}
Expand description

A parametrized curve that can have its signed area measured.

Required Methods§

source

fn signed_area(&self) -> f64

Compute the signed area under the curve.

For a closed path, the signed area of the path is the sum of signed areas of the segments. This is a variant of the “shoelace formula.” See: https://github.com/Pomax/bezierinfo/issues/44 and http://ich.deanmcnamee.com/graphics/2016/03/30/CurveArea.html

This can be computed exactly for Béziers thanks to Green’s theorem, and also for simple curves such as circular arcs. For more exotic curves, it’s probably best to subdivide to cubics. We leave that to the caller, which is why we don’t give an accuracy param here.

Implementors§