Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: MatrixMath.h
- Revision:
- 1:c74cdf14aea2
- Parent:
- 0:eb69bbfb6486
- Child:
- 2:d487bb616ec1
diff -r eb69bbfb6486 -r c74cdf14aea2 MatrixMath.h
--- a/MatrixMath.h Fri Oct 21 03:28:28 2011 +0000
+++ b/MatrixMath.h Sat Oct 22 23:18:55 2011 +0000
@@ -1,6 +1,6 @@
/**
- * @file: MatrixMath.h
- * @author: Ernesto Palacios
+ * @file MatrixMath.h
+ * @author Ernesto Palacios
*
* Created on 15 de septiembre de 2011, 09:44 AM.
*
@@ -9,8 +9,8 @@
*
*/
-#ifndef MATRIXMATH_H
-#define MATRIXMATH_H
+#ifndef MATRIXMATH_H
+#define MATRIXMATH_H
#include "mbed.h"
#include "Matrix.h"
@@ -18,7 +18,8 @@
/**
* @brief This class provides STATIC methods to preform operations over
- * Matrix Objects.
+ * Matrix Objects
+ * version 0.8.
*
* Methods will be added as neccesary.
*
@@ -26,14 +27,34 @@
class MatrixMath{
public:
-
- static Matrix Transpose( const Matrix& matrix );
+
+ /**@brief
+ * Transposes Matrix, return new Object.
+ * @param Mat matrix to calculate
+ * @return the determinant
+ */
+ static Matrix Transpose( const Matrix& Mat );
+
+
+ /**@brief
+ * Calculate the inverse of a nxn Matrix BUT check first if the determinant
+ * is != 0. Same matrix will be return if Det( Mat ) == 0.
+ * @param Mat matrix to calcute inverse.
+ * @return Matrix Inverse
+ */
+ static Matrix Inv( const Matrix& Mat );
+
- static Matrix Invert( const Matrix& matrix );
-
- static float DotProduct( const Matrix& leftM, const Matrix& rightM );
-
- static float Det( const Matrix& Mat );
+ static float dotProduct( const Matrix& leftM, const Matrix& rightM );
+
+ /**@brief Calculates the determinant of a Matrix.
+ * @param Mat matrix to calculate.
+ * @return the determinant.
+ */
+ static float det( const Matrix& Mat );
+
+
+ //** For Kinematics **//
static Matrix RotX( const Matrix& matrix, float radians );
@@ -43,6 +64,15 @@
static Matrix Transl( const Matrix& matrix, float x, float y, float z );
+private:
+
+ /**@brief
+ * Calculates the Determinant of a 3x3 Matrix
+ * @param Mat Already made sure is a 3 by 3
+ * @return Float, determinant.
+ */
+ float Det3x3( const Matrix& Mat );
+
};
-#endif /* MATRIXMATH_H */
+#endif /* MATRIXMATH_H */