use crate::mod_2d::point::Point2D;
#[derive(Debug, Default)]
pub struct Line2D {
start: Point2D,
end: Point2D,
}
impl Line2D {
pub fn new(start: Point2D, end: Point2D) -> Self {
Line2D { start, end }
}
pub fn distance(&self) -> f32 {
let diff_x = *self.end.x() - *self.start.x();
let diff_y = *self.end.y() - *self.start.y();
(diff_x.powi(2) + diff_y.powi(2)).sqrt()
}
}