X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgeometry%2FVector.h;h=7c698ff4af0a11d9b707cd0b51503142e016f475;hb=64c0880d31cddc599b30331f9485d65eeaf705ee;hp=bf647136ddfaa101ee8406b0f8fa36cdccf2a4b4;hpb=0542849dfccfec1ce1477265fa0fee2401a8fb23;p=l2e.git diff --git a/src/geometry/Vector.h b/src/geometry/Vector.h index bf64713..7c698ff 100644 --- a/src/geometry/Vector.h +++ b/src/geometry/Vector.h @@ -37,21 +37,37 @@ template inline Vector operator +(const Vector &lhs, const Vector &rhs) { return Vector(lhs.X() + rhs.X(), lhs.Y() + rhs.Y()); } +template +inline Vector operator +(const Vector &lhs, const Vector &rhs) { + return Vector(lhs.X() + rhs.X(), lhs.Y() + rhs.Y()); +} template inline Vector &operator +=(Vector &lhs, const Vector &rhs) { return lhs = lhs + rhs; } +template +inline Vector &operator +=(Vector &lhs, const Vector &rhs) { + return lhs = lhs + rhs; +} template inline Vector operator -(const Vector &lhs, const Vector &rhs) { return Vector(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); } +template +inline Vector operator -(const Vector &lhs, const Vector &rhs) { + return Vector(lhs.X() - rhs.X(), lhs.Y() - rhs.Y()); +} template inline Vector &operator -=(Vector &lhs, const Vector &rhs) { return lhs = lhs - rhs; } +template +inline Vector &operator -=(Vector &lhs, const Vector &rhs) { + return lhs = lhs - rhs; +} template inline Vector operator -(const Vector &v) { @@ -72,6 +88,16 @@ inline Vector operator /(const Vector &v, T s) { return Vector(v.X() / s, v.Y() / s); } +template +inline bool operator ==(const Vector &lhs, const Vector &rhs) { + return lhs.X() == rhs.X() && lhs.Y() == rhs.Y(); +} + +template +inline bool operator !=(const Vector &lhs, const Vector &rhs) { + return lhs.X() != rhs.X() || lhs.Y() != rhs.Y(); +} + template inline std::ostream &operator <<(std::ostream &out, const Vector &v) { out << '<' << v.X() << ", " << v.Y() << '>';