VecMath.hpp   VecMath.hpp 
skipping to change at line 238 skipping to change at line 238
inline Vector4 operator*(T) const; inline Vector4 operator*(T) const;
inline Vector4 operator/(T) const; inline Vector4 operator/(T) const;
inline T dot(const Vector4<T>&) const; inline T dot(const Vector4<T>&) const;
inline T length() const; inline T length() const;
inline T lengthSquared() const; inline T lengthSquared() const;
inline void normalize(); inline void normalize();
inline void transfo4d(const Mat4d&); inline void transfo4d(const Mat4d&);
QString toString() const {return QString("[%1, %2, %3, %4]").arg(v[0 ]).arg(v[1]).arg(v[2]).arg(v[3]);}
T v[4]; // The 4 values T v[4]; // The 4 values
}; };
//! @class Matrix3 //! @class Matrix3
//! A templatized column-major 3x3 matrix compatible with openGL (mostly fo r NormalMatrix calculation). //! A templatized column-major 3x3 matrix compatible with openGL (mostly fo r NormalMatrix calculation).
//! Use Mat3d or Mat3f typedef for matrices of doubles and floats respectiv ely. //! Use Mat3d or Mat3f typedef for matrices of doubles and floats respectiv ely.
template<class T> class Matrix3 template<class T> class Matrix3
{ {
public: public:
skipping to change at line 270 skipping to change at line 271
inline Matrix3 operator-(const Matrix3<T>&) const; inline Matrix3 operator-(const Matrix3<T>&) const;
inline Matrix3 operator+(const Matrix3<T>&) const; inline Matrix3 operator+(const Matrix3<T>&) const;
inline Matrix3 operator*(const Matrix3<T>&) const; inline Matrix3 operator*(const Matrix3<T>&) const;
inline Vector3<T> operator*(const Vector3<T>&) const; inline Vector3<T> operator*(const Vector3<T>&) const;
static Matrix3<T> identity(); static Matrix3<T> identity();
Matrix3<T> transpose() const; Matrix3<T> transpose() const;
Matrix3<T> inverse() const; Matrix3<T> inverse() const;
//! return trace (sum of diagonal elements).
inline T trace() const {return r[0]+r[4]+r[8];}
//! return rotational angle
inline T angle() const {return acos(0.5*(this->trace()-1.0));}
inline void print(void) const; inline void print(void) const;
QString toString(int fieldWidth=0, char format='g', int precision=-1
) const {return QString("[[%1, %2, %3], [%4, %5, %6], [%7, %8, %9]]")
.arg(r[0], fieldWidth, format, precision)
.arg(r[1], fieldWidth, format, precision)
.arg(r[2], fieldWidth, format, precision)
.arg(r[3], fieldWidth, format, precision)
.arg(r[4], fieldWidth, format, precision)
.arg(r[5], fieldWidth, format, precision)
.arg(r[6], fieldWidth, format, precision)
.arg(r[7], fieldWidth, format, precision)
.arg(r[8], fieldWidth, format, precision);}
T r[9]; T r[9];
}; };
//! @class Matrix4 //! @class Matrix4
//! A templatized column-major 4x4 matrix compatible with openGL. //! A templatized column-major 4x4 matrix compatible with openGL.
//! Use Mat4d or Mat4f typdef for matrices of doubles and floats respective ly. //! Use Mat4d or Mat4f typdef for matrices of doubles and floats respective ly.
template<class T> class Matrix4 template<class T> class Matrix4
{ {
public: public:
skipping to change at line 319 skipping to change at line 334
static Matrix4<T> rotation(const Vector3<T>&, T); static Matrix4<T> rotation(const Vector3<T>&, T);
static Matrix4<T> xrotation(T); static Matrix4<T> xrotation(T);
static Matrix4<T> yrotation(T); static Matrix4<T> yrotation(T);
static Matrix4<T> zrotation(T); static Matrix4<T> zrotation(T);
static Matrix4<T> scaling(const Vector3<T>&); static Matrix4<T> scaling(const Vector3<T>&);
static Matrix4<T> scaling(T); static Matrix4<T> scaling(T);
Matrix4<T> transpose() const; Matrix4<T> transpose() const;
Matrix4<T> inverse() const; Matrix4<T> inverse() const;
//Returns the upper 3x3 Matrix of the current 4x4 Matrix //Returns the upper 3x3 Matrix of the current 4x4 Matrix
Matrix3<T> upper3x3() const; Matrix3<T> upper3x3() const;
Matrix3<T> upper3x3Transposed() const;
inline Vector4<T> getRow(const int row) const; inline Vector4<T> getRow(const int row) const;
inline Vector4<T> getColumn(const int column) const; inline Vector4<T> getColumn(const int column) const;
//Converts to QMatix4x4 (for use in OpenGL or other Qt classes) //Converts to QMatix4x4 (for use in OpenGL or other Qt classes)
inline QMatrix4x4 convertToQMatrix() const; inline QMatrix4x4 convertToQMatrix() const;
inline void print(void) const; inline void print(void) const;
QString toString(int fieldWidth=0, char format='g', int precision=-1
) const {return QString("[[%1, %2, %3, %4], [%5, %6, %7, %8], [%9, %10, %11
, %12], [%13, %14, %15, %16]]")
.arg(r[0], fieldWidth, format, precision)
.arg(r[1], fieldWidth, format, precision)
.arg(r[2], fieldWidth, format, precision)
.arg(r[3], fieldWidth, format, precision)
.arg(r[4], fieldWidth, format, precision)
.arg(r[5], fieldWidth, format, precision)
.arg(r[6], fieldWidth, format, precision)
.arg(r[7], fieldWidth, format, precision)
.arg(r[8], fieldWidth, format, precision)
.arg(r[9], fieldWidth, format, precision)
.arg(r[10], fieldWidth, format, precision)
.arg(r[11], fieldWidth, format, precision)
.arg(r[12], fieldWidth, format, precision)
.arg(r[13], fieldWidth, format, precision)
.arg(r[14], fieldWidth, format, precision)
.arg(r[15], fieldWidth, format, precision);}
T r[16]; T r[16];
}; };
//! Serialization routines. //! Serialization routines.
template<class T> QDataStream& operator<<(QDataStream& out, const Vector2<T >& v) {out << v[0] << v[1]; return out;} template<class T> QDataStream& operator<<(QDataStream& out, const Vector2<T >& v) {out << v[0] << v[1]; return out;}
template<class T> QDataStream& operator<<(QDataStream& out, const Vector3<T >& v) {out << v[0] << v[1] << v[2]; return out;} template<class T> QDataStream& operator<<(QDataStream& out, const Vector3<T >& v) {out << v[0] << v[1] << v[2]; return out;}
template<class T> QDataStream& operator<<(QDataStream& out, const Vector4<T >& v) {out << v[0] << v[1] << v[2] << v[3]; return out;} template<class T> QDataStream& operator<<(QDataStream& out, const Vector4<T >& v) {out << v[0] << v[1] << v[2] << v[3]; return out;}
template<class T> QDataStream& operator<<(QDataStream& out, const Matrix4<T >& m) {out << m[0] << m[1] << m[2] << m[3] << m[4] << m[5] << m[6] << m[7] << m[8] << m[9] << m[10] << m[11] << m[12] << m[13] << m[14] << m[15]; retu rn out;} template<class T> QDataStream& operator<<(QDataStream& out, const Matrix4<T >& m) {out << m[0] << m[1] << m[2] << m[3] << m[4] << m[5] << m[6] << m[7] << m[8] << m[9] << m[10] << m[11] << m[12] << m[13] << m[14] << m[15]; retu rn out;}
template<class T> QDataStream& operator<<(QDataStream& out, const Matrix3<T >& m) {out << m[0] << m[1] << m[2] << m[3] << m[4] << m[5] << m[6] << m[7] << m[8]; return out;} template<class T> QDataStream& operator<<(QDataStream& out, const Matrix3<T >& m) {out << m[0] << m[1] << m[2] << m[3] << m[4] << m[5] << m[6] << m[7] << m[8]; return out;}
skipping to change at line 1447 skipping to change at line 1480
MAT(out, 3, 3) = r3[7]; MAT(out, 3, 3) = r3[7];
return Matrix4<T>(out); return Matrix4<T>(out);
#undef MAT #undef MAT
#undef SWAP_ROWS #undef SWAP_ROWS
} }
template<class T> Matrix3<T> Matrix4<T>::upper3x3() const template<class T> Matrix3<T> Matrix4<T>::upper3x3() const
{ {
return Matrix3<T>(r[0], r[1], r[2],
r[4], r[5], r[6],
r[8], r[9], r[10]);
}
template<class T> Matrix3<T> Matrix4<T>::upper3x3Transposed() const
{
return Matrix3<T>(r[0], r[4], r[8], return Matrix3<T>(r[0], r[4], r[8],
r[1], r[5], r[9], r[1], r[5], r[9],
r[2], r[6], r[10]); r[2], r[6], r[10]);
} }
template<class T> Vector4<T> Matrix4<T>::getRow(const int row) const template<class T> Vector4<T> Matrix4<T>::getRow(const int row) const
{ {
return Vector4<T>(r[0 + row], r[4 + row], r[8 + row], r[12 + row]); return Vector4<T>(r[0 + row], r[4 + row], r[8 + row], r[12 + row]);
} }
template<class T> Vector4<T> Matrix4<T>::getColumn(const int column) const template<class T> Vector4<T> Matrix4<T>::getColumn(const int column) const
 End of changes. 6 change blocks. 
2 lines changed or deleted 44 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/