use std::ops::{Add, Mul};
#[derive(Debug, Default, Clone, Copy, PartialEq)]
pub struct Vector2D {
pub x: f64,
pub y: f64,
}
impl Vector2D {
pub const fn new(x: f64, y: f64) -> Self {
Self { x, y }
}
}
impl Add for Vector2D {
type Output = Vector2D;
fn add(self, rhs: Vector2D) -> Self::Output {
Self {
x: self.x + rhs.x,
y: self.y + rhs.y,
}
}
}
impl Mul<f64> for Vector2D {
type Output = Vector2D;
fn mul(self, rhs: f64) -> Self::Output {
Self {
x: self.x * rhs,
y: self.y * rhs,
}
}
}