pub trait BoundingRect<T: CoordNum> {
type Output: Into<Option<Rect<T>>>;
// Required method
fn bounding_rect(&self) -> Self::Output;
}
Expand description
Calculation of the bounding rectangle of a geometry.
Required Associated Types§
Required Methods§
Sourcefn bounding_rect(&self) -> Self::Output
fn bounding_rect(&self) -> Self::Output
Return the bounding rectangle of a geometry
§Examples
use geo::BoundingRect;
use geo::line_string;
let line_string = line_string![
(x: 40.02f64, y: 116.34),
(x: 42.02f64, y: 116.34),
(x: 42.02f64, y: 118.34),
];
let bounding_rect = line_string.bounding_rect().unwrap();
assert_eq!(40.02f64, bounding_rect.min().x);
assert_eq!(42.02f64, bounding_rect.max().x);
assert_eq!(116.34, bounding_rect.min().y);
assert_eq!(118.34, bounding_rect.max().y);