[−][src]Trait geo::algorithm::convex_hull::ConvexHull
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::algorithm::convex_hull::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);
Associated Types
type Scalar: CoordinateType
Required methods
fn convex_hull(&self) -> Polygon<Self::Scalar>
Implementors
impl<T> ConvexHull for LineString<T> where
T: HasKernel,
[src]
T: HasKernel,
type Scalar = T
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull for MultiLineString<T> where
T: HasKernel,
[src]
T: HasKernel,
type Scalar = T
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull for MultiPoint<T> where
T: HasKernel,
[src]
T: HasKernel,
type Scalar = T
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull for MultiPolygon<T> where
T: HasKernel,
[src]
T: HasKernel,
type Scalar = T
fn convex_hull(&self) -> Polygon<T>
[src]
impl<T> ConvexHull for Polygon<T> where
T: HasKernel,
[src]
T: HasKernel,