Skip to content

Commit

Permalink
further edits to doc
Browse files Browse the repository at this point in the history
  • Loading branch information
george-steel committed Jul 12, 2023
1 parent 59342a3 commit e9848e0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/param_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,29 @@ pub trait ParamCurveArclen: ParamCurve {
}
}

/// A parametrized curve that can have its signed area measured.
/// A parametrized curve (or a section of one) that can have its signed area measured.
pub trait ParamCurveArea {
/// Compute the signed (counterclockwise) area between the curve and the origin.
/// Equivalently, this is integral of the form `x*dy - y*dx` along the curve.
/// Equivalently (using Green's theorem),
/// this is integral of the form `(x*dy - y*dx)/2` along the curve.
///
/// For closed curves, this is the curve's area.
/// For open curves, this is the the area of the resulting shape that would be created if
/// the curve was closed with two line segments between the endpoints and the origin.
/// This allows the area of a piecewise curve to be computed by adding the areas of its segments,
/// generalizing the "shoelace formula."
///
/// For an open curve with endpoints `(x0, y0)` and `(x1, y1)`, this value
/// is also equivalent to `-intgral(y*dx) - (x0*y0 + x1*y1)/2`.
///
/// 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.
/// This can be computed exactly for Béziers,
/// 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.
fn signed_area(&self) -> f64;
}

Expand Down

0 comments on commit e9848e0

Please sign in to comment.