Trait geo::algorithm::centroid::Centroid
[−]
[src]
pub trait Centroid<T: Float> { type Output; fn centroid(&self) -> Self::Output; }
Calculation of the centroid.
Associated Types
type Output
Required Methods
fn centroid(&self) -> Self::Output
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
impl<T> Centroid<T> for Line<T> where
T: Float, type Output = Point<T>;impl<T> Centroid<T> for LineString<T> where
T: Float, type Output = Option<Point<T>>;impl<T> Centroid<T> for Polygon<T> where
T: Float + FromPrimitive, type Output = Option<Point<T>>;impl<T> Centroid<T> for MultiPolygon<T> where
T: Float + FromPrimitive, type Output = Option<Point<T>>;impl<T> Centroid<T> for Bbox<T> where
T: Float, type Output = Point<T>;impl<T> Centroid<T> for Point<T> where
T: Float, type Output = Point<T>;