use crate::{Coordinate, CoordinateType};
/// A bounded 2D quadrilateral whose area is defined by minimum and maximum `Coordinates`.
#[derive(PartialEq, Clone, Copy, Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Rect<T>
where
T: CoordinateType,
{
pub min: Coordinate<T>,
pub max: Coordinate<T>,
}
impl<T: CoordinateType> Rect<T> {
pub fn width(self) -> T {
self.max.x - self.min.x
}
pub fn height(self) -> T {
self.max.y - self.min.y
}
}