123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
- /*================================================================
- *
- * Project : Freyja
- * Author : Terry 'Mongoose' Hendrix II
- * Website : http://www.westga.edu/~stu7440/
- * Email : stu7440@westga.edu
- * Object : Matrix
- * License : No use w/o permission (C) 2002 Mongoose
- * Comments: 3d Matrix in class form
- *
- *
- * This file was generated using Mongoose's C++
- * template generator script. <stu7440@westga.edu>
- *
- *-- History ------------------------------------------------
- *
- * 2003.06.17:
- * Mongoose - Now in column order to match OpenGL user needs,
- * use transpose() to get row order back =)
- *
- * 2002.05.11:
- * Mongoose - Created, based on my mtk3d matrix
- ================================================================*/
-
-
- #ifndef _MATRIX_H_
- #define _MATRIX_H_
-
-
- #include <MatMath.h>
- #include <Quaternion.h>
- #include <Vector3d.h>
-
- ///////////////////////////////////////////////
- // 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();
- /*------------------------------------------------------
- * Pre :
- * Post : Constructs an object of Matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.11:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- Matrix(matrix_t mat);
- /*------------------------------------------------------
- * Pre :
- * Post : Constructs an object of Matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.11:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- Matrix(Quaternion &q);
- /*------------------------------------------------------
- * Pre :
- * Post : Converts and asigns Q to a Matrix
- * returns quaternion as Matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- ~Matrix();
- /*------------------------------------------------------
- * Pre : Matrix object is allocated
- * Post : Deconstructs an object of Matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.11:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- ////////////////////////////////////////////////////////////
- // 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();
- /*------------------------------------------------------
- * Pre :
- * Post : Sets to identity matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void setMatrix(matrix_t mat);
- /*------------------------------------------------------
- * Pre :
- * Post : Set the matrix ( dangerous, scary boo )
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void rotate(vec_t x, vec_t y, vec_t z);
- /*------------------------------------------------------
- * Pre : Radian input
- * Post : Rotates object in 3 space
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void rotate(const vec_t *xyz);
- /*------------------------------------------------------
- * Pre : Rotates object in 3 space, Radian input
- * Post : Returns true on sucess
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void scale(vec_t x, vec_t y, vec_t z);
- /*------------------------------------------------------
- * Pre :
- * Post : Scales object in 3 space
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void scale(const vec_t *xyz);
- /*------------------------------------------------------
- * Pre :
- * Post : Scales object in 3 space
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void translate(vec_t x, vec_t y, vec_t z);
- /*------------------------------------------------------
- * Pre :
- * Post : Translates ( moves ) object in 3 space
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void translate(const vec_t *xyz);
- /*------------------------------------------------------
- * Pre :
- * Post : Translates ( moves ) object in 3 space
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void transpose();
- /*------------------------------------------------------
- * Pre :
- * Post : Transpose this matrix
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- matrix_t mMatrix; /* Data model, moved public for faster
- external renderer feedback use */
-
- private:
-
- ////////////////////////////////////////////////////////////
- // Private Accessors
- ////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////
- // Private Mutators
- ////////////////////////////////////////////////////////////
-
- void copy(matrix_t source, matrix_t dest);
- /*------------------------------------------------------
- * Pre :
- * Post : Copys value of source to dest
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
-
- void multiply(const matrix_t a, const matrix_t b, matrix_t result);
- /*------------------------------------------------------
- * Pre : Multiplies matrices a and b
- * Neither a or b is also the result
- *
- * Post : Sets resultant matrix value ( result )
- *
- *-- History ------------------------------------------
- *
- * 2002.05.08:
- * Mongoose - Created
- ------------------------------------------------------*/
- };
-
- #endif
|