use std::ops;
#[derive(Debug, Clone, Copy)]
pub struct Point {
pub x: i32,
pub y: i32,
}
impl Point {
pub fn mul(self, x: f64) -> Self {
Self {
x: (self.x as f64 * x) as i32,
y: (self.y as f64 * x) as i32,
}
}
}
impl ops::Add for Point {
type Output = Self;
fn add(self, other: Self) -> Self {
Self {
x: self.x + other.x,
y: self.y + other.y,
}
}
}
impl ops::Sub for Point {
type Output = Self;
fn sub(self, other: Self) -> Self {
Self {
x: self.x - other.x,
y: self.y - other.y,
}
}
}