X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgeometry%2Foperators.h;h=295daa1a6b4fc2471eb2c88007b3ff3eb9e39af7;hb=cc77c50e59e9e3e4d5394d5fcf6905372fb7fe86;hp=2dfa54e604cd883eece0f7b1543d4e2bc54677f7;hpb=d955815b31c8c1b0beba87c2d9eb3b6ae1bebe93;p=l2e.git diff --git a/src/geometry/operators.h b/src/geometry/operators.h index 2dfa54e..295daa1 100644 --- a/src/geometry/operators.h +++ b/src/geometry/operators.h @@ -26,13 +26,11 @@ inline Point operator +(const Point &lhs, const Vector &rhs) { template inline Vector &operator +=(Vector &lhs, const Vector &rhs) { - lhs = lhs + rhs; - return lhs; + return lhs = lhs + rhs; } template inline Point &operator +=(Point &lhs, const Vector &rhs) { - lhs = lhs + rhs; - return lhs; + return lhs = lhs + rhs; } template @@ -44,6 +42,15 @@ inline Point operator -(const Point &lhs, const Vector &rhs) { return Point(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); } +template +inline Vector &operator -=(Vector &lhs, const Vector &rhs) { + return lhs = lhs - rhs; +} +template +inline Point &operator -=(Point &lhs, const Vector &rhs) { + return lhs = lhs - rhs; +} + template inline Vector operator -(const Vector &v) { return Vector(-v.X(), -v.Y());