00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __EX_Matrix_h__
00020 #define __EX_Matrix_h__
00021
00022 #include "EXPR_API.h"
00023 class UT_Matrix3;
00024 class UT_Matrix4;
00025 class UT_DMatrix3;
00026 class UT_DMatrix4;
00027 class ev_Vector;
00028
00029
00030
00031
00032
00033 class EXPR_API ev_Matrix {
00034 public:
00035 ev_Matrix(int rows=1, int cols=1);
00036 ev_Matrix(const ev_Matrix &src);
00037 ~ev_Matrix();
00038
00039 int getRows() const { return myRowCount; }
00040 int getCols() const { return myColCount; }
00041 float getValue(int r, int c) const;
00042 float fastGet(int r, int c) const { return myRowVals[r][c]; }
00043 void setValue(int r, int c, float val);
00044
00045 void copy(const ev_Matrix &src);
00046 void add(const ev_Matrix &src);
00047 void sub(const ev_Matrix &src);
00048 void times(float scalar);
00049 void times(const ev_Matrix &src);
00050
00051 int castFrom(const char *str);
00052 int castFrom(float val);
00053 int castFrom(const ev_Vector &from);
00054 int castTo(ev_Vector &to) const;
00055 int castToFloat(float &rval) const;
00056 char *castToString() const;
00057
00058 void getMatrix3(UT_Matrix3 &v, int overwrite=1) const;
00059 void getMatrix4(UT_Matrix4 &v, int overwrite=1) const;
00060 void setMatrix3(const UT_Matrix3 &v);
00061 void setMatrix4(const UT_Matrix4 &v);
00062 void setMatrix3(const UT_DMatrix3 &v);
00063 void setMatrix4(const UT_DMatrix4 &v);
00064
00065 void identity(int size);
00066
00067
00068 int scan(const char *str);
00069
00070 float operator()(int r, int c) const { return getValue(r, c); }
00071 void grow(int rows, int cols)
00072 {
00073 if (rows != myRowCount) setRows(rows);
00074 if (cols != myColCount) setCols(cols);
00075 }
00076 void setRows(int rows);
00077 void setCols(int cols);
00078
00079 private:
00080 int myRowCount, myColCount;
00081 float **myRowVals;
00082 };
00083
00084 #endif