Trait geo::algorithm::centroid::Centroid [] [src]

pub trait Centroid<T: Float> {
    fn centroid(&self) -> Option<Point<T>>;
}

Calculation of the centroid.

Required Methods

See: https://en.wikipedia.org/wiki/Centroid

use geo::{Point, LineString};
use geo::algorithm::centroid::Centroid;

let mut vec = Vec::new();
vec.push(Point::new(40.02f64, 116.34));
vec.push(Point::new(40.02f64, 118.23));
let linestring = LineString(vec);

assert_eq!(linestring.centroid().unwrap(), Point::new(40.02, 117.285));

Implementors