Added missing equal and notEqual with epsilon for quaternion types

This commit is contained in:
Groove
2018-07-25 22:16:16 +02:00
parent 01f9ab5b6d
commit 8f0b7c1373
4 changed files with 82 additions and 0 deletions

View File

@@ -379,6 +379,14 @@ namespace glm
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> equal(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns the component-wise comparison of |x - y| < epsilon.
///
/// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> equal(tquat<T, Q> const& x, tquat<T, Q> const& y, T epsilon);
/// Returns the component-wise comparison of result x != y.
///
/// @tparam T Floating-point scalar types.
@@ -387,6 +395,15 @@ namespace glm
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns the component-wise comparison of |x - y| >= epsilon.
///
/// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
template<typename T, qualifier Q>
GLM_FUNC_DECL vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y, T epsilon);
/// Returns true if x holds a NaN (not a number)
/// representation in the underlying implementation's set of
/// floating point representations. Returns false otherwise,

View File

@@ -773,6 +773,13 @@ namespace detail
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(tquat<T, Q> const& x, tquat<T, Q> const& y, T epsilon)
{
vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return lessThan(abs(v), vec<4, T, Q>(epsilon));
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y)
{
@@ -782,6 +789,13 @@ namespace detail
return Result;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y, T epsilon)
{
vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon));
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(tquat<T, Q> const& q)
{