diff options
Diffstat (limited to 'core/src/point.rs')
-rw-r--r-- | core/src/point.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/src/point.rs b/core/src/point.rs index 2b5ad154..3714aa2f 100644 --- a/core/src/point.rs +++ b/core/src/point.rs @@ -1,7 +1,7 @@ use crate::Vector; /// A 2D point. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Default)] pub struct Point { /// The X coordinate. pub x: f32, @@ -67,3 +67,11 @@ impl std::ops::Sub<Vector> for Point { } } } + +impl std::ops::Sub<Point> for Point { + type Output = Vector; + + fn sub(self, point: Point) -> Vector { + Vector::new(self.x - point.x, self.y - point.y) + } +} |