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