diff --git a/src/point.rs b/src/point.rs index 75746b4..8d4213c 100644 --- a/src/point.rs +++ b/src/point.rs @@ -8,6 +8,7 @@ // except according to those terms. use length::Length; +use size::Size2D; use std::fmt; use std::num::Zero; @@ -45,6 +46,12 @@ impl> Add, Point2D> for Point2D { } } +impl> Point2D { + pub fn add_size(&self, other: &Size2D) -> Point2D { + Point2D { x: self.x + other.width, y: self.y + other.height } + } +} + impl> Sub, Point2D> for Point2D { fn sub(&self, other: &Point2D) -> Point2D { Point2D(self.x - other.x, self.y - other.y)