vec-vec.hpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /*! vec=vec operator */
00003 inline vec& vec::operator=(const vec& v)
00004 {
00005   x =v.x;
00006   y =v.y;
00007   z =v.z;
00008   return *this;
00009 }
00010 
00011 ///////////////////////////////////////////////////////////////////////////////
00012 ///////////////////////////////////////////////////////////////////////////////
00013 ///////////////////////////////////////////////////////////////////////////////
00014 
00015 //=============================================================================
00016 /*! vec+=vec operator */
00017 inline vec& vec::operator+=(const vec& v)
00018 {
00019   x +=v.x;
00020   y +=v.y;
00021   z +=v.z;
00022   return *this;
00023 }
00024 
00025 //=============================================================================
00026 /*! vec-=vec operator */
00027 inline vec& vec::operator-=(const vec& v)
00028 {
00029   x -=v.x;
00030   y -=v.y;
00031   z -=v.z;
00032   return *this;
00033 }
00034 
00035 //=============================================================================
00036 /*! vec/=vec operator (outer product) */
00037 inline vec& vec::operator/=(const vec& v)
00038 {
00039   (*this) =(*this)/v;
00040   return *this;
00041 }
00042 
00043 ///////////////////////////////////////////////////////////////////////////////
00044 ///////////////////////////////////////////////////////////////////////////////
00045 ///////////////////////////////////////////////////////////////////////////////
00046 
00047 //============================================================================ 
00048 /*! vec+vec operator */
00049 inline vec operator+(const vec& v1, const vec& v2)
00050 {
00051   return vec(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
00052 }
00053 
00054 //=============================================================================
00055 /*! vec-vec operator */
00056 inline vec operator-(const vec& v1, const vec& v2)
00057 {
00058   return vec(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
00059 }
00060 
00061 //=============================================================================
00062 /*! vec*vec operator */
00063 inline mat operator*(const vec& cv, const vec& rv)
00064 {
00065   return mat( cv.x*rv.x, cv.x*rv.y, cv.x*rv.z,
00066               cv.y*rv.x, cv.y*rv.y, cv.y*rv.z,
00067               cv.z*rv.x, cv.z*rv.y, cv.z*rv.z );
00068 }
00069 
00070 //=============================================================================
00071 /*! vec%vec operator (inner product) */
00072 inline double operator%(const vec& v1, const vec& v2)
00073 {
00074   return v1.x*v2.x +v1.y*v2.y +v1.z*v2.z;
00075 }
00076 
00077 //=============================================================================
00078 /*! vec/vec operator (outer product) */
00079 inline vec operator/(const vec& v1, const vec& v2)
00080 {
00081   return vec( v1.y*v2.z -v2.y*v1.z,
00082               v1.z*v2.x -v2.z*v1.x,
00083               v1.x*v2.y -v2.x*v1.y );
00084 }

Generated on Tue Mar 15 16:02:38 2005 for QVM by  doxygen 1.4.1