pub fn barycentre(
anchors: &[Point],
weights: &[f64],
) -> Result<Option<Point>, GeometryError>Available on crate feature
geometry only.Expand description
The weighted mean of anchors: (Σ wᵢ·xᵢ / Σ wᵢ, Σ wᵢ·yᵢ / Σ wᵢ), summed in index order.
Returns Ok(None) when every weight is zero or the slices are empty.
§Errors
CountMismatch (item "weights") when the slices differ in length, BadWeight for a weight that is negative or
not finite, NonFinitePosition for an anchor that is not finite. Items are named #<index>.