mirror of
https://github.com/BlackMATov/vmath.hpp.git
synced 2025-12-15 04:35:25 +07:00
qua: isnan, isinf, isfinite
This commit is contained in:
@@ -145,5 +145,27 @@ namespace vmath_hpp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Common Functions
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace vmath_hpp
|
||||||
|
{
|
||||||
|
template < typename T >
|
||||||
|
[[nodiscard]] vec<bool, 4> isnan(const qua<T>& xs) {
|
||||||
|
return isnan(vec{xs});
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
[[nodiscard]] vec<bool, 4> isinf(const qua<T>& xs) {
|
||||||
|
return isinf(vec{xs});
|
||||||
|
}
|
||||||
|
|
||||||
|
template < typename T >
|
||||||
|
[[nodiscard]] vec<bool, 4> isfinite(const qua<T>& xs) {
|
||||||
|
return isfinite(vec{xs});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,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));
|
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))));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user