logo
pub trait Extremes<'a, T: CoordNum> {
    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

Implementors