#[derive(Clone, Debug, Default)]
pub struct Point {
pub x: f32,
pub y: f32,
}
impl Point {
pub fn new(x: f32, y: f32) -> Self {
Self { x, y }
}
pub fn distance(&self, other: &Point) -> f32 {
let dx = self.x - other.x;
let dy = self.y - other.y;
(dx * dx + dy * dy).sqrt()
}
}
#[derive(Clone, Debug, Default)]
pub struct Size {
pub width: f32,
pub height: f32,
}
#[derive(Clone, Debug, Default)]
pub struct Rect {
pub origin: Point,
pub size: Size,
}