From d300f341bca4d4fe295a6dd303c0961bff7a0520 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 8 Mar 2016 18:30:28 +0200 Subject: [core] Remove _validPoint from Transform code vec2::operator bool() checks for NaNs already. --- include/mbgl/util/vec.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/mbgl/util') diff --git a/include/mbgl/util/vec.hpp b/include/mbgl/util/vec.hpp index 83530a1798..a8bbd14b0f 100644 --- a/include/mbgl/util/vec.hpp +++ b/include/mbgl/util/vec.hpp @@ -105,6 +105,18 @@ struct vec3 { inline bool operator==(const vec3& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z; } + + template::has_quiet_NaN, int>::type = 0> + inline operator bool() const { + return !std::isnan(x) && !std::isnan(y) && !std::isnan(z); + } + + template::has_quiet_NaN, int>::type = 0> + inline operator bool() const { + return x != std::numeric_limits::min() + && y != std::numeric_limits::min() + && z != std::numeric_limits::min(); + } }; template @@ -117,6 +129,19 @@ struct vec4 { inline bool operator==(const vec4& rhs) const { return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w; } + + template::has_quiet_NaN, int>::type = 0> + inline operator bool() const { + return !std::isnan(x) && !std::isnan(y) && !std::isnan(z) && !std::isnan(w); + } + + template::has_quiet_NaN, int>::type = 0> + inline operator bool() const { + return x != std::numeric_limits::min() + && y != std::numeric_limits::min() + && z != std::numeric_limits::min() + && w != std::numeric_limits::min(); + } }; -- cgit v1.2.1