Skip to content

Commit

Permalink
[DLG] Added the is_syyemtric function to Matrix3x3
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolodares committed Apr 5, 2024
1 parent d063853 commit 0419628
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lion/math/matrix3x3.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct Matrix3x3 : std::array<T, 9>
constexpr bool is_orthogonal() const;
constexpr bool is_rotmat() const;
constexpr bool is_eye() const;
constexpr bool is_symmetric() const;

constexpr static Matrix3x3 eye();
constexpr static Matrix3x3 zeros();
Expand Down Expand Up @@ -111,6 +112,8 @@ constexpr bool is_rotmat(const Matrix3x3<T> &arg);
template <typename T>
constexpr bool is_eye(const Matrix3x3<T> &arg);

template <typename T>
constexpr bool is_symmetric(const Matrix3x3<T> &arg);

template <typename T>
constexpr Matrix3x3<T> inv(const Matrix3x3<T> &arg);
Expand Down Expand Up @@ -340,6 +343,15 @@ constexpr bool Matrix3x3<T>::is_eye() const
eq_fp<T>(zz(), 1., tol);
}

template<typename T>
constexpr bool Matrix3x3<T>::is_symmetric() const
{
constexpr auto tol{ 1e3 };
return eq_fp<T>(xy(), yx(), tol) &&
eq_fp<T>(xz(), zx(), tol) &&
eq_fp<T>(yz(), zy(), tol);
}

template<typename T>
constexpr Matrix3x3<T> Matrix3x3<T>::eye()
{
Expand Down Expand Up @@ -504,6 +516,12 @@ constexpr bool is_eye(const Matrix3x3<T> &arg)
return arg.is_eye();
}

template<typename T>
constexpr bool is_symmetric(const Matrix3x3<T> &arg)
{
return arg.is_symmetric();
}

template<typename T>
constexpr Matrix3x3<T> inv(const Matrix3x3<T> &arg)
{
Expand Down

0 comments on commit 0419628

Please sign in to comment.