[][src]Trait geo::algorithm::extremes::ExtremeIndices

pub trait ExtremeIndices<T: Float + Signed> {
    fn extreme_indices(&self) -> Result<Extremes, ()>;
}

Required methods

fn extreme_indices(&self) -> Result<Extremes, ()>

Find the extreme x and y indices of a convex Polygon

The polygon must be convex and properly (ccw) oriented.

Examples

use geo::extremes::ExtremeIndices;
use geo::polygon;

// a diamond shape
let polygon = polygon![
    (x: 1.0, y: 0.0),
    (x: 2.0, y: 1.0),
    (x: 1.0, y: 2.0),
    (x: 0.0, y: 1.0),
    (x: 1.0, y: 0.0),
];

// Polygon is both convex and oriented counter-clockwise
let extremes = polygon.extreme_indices().unwrap();

assert_eq!(extremes.ymin, 0);
assert_eq!(extremes.xmax, 1);
assert_eq!(extremes.ymax, 2);
assert_eq!(extremes.xmin, 3);
Loading content...

Implementors

impl<T> ExtremeIndices<T> for MultiPoint<T> where
    T: Float + Signed
[src]

impl<T> ExtremeIndices<T> for MultiPolygon<T> where
    T: Float + Signed
[src]

impl<T> ExtremeIndices<T> for Polygon<T> where
    T: Float + Signed
[src]

Loading content...