Implement Sub for Point/Vector

This commit is contained in:
Hanno Braun 2025-01-09 18:52:30 +01:00
parent 8be6b041aa
commit 1b7adfd87f

View File

@ -38,3 +38,12 @@ impl<const D: usize> ops::Sub<Point<D>> for Point<D> {
self.coords - other.coords
}
}
impl<const D: usize> ops::Sub<Vector<D>> for Point<D> {
type Output = Point<D>;
fn sub(self, other: Vector<D>) -> Self::Output {
let coords = self.coords - other;
Self { coords }
}
}