geo::algorithm::extremes

Trait Extremes

Source
pub trait Extremes<'a, T: CoordNum> {
    // Required method
    fn extremes(&'a self) -> Option<Outcome<T>>;
}
Expand description

Find the extreme coordinates and indices of a geometry.

§Examples

use geo::extremes::Extremes;
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),
];

let extremes = polygon.extremes().unwrap();

assert_eq!(extremes.y_max.index, 2);
assert_eq!(extremes.y_max.coord.x, 1.);
assert_eq!(extremes.y_max.coord.y, 2.);

Required Methods§

Source

fn extremes(&'a self) -> Option<Outcome<T>>

Implementors§

Source§

impl<'a, T, G> Extremes<'a, T> for G
where G: CoordsIter<Scalar = T>, T: CoordNum,