From 6e59957247c8ae2b8c7db22b952c649cd2d3ad4c Mon Sep 17 00:00:00 2001 From: Orange Date: Sun, 9 Nov 2025 14:19:08 +0300 Subject: [PATCH] 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. --- include/omath/linear_algebra/mat.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/omath/linear_algebra/mat.hpp b/include/omath/linear_algebra/mat.hpp index 75c4848..18b7d71 100644 --- a/include/omath/linear_algebra/mat.hpp +++ b/include/omath/linear_algebra/mat.hpp @@ -586,6 +586,17 @@ namespace omath {0, 0, 0, 1}, }; } + template + [[nodiscard]] + constexpr Mat<4, 4, Type, St> mat_scale(const Vector3& scale) noexcept + { + return { + {scale.x, 0, 0, 0}, + {0, scale.y, 0, 0}, + {0, 0, scale.z, 0}, + {0, 0, 0, 1}, + }; + } template [[nodiscard]]