--- trunk/OOPSE-4/src/math/Vector.hpp 2004/10/13 06:51:09 1563 +++ trunk/OOPSE-4/src/math/Vector.hpp 2004/10/13 22:24:59 1564 @@ -35,6 +35,7 @@ #include #include +#include namespace oopse { @@ -42,7 +43,7 @@ namespace oopse { * @class Vector Vector.hpp "math/Vector.hpp" * @brief Fix length vector class */ - template + template class Vector{ public: @@ -209,25 +210,25 @@ namespace oopse { } /** @see #add */ - inline Vector operator +=( const Vector& v1 ) { + inline Vector& operator +=( const Vector& v1 ) { add(v1); return *this; } /** @see #sub */ - inline Vector operator -=( const Vector& v1 ) { + inline Vector& operator -=( const Vector& v1 ) { sub(v1); return *this; } /** @see #mul */ - inline Vector operator *=( double s) { + inline Vector& operator *=( double s) { mul(s); return *this; } /** @see #div */ - inline Vector operator /=( double s ) { + inline Vector& operator /=( double s ) { div(s); return *this; } @@ -262,7 +263,7 @@ namespace oopse { }; /** unary minus*/ - template + template inline Vector operator -(const Vector& v1){ Vector tmp(v1); return tmp.negate(); @@ -274,7 +275,7 @@ namespace oopse { * @param v1 the first vector * @param v2 the second vector */ - template + template inline Vector operator +(const Vector& v1, const Vector& v2) { Vector result; @@ -288,7 +289,7 @@ namespace oopse { * @param v1 the first vector * @param v2 the second vector */ - template + template Vector operator -(const Vector& v1, const Vector& v2) { Vector result; result.sub(v1, v2); @@ -301,7 +302,7 @@ namespace oopse { * @param v1 the source vector * @param s the scalar value */ - template + template Vector operator * ( const Vector& v1, double s) { Vector result; result.mul(s, v1); @@ -314,7 +315,7 @@ namespace oopse { * @param s the scalar value * @param v1 the source vector */ - template + template Vector operator * ( double s, const Vector& v1 ) { Vector result; result.mul(s, v1); @@ -327,7 +328,7 @@ namespace oopse { * @param v1 the source vector * @param s the scalar value */ - template + template Vector operator / ( const Vector& v1, double s) { Vector result; result.div( v1,s); @@ -340,7 +341,7 @@ namespace oopse { * @param s the scalar value * @param v1 the source vector */ - template + template inline Vector operator /( double s, const Vector& v1 ) { Vector result; result.div( v1,s); @@ -348,7 +349,7 @@ namespace oopse { } /** fuzzy comparson */ - template + template inline bool epsilonEqual( const Vector& v1, const Vector& v2 ) { } @@ -360,7 +361,7 @@ namespace oopse { * @param v2 second vector * @return the dot product of v1 and v2 */ - template + template inline Real dot( const Vector& v1, const Vector& v2 ) { Real tmp; tmp = 0; @@ -377,7 +378,7 @@ namespace oopse { * @param v2 second vector * @return the distance between v1 and v2 */ - template + template inline Real distance( const Vector& v1, const Vector& v2 ) { Vector tempVector = v1 - v2; return tempVector.length(); @@ -389,7 +390,7 @@ namespace oopse { * @param v2 second vector * @return the squared distance between v1 and v2 */ - template + template inline Real distanceSquare( const Vector& v1, const Vector& v2 ) { Vector tempVector = v1 - v2; return tempVector.lengthSquare(); @@ -398,7 +399,7 @@ namespace oopse { /** * Write to an output stream */ - template + template std::ostream &operator<< ( std::ostream& o, const Vector& v1 ) { return o;