diff --git a/headers/enduro2d/math/_math.hpp b/headers/enduro2d/math/_math.hpp index a7ec8708..fab295b1 100644 --- a/headers/enduro2d/math/_math.hpp +++ b/headers/enduro2d/math/_math.hpp @@ -453,23 +453,6 @@ namespace e2d::math return v + 1; } - // - // is_finite - // - - template < typename T > - std::enable_if_t, bool> - is_finite(T v) noexcept { - E2D_UNUSED(v); - return true; - } - - template < typename T > - std::enable_if_t, bool> - is_finite(T v) noexcept { - return std::isfinite(v); - } - // // abs/abs_to_unsigned // diff --git a/headers/enduro2d/math/aabb.hpp b/headers/enduro2d/math/aabb.hpp index 5f0d35c8..da962636 100644 --- a/headers/enduro2d/math/aabb.hpp +++ b/headers/enduro2d/math/aabb.hpp @@ -420,14 +420,4 @@ namespace e2d::math const vec3 max = maximum(r); return math::inverse_lerp(min, max, p); } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const aabb& r) noexcept { - return math::contains_nan(r.position) - || math::contains_nan(r.size); - } } diff --git a/headers/enduro2d/math/mat2.hpp b/headers/enduro2d/math/mat2.hpp index e2e28349..68d28ca2 100644 --- a/headers/enduro2d/math/mat2.hpp +++ b/headers/enduro2d/math/mat2.hpp @@ -364,15 +364,4 @@ namespace e2d::math mm[0], mm[2], mm[1], mm[3]}; } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const mat2& v) noexcept { - return - math::contains_nan(v.rows[0]) || - math::contains_nan(v.rows[1]); - } } diff --git a/headers/enduro2d/math/mat3.hpp b/headers/enduro2d/math/mat3.hpp index 038bdc04..7677b212 100644 --- a/headers/enduro2d/math/mat3.hpp +++ b/headers/enduro2d/math/mat3.hpp @@ -493,16 +493,4 @@ namespace e2d::math mm[1], mm[4], mm[7], mm[2], mm[5], mm[8]}; } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const mat3& v) noexcept { - return - math::contains_nan(v.rows[0]) || - math::contains_nan(v.rows[1]) || - math::contains_nan(v.rows[2]); - } } diff --git a/headers/enduro2d/math/mat4.hpp b/headers/enduro2d/math/mat4.hpp index 9bf8a7ce..fa96e82c 100644 --- a/headers/enduro2d/math/mat4.hpp +++ b/headers/enduro2d/math/mat4.hpp @@ -750,17 +750,4 @@ namespace e2d::math mm[2], mm[6], mm[10], mm[14], mm[3], mm[7], mm[11], mm[15]}; } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const mat4& v) noexcept { - return - math::contains_nan(v.rows[0]) || - math::contains_nan(v.rows[1]) || - math::contains_nan(v.rows[2]) || - math::contains_nan(v.rows[3]); - } } diff --git a/headers/enduro2d/math/rect.hpp b/headers/enduro2d/math/rect.hpp index e974d9b3..d737d1b5 100644 --- a/headers/enduro2d/math/rect.hpp +++ b/headers/enduro2d/math/rect.hpp @@ -417,14 +417,4 @@ namespace e2d::math const vec2 max = maximum(r); return math::inverse_lerp(min, max, p); } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const rect& r) noexcept { - return math::contains_nan(r.position) - || math::contains_nan(r.size); - } } diff --git a/headers/enduro2d/math/trs2.hpp b/headers/enduro2d/math/trs2.hpp index 4092f29b..cf9e1fac 100644 --- a/headers/enduro2d/math/trs2.hpp +++ b/headers/enduro2d/math/trs2.hpp @@ -141,11 +141,4 @@ namespace e2d::math && math::approximately(l.rotation, r.rotation, precision) && math::approximately(l.scale, r.scale, precision); } - - template < typename T > - bool contains_nan(const trs2& v) noexcept { - return contains_nan(v.translation) - || contains_nan(v.rotation) - || contains_nan(v.scale); - } } diff --git a/headers/enduro2d/math/trs3.hpp b/headers/enduro2d/math/trs3.hpp index 3f300540..c450a661 100644 --- a/headers/enduro2d/math/trs3.hpp +++ b/headers/enduro2d/math/trs3.hpp @@ -138,11 +138,4 @@ namespace e2d::math && math::approximately(l.rotation, r.rotation, precision) && math::approximately(l.scale, r.scale, precision); } - - template < typename T > - bool contains_nan(const trs3& v) noexcept { - return contains_nan(v.translation) - || contains_nan(v.rotation) - || contains_nan(v.scale); - } } diff --git a/headers/enduro2d/math/unit.hpp b/headers/enduro2d/math/unit.hpp index 3efee4e3..ab2f2de7 100644 --- a/headers/enduro2d/math/unit.hpp +++ b/headers/enduro2d/math/unit.hpp @@ -278,13 +278,4 @@ namespace e2d::math unit saturated(const unit& u) noexcept { return clamped(u, {T(0), Tag{}}, {T(1), Tag{}}); } - - // - // contains_nan - // - - template < typename T, typename Tag > - bool contains_nan(const unit& u) noexcept { - return !math::is_finite(u.value); - } } diff --git a/headers/enduro2d/math/vec2.hpp b/headers/enduro2d/math/vec2.hpp index ca345266..6cda582f 100644 --- a/headers/enduro2d/math/vec2.hpp +++ b/headers/enduro2d/math/vec2.hpp @@ -528,15 +528,4 @@ namespace e2d::math math::inverse_lerp(l.x, r.x, v.x), math::inverse_lerp(l.y, r.y, v.y)}; } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const vec2& v) noexcept { - return - !math::is_finite(v.x) || - !math::is_finite(v.y); - } } diff --git a/headers/enduro2d/math/vec3.hpp b/headers/enduro2d/math/vec3.hpp index e77ac92e..e7869dc6 100644 --- a/headers/enduro2d/math/vec3.hpp +++ b/headers/enduro2d/math/vec3.hpp @@ -585,16 +585,4 @@ namespace e2d::math math::inverse_lerp(l.y, r.y, v.y), math::inverse_lerp(l.z, r.z, v.z)}; } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const vec3& v) noexcept { - return - !math::is_finite(v.x) || - !math::is_finite(v.y) || - !math::is_finite(v.z); - } } diff --git a/headers/enduro2d/math/vec4.hpp b/headers/enduro2d/math/vec4.hpp index 86459d79..fb264fe0 100644 --- a/headers/enduro2d/math/vec4.hpp +++ b/headers/enduro2d/math/vec4.hpp @@ -621,17 +621,4 @@ namespace e2d::math math::inverse_lerp(l.z, r.z, v.z), math::inverse_lerp(l.w, r.w, v.w)}; } - - // - // contains_nan - // - - template < typename T > - bool contains_nan(const vec4& v) noexcept { - return - !math::is_finite(v.x) || - !math::is_finite(v.y) || - !math::is_finite(v.z) || - !math::is_finite(v.w); - } } diff --git a/headers/enduro2d/utils/color.hpp b/headers/enduro2d/utils/color.hpp index 45447ac9..ed28b902 100644 --- a/headers/enduro2d/utils/color.hpp +++ b/headers/enduro2d/utils/color.hpp @@ -136,8 +136,6 @@ namespace e2d::math color minimized(const color& c, const color& cmin) noexcept; color maximized(const color& c, const color& cmax) noexcept; color clamped(const color& c, const color& cmin, const color& cmax) noexcept; - - bool contains_nan(const color& c) noexcept; } namespace e2d::colors diff --git a/headers/enduro2d/utils/color32.hpp b/headers/enduro2d/utils/color32.hpp index 8d091370..584d0c0a 100644 --- a/headers/enduro2d/utils/color32.hpp +++ b/headers/enduro2d/utils/color32.hpp @@ -136,8 +136,6 @@ namespace e2d::math color32 minimized(const color32& c, const color32& cmin) noexcept; color32 maximized(const color32& c, const color32& cmax) noexcept; color32 clamped(const color32& c, const color32& cmin, const color32& cmax) noexcept; - - bool contains_nan(const color32& c) noexcept; } namespace e2d::colors diff --git a/samples/bin/library/scripts/emmy/math/aabb.lua b/samples/bin/library/scripts/emmy/math/aabb.lua index 4ec127c2..6b180156 100644 --- a/samples/bin/library/scripts/emmy/math/aabb.lua +++ b/samples/bin/library/scripts/emmy/math/aabb.lua @@ -75,9 +75,5 @@ function aabb.normalized_to_point(r, p) end ---@return v3f function aabb.point_to_normalized(r, p) end ----@param r aabb ----@return boolean -function aabb.contains_nan(r) end - ---@type aabb _G.aabb = _G.aabb or aabb diff --git a/samples/bin/library/scripts/emmy/math/m2f.lua b/samples/bin/library/scripts/emmy/math/m2f.lua index bdd15201..7b9355ff 100644 --- a/samples/bin/library/scripts/emmy/math/m2f.lua +++ b/samples/bin/library/scripts/emmy/math/m2f.lua @@ -39,9 +39,5 @@ function m2f.inversed(m) end ---@return m2f function m2f.transposed(m) end ----@param m m2f ----@return boolean -function m2f.contains_nan(m) end - ---@type m2f _G.m2f = _G.m2f or m2f diff --git a/samples/bin/library/scripts/emmy/math/m3f.lua b/samples/bin/library/scripts/emmy/math/m3f.lua index 66793bf4..5246b9b0 100644 --- a/samples/bin/library/scripts/emmy/math/m3f.lua +++ b/samples/bin/library/scripts/emmy/math/m3f.lua @@ -43,9 +43,5 @@ function m3f.inversed(m) end ---@return m3f function m3f.transposed(m) end ----@param m m3f ----@return boolean -function m3f.contains_nan(m) end - ---@type m3f _G.m3f = _G.m3f or m3f diff --git a/samples/bin/library/scripts/emmy/math/m4f.lua b/samples/bin/library/scripts/emmy/math/m4f.lua index 969c0930..92821b14 100644 --- a/samples/bin/library/scripts/emmy/math/m4f.lua +++ b/samples/bin/library/scripts/emmy/math/m4f.lua @@ -90,9 +90,5 @@ function m4f.inversed(m) end ---@return m4f function m4f.transposed(m) end ----@param m m4f ----@return boolean -function m4f.contains_nan(m) end - ---@type m4f _G.m4f = _G.m4f or m4f diff --git a/samples/bin/library/scripts/emmy/math/rect.lua b/samples/bin/library/scripts/emmy/math/rect.lua index c98c1d5b..79a3aa55 100644 --- a/samples/bin/library/scripts/emmy/math/rect.lua +++ b/samples/bin/library/scripts/emmy/math/rect.lua @@ -75,9 +75,5 @@ function rect.normalized_to_point(r, p) end ---@return v2f function rect.point_to_normalized(r, p) end ----@param r rect ----@return boolean -function rect.contains_nan(r) end - ---@type rect _G.rect = _G.rect or rect diff --git a/samples/bin/library/scripts/emmy/math/t2f.lua b/samples/bin/library/scripts/emmy/math/t2f.lua index 125f2927..d7dbdba0 100644 --- a/samples/bin/library/scripts/emmy/math/t2f.lua +++ b/samples/bin/library/scripts/emmy/math/t2f.lua @@ -37,9 +37,5 @@ function t2f.make_scale(s) end ---@return boolean function t2f.approximately(l, r) end ----@param t t2f ----@return boolean -function t2f.contains_nan(t) end - ---@type t2f _G.t2f = _G.t2f or t2f diff --git a/samples/bin/library/scripts/emmy/math/t3f.lua b/samples/bin/library/scripts/emmy/math/t3f.lua index a3ddc794..95c7a032 100644 --- a/samples/bin/library/scripts/emmy/math/t3f.lua +++ b/samples/bin/library/scripts/emmy/math/t3f.lua @@ -37,9 +37,5 @@ function t3f.make_scale(s) end ---@return boolean function t3f.approximately(l, r) end ----@param t t3f ----@return boolean -function t3f.contains_nan(t) end - ---@type t3f _G.t3f = _G.t3f or t3f diff --git a/samples/bin/library/scripts/emmy/math/v2f.lua b/samples/bin/library/scripts/emmy/math/v2f.lua index b3d1270f..06e88773 100644 --- a/samples/bin/library/scripts/emmy/math/v2f.lua +++ b/samples/bin/library/scripts/emmy/math/v2f.lua @@ -105,9 +105,5 @@ function v2f.lerp(l,r,v) end ---@return v2f function v2f.inverse_lerp(l,r,v) end ----@param v v2f ----@return boolean -function v2f.contains_nan(v) end - ---@type v2f _G.v2f = _G.v2f or v2f diff --git a/samples/bin/library/scripts/emmy/math/v3f.lua b/samples/bin/library/scripts/emmy/math/v3f.lua index 766e42b4..65bbfc59 100644 --- a/samples/bin/library/scripts/emmy/math/v3f.lua +++ b/samples/bin/library/scripts/emmy/math/v3f.lua @@ -116,9 +116,5 @@ function v3f.lerp(l,r,v) end ---@return v3f function v3f.inverse_lerp(l,r,v) end ----@param v v3f ----@return boolean -function v3f.contains_nan(v) end - ---@type v3f _G.v3f = _G.v3f or v3f diff --git a/samples/bin/library/scripts/emmy/math/v4f.lua b/samples/bin/library/scripts/emmy/math/v4f.lua index d37d9165..f26ef67e 100644 --- a/samples/bin/library/scripts/emmy/math/v4f.lua +++ b/samples/bin/library/scripts/emmy/math/v4f.lua @@ -117,9 +117,5 @@ function v4f.lerp(l,r,v) end ---@return v4f function v4f.inverse_lerp(l,r,v) end ----@param v v4f ----@return boolean -function v4f.contains_nan(v) end - ---@type v4f _G.v4f = _G.v4f or v4f diff --git a/samples/bin/library/scripts/emmy/utils/color.lua b/samples/bin/library/scripts/emmy/utils/color.lua index 8dd1afa7..bca9c69a 100644 --- a/samples/bin/library/scripts/emmy/utils/color.lua +++ b/samples/bin/library/scripts/emmy/utils/color.lua @@ -78,9 +78,5 @@ function color.maximized(c,cmax) end ---@return color function color.clamped(c,cmin,cmax) end ----@param c color ----@return boolean -function color.contains_nan(c) end - ---@type color _G.color = _G.color or color diff --git a/samples/bin/library/scripts/emmy/utils/color32.lua b/samples/bin/library/scripts/emmy/utils/color32.lua index 1ea2938d..701cd06b 100644 --- a/samples/bin/library/scripts/emmy/utils/color32.lua +++ b/samples/bin/library/scripts/emmy/utils/color32.lua @@ -78,9 +78,5 @@ function color32.maximized(c,cmax) end ---@return color32 function color32.clamped(c,cmin,cmax) end ----@param c color32 ----@return boolean -function color32.contains_nan(c) end - ---@type color32 _G.color32 = _G.color32 or color32 diff --git a/sources/enduro2d/high/bindings/math_binds/aabb_binds.cpp b/sources/enduro2d/high/bindings/math_binds/aabb_binds.cpp index c53367bf..ad953af8 100644 --- a/sources/enduro2d/high/bindings/math_binds/aabb_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/aabb_binds.cpp @@ -69,9 +69,7 @@ namespace "overlaps", sol::resolve&,const aabb&)>(&math::overlaps), "normalized_to_point", sol::resolve(const aabb&,const vec3&)>(&math::normalized_to_point), - "point_to_normalized", sol::resolve(const aabb&,const vec3&)>(&math::point_to_normalized), - - "contains_nan", sol::resolve&)>(&math::contains_nan)); + "point_to_normalized", sol::resolve(const aabb&,const vec3&)>(&math::point_to_normalized)); } } diff --git a/sources/enduro2d/high/bindings/math_binds/mat2_binds.cpp b/sources/enduro2d/high/bindings/math_binds/mat2_binds.cpp index 53396b4a..1142d7c3 100644 --- a/sources/enduro2d/high/bindings/math_binds/mat2_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/mat2_binds.cpp @@ -60,10 +60,6 @@ namespace "transposed", [](const mat2& m) -> mat2 { return math::transposed(m); - }, - - "contains_nan", [](const mat2& m) -> bool { - return math::contains_nan(m); } ); } diff --git a/sources/enduro2d/high/bindings/math_binds/mat3_binds.cpp b/sources/enduro2d/high/bindings/math_binds/mat3_binds.cpp index aa8f60e6..dfe76c9c 100644 --- a/sources/enduro2d/high/bindings/math_binds/mat3_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/mat3_binds.cpp @@ -63,10 +63,6 @@ namespace "transposed", [](const mat3& m) -> mat3 { return math::transposed(m); - }, - - "contains_nan", [](const mat3& m) -> bool { - return math::contains_nan(m); } ); } diff --git a/sources/enduro2d/high/bindings/math_binds/mat4_binds.cpp b/sources/enduro2d/high/bindings/math_binds/mat4_binds.cpp index c7eb8d35..47803784 100644 --- a/sources/enduro2d/high/bindings/math_binds/mat4_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/mat4_binds.cpp @@ -95,10 +95,6 @@ namespace "transposed", [](const mat4& m) -> mat4 { return math::transposed(m); - }, - - "contains_nan", [](const mat4& m) -> bool { - return math::contains_nan(m); } ); } diff --git a/sources/enduro2d/high/bindings/math_binds/rect_binds.cpp b/sources/enduro2d/high/bindings/math_binds/rect_binds.cpp index 5d44b9d0..9e235abf 100644 --- a/sources/enduro2d/high/bindings/math_binds/rect_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/rect_binds.cpp @@ -69,9 +69,7 @@ namespace "overlaps", sol::resolve&,const rect&)>(&math::overlaps), "normalized_to_point", sol::resolve(const rect&,const vec2&)>(&math::normalized_to_point), - "point_to_normalized", sol::resolve(const rect&,const vec2&)>(&math::point_to_normalized), - - "contains_nan", sol::resolve&)>(&math::contains_nan)); + "point_to_normalized", sol::resolve(const rect&,const vec2&)>(&math::point_to_normalized)); } } diff --git a/sources/enduro2d/high/bindings/math_binds/trs2_binds.cpp b/sources/enduro2d/high/bindings/math_binds/trs2_binds.cpp index ca264a30..ee15625e 100644 --- a/sources/enduro2d/high/bindings/math_binds/trs2_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/trs2_binds.cpp @@ -44,10 +44,6 @@ namespace "approximately", [](const trs2& l, const trs2& r) -> bool { return math::approximately(l,r); - }, - - "contains_nan", [](const trs2& t) -> bool { - return math::contains_nan(t); } ); } diff --git a/sources/enduro2d/high/bindings/math_binds/trs3_binds.cpp b/sources/enduro2d/high/bindings/math_binds/trs3_binds.cpp index 7a58c296..3a30b0e6 100644 --- a/sources/enduro2d/high/bindings/math_binds/trs3_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/trs3_binds.cpp @@ -42,10 +42,6 @@ namespace "approximately", [](const trs3& l, const trs3& r) -> bool { return math::approximately(l,r); - }, - - "contains_nan", [](const trs3& t) -> bool { - return math::contains_nan(t); } ); } diff --git a/sources/enduro2d/high/bindings/math_binds/vec2_binds.cpp b/sources/enduro2d/high/bindings/math_binds/vec2_binds.cpp index 25ae06c6..cc294ef6 100644 --- a/sources/enduro2d/high/bindings/math_binds/vec2_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/vec2_binds.cpp @@ -84,9 +84,7 @@ namespace "lerp", sol::overload( sol::resolve(const vec2&, const vec2&, T)>(&math::lerp), sol::resolve(const vec2&, const vec2&, const vec2&)>(&math::lerp)), - "inverse_lerp", sol::resolve(const vec2&, const vec2&, const vec2&)>(&math::inverse_lerp), - - "contains_nan", sol::resolve&)>(&math::contains_nan)); + "inverse_lerp", sol::resolve(const vec2&, const vec2&, const vec2&)>(&math::inverse_lerp)); } } diff --git a/sources/enduro2d/high/bindings/math_binds/vec3_binds.cpp b/sources/enduro2d/high/bindings/math_binds/vec3_binds.cpp index a610c42a..3e92aeac 100644 --- a/sources/enduro2d/high/bindings/math_binds/vec3_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/vec3_binds.cpp @@ -89,9 +89,7 @@ namespace "lerp", sol::overload( sol::resolve(const vec3&, const vec3&, T)>(&math::lerp), sol::resolve(const vec3&, const vec3&, const vec3&)>(&math::lerp)), - "inverse_lerp", sol::resolve(const vec3&, const vec3&, const vec3&)>(&math::inverse_lerp), - - "contains_nan", sol::resolve&)>(&math::contains_nan)); + "inverse_lerp", sol::resolve(const vec3&, const vec3&, const vec3&)>(&math::inverse_lerp)); } } diff --git a/sources/enduro2d/high/bindings/math_binds/vec4_binds.cpp b/sources/enduro2d/high/bindings/math_binds/vec4_binds.cpp index b24f49d8..b78e38a4 100644 --- a/sources/enduro2d/high/bindings/math_binds/vec4_binds.cpp +++ b/sources/enduro2d/high/bindings/math_binds/vec4_binds.cpp @@ -88,9 +88,7 @@ namespace "lerp", sol::overload( sol::resolve(const vec4&, const vec4&, T)>(&math::lerp), sol::resolve(const vec4&, const vec4&, const vec4&)>(&math::lerp)), - "inverse_lerp", sol::resolve(const vec4&, const vec4&, const vec4&)>(&math::inverse_lerp), - - "contains_nan", sol::resolve&)>(&math::contains_nan)); + "inverse_lerp", sol::resolve(const vec4&, const vec4&, const vec4&)>(&math::inverse_lerp)); } } diff --git a/sources/enduro2d/high/bindings/utils_binds/color32_binds.cpp b/sources/enduro2d/high/bindings/utils_binds/color32_binds.cpp index 766837bf..d0d813f2 100644 --- a/sources/enduro2d/high/bindings/utils_binds/color32_binds.cpp +++ b/sources/enduro2d/high/bindings/utils_binds/color32_binds.cpp @@ -65,8 +65,6 @@ namespace e2d::bindings::utils "minimized", sol::resolve(&math::minimized), "maximized", sol::resolve(&math::maximized), - "clamped", sol::resolve(&math::clamped), - - "contains_nan", sol::resolve(&math::contains_nan)); + "clamped", sol::resolve(&math::clamped)); } } diff --git a/sources/enduro2d/high/bindings/utils_binds/color_binds.cpp b/sources/enduro2d/high/bindings/utils_binds/color_binds.cpp index 02be6516..0045fa7b 100644 --- a/sources/enduro2d/high/bindings/utils_binds/color_binds.cpp +++ b/sources/enduro2d/high/bindings/utils_binds/color_binds.cpp @@ -65,8 +65,6 @@ namespace e2d::bindings::utils "minimized", sol::resolve(&math::minimized), "maximized", sol::resolve(&math::maximized), - "clamped", sol::resolve(&math::clamped), - - "contains_nan", sol::resolve(&math::contains_nan)); + "clamped", sol::resolve(&math::clamped)); } } diff --git a/sources/enduro2d/utils/color.cpp b/sources/enduro2d/utils/color.cpp index c9444e5e..279cda58 100644 --- a/sources/enduro2d/utils/color.cpp +++ b/sources/enduro2d/utils/color.cpp @@ -266,17 +266,6 @@ namespace e2d::math math::clamp(c.b, cmin.b, cmax.b), math::clamp(c.a, cmin.a, cmax.a)); } - - // - // contains_nan - // - - bool contains_nan(const color& c) noexcept { - return !math::is_finite(c.r) - || !math::is_finite(c.g) - || !math::is_finite(c.b) - || !math::is_finite(c.a); - } } namespace e2d::colors diff --git a/sources/enduro2d/utils/color32.cpp b/sources/enduro2d/utils/color32.cpp index 82e4e4c4..a9e58531 100644 --- a/sources/enduro2d/utils/color32.cpp +++ b/sources/enduro2d/utils/color32.cpp @@ -266,17 +266,6 @@ namespace e2d::math math::clamp(c.b, cmin.b, cmax.b), math::clamp(c.a, cmin.a, cmax.a)); } - - // - // contains_nan - // - - bool contains_nan(const color32& c) noexcept { - return !math::is_finite(c.r) - || !math::is_finite(c.g) - || !math::is_finite(c.b) - || !math::is_finite(c.a); - } } namespace e2d::colors diff --git a/untests/sources/untests_math/_math.cpp b/untests/sources/untests_math/_math.cpp index 6d40e2b5..0ba1060e 100644 --- a/untests/sources/untests_math/_math.cpp +++ b/untests/sources/untests_math/_math.cpp @@ -313,28 +313,6 @@ TEST_CASE("math") { REQUIRE(math::next_power_of_2(u32(8)) == u32(8)); REQUIRE(math::next_power_of_2(u32(9)) == u32(16)); } - { - REQUIRE(math::is_finite(0)); - REQUIRE(math::is_finite(0u)); - - REQUIRE(math::is_finite(0.f)); - REQUIRE(math::is_finite(1.f)); - REQUIRE(math::is_finite(-1.f)); - - REQUIRE(math::is_finite(0.0)); - REQUIRE(math::is_finite(1.0)); - REQUIRE(math::is_finite(-1.0)); - - REQUIRE_FALSE(math::is_finite(std::numeric_limits::quiet_NaN())); - REQUIRE_FALSE(math::is_finite(std::numeric_limits::signaling_NaN())); - REQUIRE_FALSE(math::is_finite(std::numeric_limits::infinity())); - REQUIRE_FALSE(math::is_finite(-std::numeric_limits::infinity())); - - REQUIRE_FALSE(math::is_finite(std::numeric_limits::quiet_NaN())); - REQUIRE_FALSE(math::is_finite(std::numeric_limits::signaling_NaN())); - REQUIRE_FALSE(math::is_finite(std::numeric_limits::infinity())); - REQUIRE_FALSE(math::is_finite(-std::numeric_limits::infinity())); - } { REQUIRE(math::abs(2) == 2); REQUIRE(math::abs(3u) == 3u); diff --git a/untests/sources/untests_math/aabb.cpp b/untests/sources/untests_math/aabb.cpp index fb9b2503..9ca13f17 100644 --- a/untests/sources/untests_math/aabb.cpp +++ b/untests/sources/untests_math/aabb.cpp @@ -156,11 +156,6 @@ TEST_CASE("aabb") { REQUIRE(math::overlaps(b3i(0,0,0,10,10,10), b3i(-9,0,0,10,10,10))); REQUIRE(math::overlaps(b3i(0,0,0,10,10,10), b3i(0,-9,0,10,10,10))); REQUIRE(math::overlaps(b3i(0,0,0,10,10,10), b3i(-9,-9,0,10,10,10))); - - REQUIRE_FALSE(math::contains_nan(b3i(1,2,3,4,5,6))); - REQUIRE_FALSE(math::contains_nan(b3f(1.f,2.f,3.f,4.f,5.f,6.f))); - REQUIRE(math::contains_nan(b3f(1.f,2.f,std::numeric_limits::quiet_NaN()))); - REQUIRE(math::contains_nan(b3f(std::numeric_limits::infinity(), 1.f,2.f))); } { REQUIRE(math::normalized_to_point(b3f(10.f, 20.f, 30.f), v3f(0.f, 0.f, 0.f)) == v3f(0.f, 0.f, 0.f)); diff --git a/untests/sources/untests_math/rect.cpp b/untests/sources/untests_math/rect.cpp index c88d0cca..8cf7ec49 100644 --- a/untests/sources/untests_math/rect.cpp +++ b/untests/sources/untests_math/rect.cpp @@ -172,11 +172,6 @@ TEST_CASE("rect") { REQUIRE(math::overlaps(b2i(0,0,10,10), b2i(-9,0,10,10))); REQUIRE(math::overlaps(b2i(0,0,10,10), b2i(0,-9,10,10))); REQUIRE(math::overlaps(b2i(0,0,10,10), b2i(-9,-9,10,10))); - - REQUIRE_FALSE(math::contains_nan(b2i(1,2,3,4))); - REQUIRE_FALSE(math::contains_nan(b2f(1.f,2.f,3.f,4.f))); - REQUIRE(math::contains_nan(b2f(1.f,std::numeric_limits::quiet_NaN()))); - REQUIRE(math::contains_nan(b2f(std::numeric_limits::infinity(), 1.f))); } { REQUIRE(math::normalized_to_point(b2f(10.f, 20.f), v2f(0.f, 0.f)) == v2f(0.f, 0.f)); diff --git a/untests/sources/untests_math/trs2.cpp b/untests/sources/untests_math/trs2.cpp index a2bf1877..7c14ab91 100644 --- a/untests/sources/untests_math/trs2.cpp +++ b/untests/sources/untests_math/trs2.cpp @@ -108,9 +108,5 @@ TEST_CASE("trs2") { math::make_translation_trs2(v2i{1,2}), math::make_translation_trs2(v2i{1,4}), 1)); - - const f32 inf = std::numeric_limits::infinity(); - REQUIRE(math::contains_nan(math::make_scale_trs2(v2f{inf, 0.f}))); - REQUIRE_FALSE(math::contains_nan(math::make_scale_trs2(v2f{0.f, 0.f}))); } } diff --git a/untests/sources/untests_math/trs3.cpp b/untests/sources/untests_math/trs3.cpp index cd7542e0..812852be 100644 --- a/untests/sources/untests_math/trs3.cpp +++ b/untests/sources/untests_math/trs3.cpp @@ -107,9 +107,5 @@ TEST_CASE("trs3") { math::make_translation_trs3(v3i{1,2,5}), math::make_translation_trs3(v3i{1,4,5}), 1)); - - const f32 inf = std::numeric_limits::infinity(); - REQUIRE(math::contains_nan(math::make_scale_trs3(v3f{1.f, inf, 0.f}))); - REQUIRE_FALSE(math::contains_nan(math::make_scale_trs3(v3f{1.f, 0.f, 0.f}))); } } diff --git a/untests/sources/untests_math/vec2.cpp b/untests/sources/untests_math/vec2.cpp index c196138d..9e9c0636 100644 --- a/untests/sources/untests_math/vec2.cpp +++ b/untests/sources/untests_math/vec2.cpp @@ -267,10 +267,4 @@ TEST_CASE("vec2") { REQUIRE(math::inverse_lerp(v2f(1,2), v2f(10,20), v2f(5.5f,11)) == v2f(0.5f)); REQUIRE(math::inverse_lerp(v2f(1,2), v2f(10,20), v2f(5.5f,38)) == v2f(0.5f,2.f)); } - { - REQUIRE_FALSE(math::contains_nan(v2i(0,1))); - REQUIRE_FALSE(math::contains_nan(v2f(0.f,1.f))); - REQUIRE(math::contains_nan(v2f(0.f,std::numeric_limits::quiet_NaN()))); - REQUIRE(math::contains_nan(v2f(std::numeric_limits::infinity(),1.f))); - } } diff --git a/untests/sources/untests_math/vec3.cpp b/untests/sources/untests_math/vec3.cpp index 896cbef7..67b7461a 100644 --- a/untests/sources/untests_math/vec3.cpp +++ b/untests/sources/untests_math/vec3.cpp @@ -290,11 +290,4 @@ TEST_CASE("vec3") { REQUIRE(math::inverse_lerp(v3f(1,2,1), v3f(10,20,10), v3f(5.5f,11,5.5f)) == v3f(0.5f)); REQUIRE(math::inverse_lerp(v3f(1,2,1), v3f(10,20,10), v3f(5.5f,38,5.5f)) == v3f(0.5f,2.f,0.5f)); } - { - REQUIRE_FALSE(math::contains_nan(v3i(0,1,2))); - REQUIRE_FALSE(math::contains_nan(v3f(0.f,1.f,2.f))); - REQUIRE(math::contains_nan(v3f(0.f,1.f,std::numeric_limits::quiet_NaN()))); - REQUIRE(math::contains_nan(v3f(std::numeric_limits::infinity(),1.f,2.f))); - REQUIRE(math::contains_nan(v3f(1.f,std::numeric_limits::infinity(),2.f))); - } } diff --git a/untests/sources/untests_math/vec4.cpp b/untests/sources/untests_math/vec4.cpp index 0791b422..421a953f 100644 --- a/untests/sources/untests_math/vec4.cpp +++ b/untests/sources/untests_math/vec4.cpp @@ -307,12 +307,4 @@ TEST_CASE("vec4") { REQUIRE(math::inverse_lerp(v4f(1,2,1,2), v4f(10,20,10,20), v4f(5.5f,11,5.5f,11)) == v4f(0.5f)); REQUIRE(math::inverse_lerp(v4f(1,2,1,2), v4f(10,20,10,20), v4f(5.5f,38,5.5f,38)) == v4f(0.5f,2.f,0.5f,2.f)); } - { - REQUIRE_FALSE(math::contains_nan(v4i(0,1,2,3))); - REQUIRE_FALSE(math::contains_nan(v4f(0.f,1.f,2.f,3.f))); - REQUIRE(math::contains_nan(v4f(0.f,1.f,2.f,std::numeric_limits::quiet_NaN()))); - REQUIRE(math::contains_nan(v4f(0.f,1.f,std::numeric_limits::quiet_NaN(),2.f))); - REQUIRE(math::contains_nan(v4f(std::numeric_limits::infinity(),1.f,2.f,3.f))); - REQUIRE(math::contains_nan(v4f(1.f,std::numeric_limits::infinity(),2.f,3.f))); - } } diff --git a/untests/sources/untests_utils/color.cpp b/untests/sources/untests_utils/color.cpp index 80879bd4..0fe9a62f 100644 --- a/untests/sources/untests_utils/color.cpp +++ b/untests/sources/untests_utils/color.cpp @@ -120,16 +120,6 @@ TEST_CASE("color") { REQUIRE(math::clamped(v0, color(6,5,4,3), color(9,9,9,9)) == color(6,5,5,6)); REQUIRE(math::clamped(v0, color(7,6,5,4), color(9,9,9,9)) == color(7,6,5,6)); } - { - { - REQUIRE_FALSE(math::contains_nan(color(0,1,2,3))); - REQUIRE_FALSE(math::contains_nan(color(0.f,1.f,2.f,3.f))); - REQUIRE(math::contains_nan(color(0.f,1.f,2.f,std::numeric_limits::quiet_NaN()))); - REQUIRE(math::contains_nan(color(0.f,1.f,std::numeric_limits::quiet_NaN(),2.f))); - REQUIRE(math::contains_nan(color(std::numeric_limits::infinity(),1.f,2.f,3.f))); - REQUIRE(math::contains_nan(color(1.f,std::numeric_limits::infinity(),2.f,3.f))); - } - } { REQUIRE(colors::pack_color(color(color32(1,2,3,4))) == 0x04010203); REQUIRE(colors::pack_color(color(color32(0x12,0x34,0x56,0x78))) == 0x78123456);