123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
-
-
-
-
-
-
-
-
-
-
-
-
- ///////////////////////////////////////////////
- // Multidim map for row order encoding //
- ///////////////////////////////////////////////
- // 0,0 - 0; 0,1 - 1; 0,2 - 2; 0,3 - 3 //
- // 1,0 - 4; 1,1 - 5; 1,2 - 6; 1,3 - 7 //
- // 2,0 - 8; 2,1 - 9; 2,2 - 10; 2,3 - 11 //
- // 3,0 - 12; 3,1 - 13; 3,2 - 14; 3,3 - 15 //
- ///////////////////////////////////////////////
-
- ///////////////////////////////////////////////
- // Multidim map for column order encoding //
- ///////////////////////////////////////////////
- // 0,0 - 0; 0,1 - 4; 0,2 - 8; 0,3 - 12 //
- // 1,0 - 1; 1,1 - 5; 1,2 - 9; 1,3 - 13 //
- // 2,0 - 2; 2,1 - 6; 2,2 - 10; 2,3 - 14 //
- // 3,0 - 3; 3,1 - 7; 3,2 - 11; 3,3 - 15 //
- ///////////////////////////////////////////////
-
-
- class Matrix
- {
- public:
-
- ////////////////////////////////////////////////////////////
- // Constructors
- ////////////////////////////////////////////////////////////
-
- Matrix();
-
-
-
- Matrix(matrix_t mat);
-
-
-
- Matrix(Quaternion &q);
-
-
-
- ~Matrix();
-
-
-
- ////////////////////////////////////////////////////////////
- // Public Accessors
- ////////////////////////////////////////////////////////////
-
- void getMatrix(matrix_t mat);
- /*------------------------------------------------------
- * Pre :
- * Post : Returns this matrix copy
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void getTransposeMatrix(matrix_t mat);
- /*------------------------------------------------------
- * Pre :
- * Post : Returns this matrix transposed
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- bool getInvert(matrix_t mat);
- /*------------------------------------------------------
- * Pre :
- * Post : Returns this matrix inverted
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- Matrix multiply(const Matrix &a, const Matrix &b);
- /*------------------------------------------------------
- * Pre : Multiplies 2 matrices
- * Post : Returns resultant matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void multiply4d(double *v, double *result);
- /*------------------------------------------------------
- * Pre : Multiplies <V> vector (double[4]) and <This> matrix
- *
- * Post : Returns <Result> vector,
- * <V> and <Result> maybe be the same vector
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void multiply4v(vec4_t v, vec4_t result);
- /*------------------------------------------------------
- * Pre : Multiplies <V> vector and <This> matrix
- *
- * Post : Returns <Result> vector,
- * <V> and <Result> maybe be the same vector
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void multiply3v(vec3_t v, vec3_t result);
- /*------------------------------------------------------
- * Pre : Multiplies <V> vector and <This> matrix
- *
- * Post : Returns <Result> vector,
- * <V> and <Result> maybe be the same vector
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void print();
- /*------------------------------------------------------
- * Pre :
- * Post : Prints matrix values to stdout
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- bool isIdentity();
- /*------------------------------------------------------
- * Pre :
- * Post : Is this matrix the identity matrix?
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- Matrix operator *(const Matrix &a);
- /*------------------------------------------------------
- * Pre : Multiplies A and this matrices
- * Post : Returns resultant matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- Vector3d operator *(Vector3d v);
- /*------------------------------------------------------
- * Pre : <V> is vector to multiply by this matrix
- * Post : Returns resultant vector ( mult )
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
-
- ////////////////////////////////////////////////////////////
- // Public Mutators
- ////////////////////////////////////////////////////////////
-
- void setIdentity();
-
-
-
- void setMatrix(matrix_t mat);
-
-
-
- void rotate(vec_t x, vec_t y, vec_t z);
-
-
-
- void rotate(const vec_t *xyz);
-
-
-
- void scale(vec_t x, vec_t y, vec_t z);
-
-
-
- void scale(const vec_t *xyz);
-
-
-
- void translate(vec_t x, vec_t y, vec_t z);
-
-
-
- void translate(const vec_t *xyz);
-
-
-
- void transpose();
-
-
-
- matrix_t mMatrix;
-
-
- private:
-
- ////////////////////////////////////////////////////////////
- // Private Accessors
- ////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////
- // Private Mutators
- ////////////////////////////////////////////////////////////
-
- void copy(matrix_t source, matrix_t dest);
-
-
-
- void multiply(const matrix_t a, const matrix_t b, matrix_t result);
-
-
- };
-
|