use std::{fmt::Debug, fmt::Display, ops::Add};
#[derive(Clone, PartialEq)]
pub struct Point {
pub x: i32,
pub y: i32,
}
impl Add for Point {
type Output = Point;
fn add(self, other: Point) -> Point {
Point {
x: self.x + other.x,
y: self.y + other.y,
}
}
}
impl Display for Point {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "({}, {})", self.x, self.y)
}
}
impl Debug for Point {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Point({}, {})", self.x, self.y)
}
}
#[derive(PartialEq)]
pub struct Segment {
pub start: Point,
pub end: Point,
}