Adds mat_scale function

Introduces a utility function to create a scaling matrix from a Vector3.
This simplifies the creation of scale transformations, particularly useful for the GJK algorithm implementation.
This commit is contained in:
2025-11-09 14:19:08 +03:00
parent 1e540862a0
commit 6e59957247

View File

@@ -586,6 +586,17 @@ namespace omath
{0, 0, 0, 1}, {0, 0, 0, 1},
}; };
} }
template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR>
[[nodiscard]]
constexpr Mat<4, 4, Type, St> mat_scale(const Vector3<Type>& scale) noexcept
{
return {
{scale.x, 0, 0, 0},
{0, scale.y, 0, 0},
{0, 0, scale.z, 0},
{0, 0, 0, 1},
};
}
template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR, class Angle> template<class Type = float, MatStoreType St = MatStoreType::ROW_MAJOR, class Angle>
[[nodiscard]] [[nodiscard]]