pub const POINT_ZERO: Point = Point { x: 0, y: 0 };
pub type Points = Vec<Point>;
#[derive(Copy, Clone, PartialEq)]
pub struct Point {
pub x: usize,
pub y: usize,
}
impl Point {
pub fn new(x: usize, y: usize) -> Point {
Point { x, y }
}
pub fn overlays(&self, p: Point) -> bool {
self.x == p.x && self.y == p.y
}
pub fn unwrap(&self) -> (usize, usize) {
(self.x, self.y)
}
}
impl std::fmt::Display for Point {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "({},{})", self.x, self.y)
}
}
impl std::fmt::Debug for Point {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "({},{})", self.x, self.y)
}
}