add MatrixCross

Files at this revision

API Documentation at this revision

Comitter:
NaotoMorita
Date:
Tue Aug 10 08:08:11 2021 +0000
Parent:
6:aa5e94cddb3f
Commit message:
add Vector3;

Changed in this revision

MatrixMath.cpp Show annotated file Show diff for this revision Revisions of this file
MatrixMath.h Show annotated file Show diff for this revision Revisions of this file
diff -r aa5e94cddb3f -r b22d56ac37aa MatrixMath.cpp
--- a/MatrixMath.cpp	Thu Sep 17 17:51:22 2020 +0700
+++ b/MatrixMath.cpp	Tue Aug 10 08:08:11 2021 +0000
@@ -24,6 +24,26 @@
     return result;
 }
 
+///Transpose matrix
+Matrix MatrixMath::Matrixcross(const float px, const float py, const float pz)
+{
+    Matrix result(3,3); //Transpose Matrix
+    result(1,2) = -pz;
+    result(1,3) =  py;
+    result(2,1) =  pz;
+    result(2,3) = -px;
+    result(3,1) = -py;
+    result(3,2) =  px;
+    return result;
+}
+Matrix MatrixMath::Vector2mat(const Vector3 vec)
+{
+    Matrix result(3,1); //Transpose Matrix
+    result(1,1) = vec.x;
+    result(2,1) = vec.y;
+    result(3,1) = vec.z;
+    return result;
+}
 Matrix MatrixMath::Inv(const Matrix &Mat)
 {
     if (Mat._nRows == Mat._nCols)
diff -r aa5e94cddb3f -r b22d56ac37aa MatrixMath.h
--- a/MatrixMath.h	Thu Sep 17 17:51:22 2020 +0700
+++ b/MatrixMath.h	Tue Aug 10 08:08:11 2021 +0000
@@ -15,7 +15,7 @@
 
 #include "mbed.h"
 #include "Matrix.h"
-
+#include "Vector3.hpp"
 
 /**
  * @brief This class provides STATIC methods to perform operations 
@@ -39,6 +39,17 @@
      * @param Mat matrix to calcute inverse.
      * @return Matrix Inverse
      */
+     
+    static Matrix Matrixcross(const float px, const float py, const float pz);
+    /**@brief
+     * 外積を計算するためのMatrixを計算する
+     */
+    
+    static Matrix Vector2mat(const Vector3 vec);
+    /**@brief
+     * 外積を計算するためのMatrixを計算する
+     */
+    
     static Matrix Inv( const Matrix& Mat );