diff --git a/headers/vmath.hpp/vmath_qua_fun.hpp b/headers/vmath.hpp/vmath_qua_fun.hpp index 684734d..4a09b99 100644 --- a/headers/vmath.hpp/vmath_qua_fun.hpp +++ b/headers/vmath.hpp/vmath_qua_fun.hpp @@ -145,5 +145,27 @@ namespace vmath_hpp } } +// +// Common Functions +// + +namespace vmath_hpp +{ + template < typename T > + [[nodiscard]] vec isnan(const qua& xs) { + return isnan(vec{xs}); + } + + template < typename T > + [[nodiscard]] vec isinf(const qua& xs) { + return isinf(vec{xs}); + } + + template < typename T > + [[nodiscard]] vec isfinite(const qua& xs) { + return isfinite(vec{xs}); + } +} + } } diff --git a/untests/vmath_qua_fun_tests.cpp b/untests/vmath_qua_fun_tests.cpp index fccd77c..d4b2737 100644 --- a/untests/vmath_qua_fun_tests.cpp +++ b/untests/vmath_qua_fun_tests.cpp @@ -63,4 +63,10 @@ TEST_CASE("vmath/qua_fun") { STATIC_REQUIRE(float3{1,2,3} * fqua{} == uapprox3(1.f,2.f,3.f)); STATIC_REQUIRE(float3{1,0,0} * fqua{0,0,0.7071067812f,0.7071067812f} == uapprox3(0.f,1.f,0.f)); } + + SUBCASE("Common Functions") { + REQUIRE_FALSE(any(isnan(fqua(1,1,1,1)))); + REQUIRE_FALSE(any(isinf(fqua(1,1,1,1)))); + REQUIRE(all(isfinite(fqua(1,1,1,1)))); + } }