Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5740: Refactoring. Introduce Matrix3, the little sister of Matrix4.
- Loading branch information
1 parent
a29bd81
commit 1368551
Showing
7 changed files
with
144 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#pragma once | ||
|
||
#include "Vector3.h" | ||
#include "eigen.h" | ||
|
||
/** | ||
* \brief A 3x3 matrix stored in double-precision floating-point. | ||
* | ||
* The 3 columns may regarded as 3 vectors named x, y, z: | ||
* | ||
* | xx yx zx | | ||
* | xy yy zy | | ||
* | xz yz zz | | ||
* | ||
*/ | ||
class alignas(16) Matrix3 | ||
{ | ||
// Underlying Eigen transform object (which can in turn be reduced to a 3x3 | ||
// Matrix) | ||
using Transform = Eigen::Projective2d; | ||
Transform _transform; | ||
|
||
private: | ||
/// Construct a matrix with uninitialised values. | ||
Matrix3() { } | ||
|
||
/// Construct from Eigen transform | ||
explicit Matrix3(const Eigen::Projective2d& t) : | ||
_transform(t) | ||
{} | ||
|
||
/// Get the underlying Eigen transform | ||
Transform& eigen() { return _transform; } | ||
|
||
/// Get the underlying const Eigen transform | ||
const Transform& eigen() const { return _transform; } | ||
|
||
/// Obtain the identity matrix. | ||
static Matrix3 getIdentity() | ||
{ | ||
return Matrix3(Eigen::Projective2d::Identity()); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
// Import the Eigen header files needed by our math classes | ||
|
||
#undef Success // get rid of fuckwit X.h macro | ||
|
||
// Silence C++17 deprecation warnings from Eigen\src\Core\util\Meta.h(373), will be unsilenced at the bottom of this file | ||
#ifdef _MSC_VER | ||
#pragma warning(push) | ||
#pragma warning(disable : 4996) | ||
#pragma warning(disable : 4127) | ||
#endif | ||
|
||
#include <Eigen/Geometry> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters