X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvector.cpp;h=e992bbffd53aa5496bffde85c0ff6b543f4891fd;hb=8ab4e08bd78cb5b07f069e3e6c5bf76944cb14fa;hp=e9ad51f3427fa06ad918dd7793986369cacdef87;hpb=fa8da664bfb749497b1b2d2991077af0554cc369;p=architektonas diff --git a/src/vector.cpp b/src/vector.cpp index e9ad51f..e992bbf 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -1,7 +1,7 @@ // // vector.cpp: Various structures used for 3 dimensional imaging // -// by James L. Hammons +// by James Hammons // (C) 2006 Underground Software // // JLH = James L. Hammons @@ -133,6 +133,35 @@ Vector& Vector::operator+=(double const v) return *this; } +// Vector - vector, self assigned + +Vector& Vector::operator-=(Vector const v) +{ + x -= v.x, y -= v.y, z -= v.z; + + return *this; +} + +// Vector - constant, self assigned + +Vector& Vector::operator-=(double const v) +{ + x -= v, y -= v, z -= v; + + return *this; +} + +// Check for equality +bool Vector::operator==(Vector const v) +{ + return (x == v.x && y == v.y && z == v.z ? true : false); +} + +// Check for inequality +bool Vector::operator!=(Vector const v) +{ + return (x != v.x || y != v.y || z != v.z ? true : false); +} Vector Vector::Unit(void) {