This class provides with operations for Matrix Objects
Dependents: Matrix_class Wizardsneverdie mbed_multiplex_matrix Kinematics_Project_G5 ... more
MatrixMath.h@1:c74cdf14aea2, 2011-10-22 (annotated)
- Committer:
- Yo_Robot
- Date:
- Sat Oct 22 23:18:55 2011 +0000
- Revision:
- 1:c74cdf14aea2
- Parent:
- 0:eb69bbfb6486
- Child:
- 2:d487bb616ec1
version 0.8 Inv() det() defined
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yo_Robot | 0:eb69bbfb6486 | 1 | /** |
Yo_Robot | 1:c74cdf14aea2 | 2 | * @file MatrixMath.h |
Yo_Robot | 1:c74cdf14aea2 | 3 | * @author Ernesto Palacios |
Yo_Robot | 0:eb69bbfb6486 | 4 | * |
Yo_Robot | 0:eb69bbfb6486 | 5 | * Created on 15 de septiembre de 2011, 09:44 AM. |
Yo_Robot | 0:eb69bbfb6486 | 6 | * |
Yo_Robot | 0:eb69bbfb6486 | 7 | * Develop Under GPL v3.0 License |
Yo_Robot | 0:eb69bbfb6486 | 8 | * http://www.gnu.org/licenses/gpl-3.0.html |
Yo_Robot | 0:eb69bbfb6486 | 9 | * |
Yo_Robot | 0:eb69bbfb6486 | 10 | */ |
Yo_Robot | 0:eb69bbfb6486 | 11 | |
Yo_Robot | 1:c74cdf14aea2 | 12 | #ifndef MATRIXMATH_H |
Yo_Robot | 1:c74cdf14aea2 | 13 | #define MATRIXMATH_H |
Yo_Robot | 0:eb69bbfb6486 | 14 | |
Yo_Robot | 0:eb69bbfb6486 | 15 | #include "mbed.h" |
Yo_Robot | 0:eb69bbfb6486 | 16 | #include "Matrix.h" |
Yo_Robot | 0:eb69bbfb6486 | 17 | |
Yo_Robot | 0:eb69bbfb6486 | 18 | |
Yo_Robot | 0:eb69bbfb6486 | 19 | /** |
Yo_Robot | 0:eb69bbfb6486 | 20 | * @brief This class provides STATIC methods to preform operations over |
Yo_Robot | 1:c74cdf14aea2 | 21 | * Matrix Objects |
Yo_Robot | 1:c74cdf14aea2 | 22 | * version 0.8. |
Yo_Robot | 0:eb69bbfb6486 | 23 | * |
Yo_Robot | 0:eb69bbfb6486 | 24 | * Methods will be added as neccesary. |
Yo_Robot | 0:eb69bbfb6486 | 25 | * |
Yo_Robot | 0:eb69bbfb6486 | 26 | */ |
Yo_Robot | 0:eb69bbfb6486 | 27 | class MatrixMath{ |
Yo_Robot | 0:eb69bbfb6486 | 28 | public: |
Yo_Robot | 0:eb69bbfb6486 | 29 | |
Yo_Robot | 1:c74cdf14aea2 | 30 | |
Yo_Robot | 1:c74cdf14aea2 | 31 | /**@brief |
Yo_Robot | 1:c74cdf14aea2 | 32 | * Transposes Matrix, return new Object. |
Yo_Robot | 1:c74cdf14aea2 | 33 | * @param Mat matrix to calculate |
Yo_Robot | 1:c74cdf14aea2 | 34 | * @return the determinant |
Yo_Robot | 1:c74cdf14aea2 | 35 | */ |
Yo_Robot | 1:c74cdf14aea2 | 36 | static Matrix Transpose( const Matrix& Mat ); |
Yo_Robot | 1:c74cdf14aea2 | 37 | |
Yo_Robot | 1:c74cdf14aea2 | 38 | |
Yo_Robot | 1:c74cdf14aea2 | 39 | /**@brief |
Yo_Robot | 1:c74cdf14aea2 | 40 | * Calculate the inverse of a nxn Matrix BUT check first if the determinant |
Yo_Robot | 1:c74cdf14aea2 | 41 | * is != 0. Same matrix will be return if Det( Mat ) == 0. |
Yo_Robot | 1:c74cdf14aea2 | 42 | * @param Mat matrix to calcute inverse. |
Yo_Robot | 1:c74cdf14aea2 | 43 | * @return Matrix Inverse |
Yo_Robot | 1:c74cdf14aea2 | 44 | */ |
Yo_Robot | 1:c74cdf14aea2 | 45 | static Matrix Inv( const Matrix& Mat ); |
Yo_Robot | 1:c74cdf14aea2 | 46 | |
Yo_Robot | 0:eb69bbfb6486 | 47 | |
Yo_Robot | 1:c74cdf14aea2 | 48 | static float dotProduct( const Matrix& leftM, const Matrix& rightM ); |
Yo_Robot | 1:c74cdf14aea2 | 49 | |
Yo_Robot | 1:c74cdf14aea2 | 50 | /**@brief Calculates the determinant of a Matrix. |
Yo_Robot | 1:c74cdf14aea2 | 51 | * @param Mat matrix to calculate. |
Yo_Robot | 1:c74cdf14aea2 | 52 | * @return the determinant. |
Yo_Robot | 1:c74cdf14aea2 | 53 | */ |
Yo_Robot | 1:c74cdf14aea2 | 54 | static float det( const Matrix& Mat ); |
Yo_Robot | 1:c74cdf14aea2 | 55 | |
Yo_Robot | 1:c74cdf14aea2 | 56 | |
Yo_Robot | 1:c74cdf14aea2 | 57 | //** For Kinematics **// |
Yo_Robot | 0:eb69bbfb6486 | 58 | |
Yo_Robot | 0:eb69bbfb6486 | 59 | static Matrix RotX( const Matrix& matrix, float radians ); |
Yo_Robot | 0:eb69bbfb6486 | 60 | |
Yo_Robot | 0:eb69bbfb6486 | 61 | static Matrix RotY( const Matrix& matrix, float radians ); |
Yo_Robot | 0:eb69bbfb6486 | 62 | |
Yo_Robot | 0:eb69bbfb6486 | 63 | static Matrix RotZ( const Matrix& matrix, float radians ); |
Yo_Robot | 0:eb69bbfb6486 | 64 | |
Yo_Robot | 0:eb69bbfb6486 | 65 | static Matrix Transl( const Matrix& matrix, float x, float y, float z ); |
Yo_Robot | 0:eb69bbfb6486 | 66 | |
Yo_Robot | 1:c74cdf14aea2 | 67 | private: |
Yo_Robot | 1:c74cdf14aea2 | 68 | |
Yo_Robot | 1:c74cdf14aea2 | 69 | /**@brief |
Yo_Robot | 1:c74cdf14aea2 | 70 | * Calculates the Determinant of a 3x3 Matrix |
Yo_Robot | 1:c74cdf14aea2 | 71 | * @param Mat Already made sure is a 3 by 3 |
Yo_Robot | 1:c74cdf14aea2 | 72 | * @return Float, determinant. |
Yo_Robot | 1:c74cdf14aea2 | 73 | */ |
Yo_Robot | 1:c74cdf14aea2 | 74 | float Det3x3( const Matrix& Mat ); |
Yo_Robot | 1:c74cdf14aea2 | 75 | |
Yo_Robot | 0:eb69bbfb6486 | 76 | }; |
Yo_Robot | 0:eb69bbfb6486 | 77 | |
Yo_Robot | 1:c74cdf14aea2 | 78 | #endif /* MATRIXMATH_H */ |