Trait geo::algorithm::centroid::Centroid
[−]
[src]
pub trait Centroid<T: Float> { fn centroid(&self) -> Option<Point<T>>; }
Calculation of the centroid.
Required Methods
fn centroid(&self) -> Option<Point<T>>
Calculation the centroid, see: https://en.wikipedia.org/wiki/Centroid
use geo::{Point, LineString, Coordinate}; use geo::algorithm::centroid::Centroid; let mut vec = Vec::new(); vec.push(Point::new(40.02f64, 116.34)); vec.push(Point::new(40.02f64, 116.34)); let linestring = LineString(vec); println!("Centroid {:?}", linestring.centroid());
Implementors
impl<T> Centroid<T> for LineString<T> where T: Float
impl<T> Centroid<T> for Polygon<T> where T: Float + FromPrimitive
impl<T> Centroid<T> for MultiPolygon<T> where T: Float + FromPrimitive
impl<T> Centroid<T> for Bbox<T> where T: Float