5#ifndef SAPPHIRE_MATHS_MATRIX3_GUARD
6#define SAPPHIRE_MATHS_MATRIX3_GUARD
13#include <SA/Maths/Matrix/Matrix3Base.hpp>
18#if SA_MATHS_MATRIX3_SIMD
20 #include <SA/Support/Intrinsics.hpp>
21 #include <SA/Support/Pragma.hpp>
43 template <
typename T, MatrixMajor major>
55#if SA_MATHS_MATRIX3_SIMD && SA_INTRISC
58 SA_PRAGMA_SDWARN_MSVC(4324)
60 template <typename T, MatrixMajor major = MatrixMajor::Default>
61 struct alignas(32) Mat3 : public Intl::Mat3_Base<T, major>
65 template <
typename T, MatrixMajor major = MatrixMajor::Default>
66 struct Mat3 :
public Intl::Mat3_Base<T, major>
70 using Intl::Mat3_Base<T, major>::e00;
71 using Intl::Mat3_Base<T, major>::e01;
72 using Intl::Mat3_Base<T, major>::e02;
74 using Intl::Mat3_Base<T, major>::e10;
75 using Intl::Mat3_Base<T, major>::e11;
76 using Intl::Mat3_Base<T, major>::e12;
78 using Intl::Mat3_Base<T, major>::e20;
79 using Intl::Mat3_Base<T, major>::e21;
80 using Intl::Mat3_Base<T, major>::e22;
107 using Intl::Mat3_Base<T, major>::Mat3_Base;
117 template <
typename TIn, MatrixMajor majorIn>
128 template <
typename TIn, MatrixMajor majorIn>
158 constexpr
bool Equals(const
Mat3& _other, T _epsilon = std::numeric_limits<T>::epsilon()) const noexcept;
168 constexpr
bool operator==(const
Mat3& _rhs) const noexcept;
177 constexpr
bool operator!=(const
Mat3& _rhs) const noexcept;
194 const T*
Data() const noexcept;
204 T&
At(uint32_t _index);
213 const T&
At(uint32_t _index) const;
223 T&
At(uint32_t _x, uint32_t _y);
233 const T&
At(uint32_t _x, uint32_t _y) const;
243 T& operator[](uint32_t _index);
252 const T& operator[](uint32_t _index) const;
361 Mat3& operator=(const
Mat3<TIn, majorIn> _rhs) noexcept;
368 constexpr
Mat3 operator-() const noexcept;
379 template <typename TIn>
380 Mat3 operator*(TIn _scale) const noexcept;
391 template <typename TIn>
392 Mat3 operator/(TIn _scale) const;
438 Vec3<T> operator*(const
Vec3<T>&_rhs) const noexcept;
450 template <typename TIn>
451 Mat3& operator*=(TIn _scale) noexcept;
462 template <typename TIn>
514 std::string ToString() const noexcept;
519#if SA_MATHS_MATRIX3_SIMD && SA_INTRISC
522 SA_PRAGMA_EDWARN_MSVC()
537 template <
typename TIn,
typename T, MatrixMajor major>
550 template <
typename TIn,
typename T, MatrixMajor major>
567 template <
typename T>
568 std::string ToString(
const Mat3<T>& _m);
586 template <
typename T, MatrixMajor major = MatrixMajor::Default>
622#if SA_MATHS_MATRIX3_SIMD && SA_INTRISC_AVX
714#if SA_MATHS_MATRIX3_SIMD && SA_INTRISC_SSE
748 Vec3<
float>
RMat3f::operator*(const
Vec3<
float>& _rhs) const noexcept;
767 Mat3f operator/(
float _lhs, const
Mat3f& _rhs);
774 float CMat3f::Determinant() const noexcept;
803 Vec3<
float>
CMat3f::operator*(const
Vec3<
float>& _rhs) const noexcept;
828#if SA_MATHS_MATRIX3_SIMD && SA_INTRISC_AVX
862 Vec3<
double>
RMat3d::operator*(const
Vec3<
double>& _rhs) const noexcept;
888 double CMat3d::Determinant() const noexcept;
917 Vec3<
double>
CMat3d::operator*(const
Vec3<
double>& _rhs) const noexcept;
953#include <SA/Maths/Matrix/Matrix3.inl>
Maths specific config file.
Maths module Debug compatibility definition.
Equals method implementation.
Lerp algorithms implementation.
Mat3< T, major > operator*(TIn _lhs, const Mat3< T, major > &_rhs) noexcept
Scale each matrix components by _lhs.
Mat3< T, major > operator/(TIn _lhs, const Mat3< T, major > &_rhs)
Inverse Scale each matrix components by _lhs.
MatrixMajor
Matrix major enum.
Definition MatrixMajor.hpp:24
Matrix 3x3 Sapphire-Maths class.
Definition Matrix3.hpp:69
constexpr Mat3(const Mat4< TIn, majorIn > &_other) noexcept
Value constructor from another Mat4 type.
T Determinant() const noexcept
Compute the determinant of the matrix.
constexpr Mat3(const Mat3< TIn, majorIn > &_other) noexcept
Value constructor from another Mat3 type.
Mat3 operator+(const Mat3 &_rhs) const noexcept
Add term by term matrix values.
constexpr Mat3 operator-() const noexcept
Getter of the opposite signed matrix.
static Mat3 MakeRotation(const Quat< T > &_rot) noexcept
Make rotation matrix from quaternion.
static const Mat3 Zero
Zero Mat3 constant.
Definition Matrix3.hpp:92
Mat3 operator/(TIn _scale) const
Inverse Scale each matrix component by _scale.
constexpr Mat3 GetTransposed() const noexcept
Transpose this matrix.
Mat3 & operator/=(TIn _scale)
Inverse Scale each matrix component by _scale.
static const Mat3 Identity
Identity Mat3 constant.
Definition Matrix3.hpp:101
Mat3 GetInversed() const
Inverse this matrix.
Mat3 & operator+=(const Mat3 &_rhs) noexcept
Add term by term matrix values.
Mat3 & Transpose() noexcept
Transpose this matrix.
Mat3 & operator*=(TIn _scale) noexcept
Scale each matrix component by _scale.
T * Data() noexcept
Getter of matrix data
Mat3 & Inverse()
Inverse this matrix.
Mat3 & operator-=(const Mat3 &_rhs) noexcept
Subtract term by term matrix values.
constexpr bool Equals(const Mat3 &_other, T _epsilon=std::numeric_limits< T >::epsilon()) const noexcept
Compare 2 Matrix.
constexpr bool IsIdentity() const noexcept
Whether this matrix is an identity matrix.
Mat3 operator*(TIn _scale) const noexcept
Scale each matrix component by _scale.
static Mat3 MakeScale(const Vec3< T > &_scale) noexcept
Make scale matrix from vector3.
static Mat3 Lerp(const Mat3 &_start, const Mat3 &_end, float _alpha) noexcept
Clamped Lerp from _start to _end at _alpha.
static Mat3 LerpUnclamped(const Mat3 &_start, const Mat3 &_end, float _alpha) noexcept
Unclamped Lerp from _start to _end at _alpha.
T & At(uint32_t _index)
Getter of Value at index.
constexpr bool IsZero() const noexcept
Whether this matrix is a zero matrix.
Matrix 4x4 Sapphire-Maths class.
Definition Matrix4.hpp:68
Quaternion Sapphire-Maths class.
Definition Quaternion.hpp:53
Vector 3 Sapphire-Maths class.
Definition Vector3.hpp:43