00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
#ifndef OPENCAL_UTILS_MATRIX44_H
00012
#define OPENCAL_UTILS_MATRIX44_H
00013
00014
00015
#include <OpenCAL/global.h>
00016
#include <OpenCAL/Vector3.h>
00017
00018
namespace OpenCAL
00019 {
00020
namespace Utils
00021 {
00026 class OPENCAL_API Matrix44
00027 {
00028
protected:
00029
00030
float m_values[16];
00031
00032
public:
00033
00034
static const Matrix44 zero;
00035
static const Matrix44 unity;
00036
00037
public:
00038
00039 Matrix44();
00040 Matrix44(
const Matrix44 &source);
00041
virtual ~Matrix44();
00042
00043
00044
const float *get()
const {
return m_values; }
00045
float get(
int index)
const {
return m_values[index]; }
00046
float get(
int row,
int col)
const {
return m_values[4 * row + col]; }
00047
00048
00049
void set(
float *values);
00050
void set(
int index,
float value) { m_values[index] = value; }
00051
void set(
int row,
int col,
float value) { m_values[4 * row + col] = value; }
00052
00053
00054
void operator=(
const Matrix44 &m);
00055 Matrix44 operator*(
const Matrix44 &m)
const;
00056 Matrix44 operator*(
float factor)
const;
00057
Vector3 operator*(
const Vector3 &v)
const;
00058 Matrix44 operator+(
const Matrix44 &m)
const;
00059 Matrix44 operator-()
const;
00060
00061
bool operator==(
const Matrix44 &m)
const;
00062
bool operator!=(
const Matrix44 &m)
const
00063 {
return !(*
this == m);}
00064
00065
00066
void translate(
const Vector3 &translation);
00067
void rotateX(
float angle);
00068
void rotateY(
float angle);
00069
void rotateZ(
float angle);
00070
00071
00072
void identity();
00073
00074
void transpose();
00075 Matrix44 transposed();
00076
void fill(
float value);
00077
00078
void print();
00079
00080
protected:
00081
00082 Matrix44(
00083
float m11,
float m12,
float m13,
float m14,
00084
float m21,
float m22,
float m23,
float m24,
00085
float m31,
float m32,
float m33,
float m34,
00086
float m41,
float m42,
float m43,
float m44);
00087
00088
00089
friend Matrix44 operator*(
float factor,
const Matrix44 &m);
00090 };
00091 }
00092 }
00093
00094
#endif // OPENCAL_UTILS_MATRIX44_H