From 6c2e28d20e498526d1c6d624b4018e9392d0fb80 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 28 Apr 2020 01:12:27 +0200 Subject: Implement `std::ops::Sub` for `Point` --- core/src/point.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'core/src') diff --git a/core/src/point.rs b/core/src/point.rs index 2b5ad154..a31bf967 100644 --- a/core/src/point.rs +++ b/core/src/point.rs @@ -67,3 +67,11 @@ impl std::ops::Sub for Point { } } } + +impl std::ops::Sub for Point { + type Output = Vector; + + fn sub(self, point: Point) -> Vector { + Vector::new(self.x - point.x, self.y - point.y) + } +} -- cgit