From a4b36e6d1e20b5036d1ed7cf9f61a48dbbf77812 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 27 Apr 2008 13:08:12 +0000 Subject: 3D flight --- src/math/matrix4f.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/math/matrix4f.h (limited to 'src/math/matrix4f.h') diff --git a/src/math/matrix4f.h b/src/math/matrix4f.h new file mode 100644 index 0000000..0d7df90 --- /dev/null +++ b/src/math/matrix4f.h @@ -0,0 +1,58 @@ +/* + math/matrix4f.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_MATH_MATRIX4F_H__ +#define __INCLUDED_MATH_MATRIX4F_H__ + +// project headers +#include "math/axis.h" + +// C++ headers +#include + +namespace math +{ + +/// a transformation matrix +class Matrix4f +{ +public: + Matrix4f(); + Matrix4f(const Matrix4f & other); + Matrix4f(const Axis & axis); + + /// set all values to zero + void clear(); + + /// set the value to a 4x4 unity matrix + void unity(); + + /// assignment operator + void assign(const Matrix4f & other); + + /// assignment operator + inline Matrix4f & operator=(const Matrix4f &other); + + /// assign the matrix transformation equivalent to the coordinate system + void assign(const Axis & axis); + + /// assign the matrix transformation equivalent to the coordinate system + Matrix4f & operator=(const Axis & axis); + + /// return a pointer to the internal data + inline float * ptr() const { return (float *) matrix; } + + /// return the transpose matrix + Matrix4f const transpose(); + +private: + float matrix[4][4]; +}; + +} + +#endif // __INCLUDED_MATH_MATRIX4F_H__ + -- cgit v1.2.3