VecMath.hpp   VecMath.hpp 
skipping to change at line 85 skipping to change at line 85
//! A 3x3 matrix of floats compatible with openGL. //! A 3x3 matrix of floats compatible with openGL.
typedef Matrix3<float> Mat3f; typedef Matrix3<float> Mat3f;
//! @class Vector2 //! @class Vector2
//! A templatized 2d vector compatible with openGL. //! A templatized 2d vector compatible with openGL.
//! Use Vec2d or Vec2f typdef for vectors of double and float respectively. //! Use Vec2d or Vec2f typdef for vectors of double and float respectively.
template<class T> class Vector2 template<class T> class Vector2
{ {
public: public:
inline Vector2(); inline Vector2();
inline Vector2(T); inline Vector2(T);
inline Vector2(T, T); inline Vector2(T, T);
inline Vector2& operator=(const T*); inline Vector2& operator=(const T*);
inline void set(T, T); inline void set(T, T);
inline bool operator==(const Vector2<T>&) const; inline bool operator==(const Vector2<T>&) const;
inline bool operator!=(const Vector2<T>&) const; inline bool operator!=(const Vector2<T>&) const;
inline const T& operator[](int x) const; inline const T& operator[](int x) const;
inline T& operator[](int); inline T& operator[](int);
skipping to change at line 1556 skipping to change at line 1556
{ {
return Vector3<T>(s*v[0],s*v[1],s*v[2]); return Vector3<T>(s*v[0],s*v[1],s*v[2]);
} }
template<class T> inline template<class T> inline
Vector4<T> operator*(T s,const Vector4<T>&v) Vector4<T> operator*(T s,const Vector4<T>&v)
{ {
return Vector4<T>(s*v[0],s*v[1],s*v[2],s*v[3]); return Vector4<T>(s*v[0],s*v[1],s*v[2],s*v[3]);
} }
//Make Qt handle the classes as primitive type. This optimizes performance with Qt's container classes
Q_DECLARE_TYPEINFO(Vec2d, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec2d, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Vec2f, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec2f, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Vec2i, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec2i, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Vec3d, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec3d, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Vec3f, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec3f, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Vec4d, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec4d, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Vec4f, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec4f, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Vec4i, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Vec4i, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Mat4d, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Mat4d, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Mat4f, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Mat4f, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Mat3d, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Mat3d, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(Mat3f, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(Mat3f, Q_PRIMITIVE_TYPE);
//Declare meta-type information so that Vec/Mat classes can be used in QVar
iant
//They are registered (qRegisterMetaType) in StelCore::registerMathMetaType
s, called in constructor
Q_DECLARE_METATYPE(Vec2d)
Q_DECLARE_METATYPE(Vec2f)
Q_DECLARE_METATYPE(Vec2i)
Q_DECLARE_METATYPE(Vec3d)
Q_DECLARE_METATYPE(Vec3f)
Q_DECLARE_METATYPE(Vec4d)
Q_DECLARE_METATYPE(Vec4f)
Q_DECLARE_METATYPE(Vec4i)
Q_DECLARE_METATYPE(Mat4d)
Q_DECLARE_METATYPE(Mat4f)
Q_DECLARE_METATYPE(Mat3d)
Q_DECLARE_METATYPE(Mat3f)
//! Provide Qt 3x3 matrix-vector multiplication, which does not exist for s ome reason //! Provide Qt 3x3 matrix-vector multiplication, which does not exist for s ome reason
inline QVector3D operator*(const QMatrix3x3& mat, const QVector3D& vec) inline QVector3D operator*(const QMatrix3x3& mat, const QVector3D& vec)
{ {
float x,y,z; float x,y,z;
x = vec.x() * mat(0,0) + x = vec.x() * mat(0,0) +
vec.y() * mat(0,1) + vec.y() * mat(0,1) +
vec.z() * mat(0,2); vec.z() * mat(0,2);
y = vec.x() * mat(1,0) + y = vec.x() * mat(1,0) +
vec.y() * mat(1,1) + vec.y() * mat(1,1) +
vec.z() * mat(1,2); vec.z() * mat(1,2);
 End of changes. 3 change blocks. 
1 lines changed or deleted 19 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/