X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgeometry%2Foperators.h;h=295daa1a6b4fc2471eb2c88007b3ff3eb9e39af7;hb=c68b073db752dcdcf8c900efba7d8a5da091751c;hp=2dfa54e604cd883eece0f7b1543d4e2bc54677f7;hpb=2efa2ecd04a9c38d31e91950eac098faa3e5ca08;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());