[−][src]Trait geo::algorithm::convexhull::ConvexHull
Required methods
fn convex_hull(&self) -> Polygon<T> where
T: Float,
T: Float,
Returns the convex hull of a Polygon. The hull is always oriented counter-clockwise.
This implementation uses the QuickHull algorithm, based on Barber, C. Bradford; Dobkin, David P.; Huhdanpaa, Hannu (1 December 1996) Original paper here: http://www.cs.princeton.edu/~dpd/Papers/BarberDobkinHuhdanpaa.pdf
Examples
use geo::{line_string, polygon}; use geo::convexhull::ConvexHull; // an L shape let poly = polygon![ (x: 0.0, y: 0.0), (x: 4.0, y: 0.0), (x: 4.0, y: 1.0), (x: 1.0, y: 1.0), (x: 1.0, y: 4.0), (x: 0.0, y: 4.0), (x: 0.0, y: 0.0), ]; // The correct convex hull coordinates let correct_hull = line_string![ (x: 4.0, y: 0.0), (x: 4.0, y: 1.0), (x: 1.0, y: 4.0), (x: 0.0, y: 4.0), (x: 0.0, y: 0.0), (x: 4.0, y: 0.0), ]; let res = poly.convex_hull(); assert_eq!(res.exterior(), &correct_hull);
Implementors
impl<T> ConvexHull<T> for LineString<T> where
T: Float,
[src]
T: Float,
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull<T> for MultiLineString<T> where
T: Float,
[src]
T: Float,
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull<T> for MultiPoint<T> where
T: Float,
[src]
T: Float,
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull<T> for MultiPolygon<T> where
T: Float,
[src]
T: Float,
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull<T> for Polygon<T> where
T: Float,
[src]
T: Float,