Trait kurbo::ParamCurveArea[][src]

pub trait ParamCurveArea {
    fn signed_area(&self) -> f64;
}

A parametrized curve that can have its signed area measured.

Required methods

fn signed_area(&self) -> f64[src]

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.

Loading content...

Implementors

Loading content...