added new method added concept for mat type

This commit is contained in:
2025-02-16 10:06:04 +03:00
parent 872dbe146f
commit 96e4e1c9d6
3 changed files with 23 additions and 1 deletions

View File

@@ -22,6 +22,13 @@ namespace omath
COLUMN_MAJOR
};
template<typename M1, typename M2>
concept MatTemplateEqual =
(M1::rows == M2::rows) && (M1::columns == M2::columns) &&
std::is_same_v<typename M1::value_type, typename M2::value_type> &&
(M1::store_type == M2::store_type);
template<size_t Rows = 0, size_t Columns = 0, class Type = float, MatStoreType StoreType = MatStoreType::ROW_MAJOR>
requires std::is_arithmetic_v<Type>
class Mat final

View File

@@ -9,6 +9,7 @@
#include "omath/Vector2.hpp"
#include "omath/Angle.hpp"
#include <expected>
#include <immintrin.h>
namespace omath
@@ -228,6 +229,14 @@ namespace omath
return Angle<float, 0.f, 180.f, AngleFlags::Clamped>::FromRadians(std::acos(Dot(other) / bottom));
}
[[nodiscard]] bool IsPerpendicular(const Vector3& other) const
{
if (const auto angle = AngleBetween(other))
return angle->AsDegrees() == 90.f;
return false;
}
[[nodiscard]] constexpr float Sum2D() const
{
return Vector2::Sum();
@@ -235,7 +244,7 @@ namespace omath
[[nodiscard]] Vector3 ViewAngleTo(const Vector3& other) const;
[[nodiscard]] std::tuple<float, float, float> AsTuple() const
[[nodiscard]] constexpr std::tuple<float, float, float> AsTuple() const
{
return std::make_tuple(x, y, z);
}