use crate::point::Point; pub struct Line { p1: Point, p2: Point, } impl Line { pub fn new(p1: Point, p2: Point) -> Self { Self { p1, p2 } } pub fn vec(&self) -> Point { Point::new(self.p2.x - self.p1.x, self.p2.y - self.p1.y) } pub fn angle_between(&self, other: &Self) -> f64 { let v1 = self.vec(); let v2 = other.vec(); (v1.dot(&v2) / (v1.mag() * v2.mag())).acos() } }