Skip to content

Commit

Permalink
Matrix2x2: added ToVec4 and FromVec4 methods
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMostDiligent committed Nov 25, 2023
1 parent fd1ea8b commit 5d9dcb4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Common/interface/BasicMath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,18 @@ template <class T> struct Matrix2x2
{
return Matrix2x2<Y>::MakeMatrix(Data());
}

template <typename Y = T>
constexpr Vector4<Y> ToVec4() const
{
return Vector4<Y>{static_cast<Y>(_11), static_cast<Y>(_12), static_cast<Y>(_21), static_cast<Y>(_22)};
}

template <typename Y>
static constexpr Matrix2x2 FromVec4(const Vector4<Y>& v)
{
return Matrix2x2{static_cast<T>(v.x), static_cast<T>(v.y), static_cast<T>(v.z), static_cast<T>(v.w)};
}
};

template <typename T>
Expand Down

0 comments on commit 5d9dcb4

Please sign in to comment.