mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 02:04:35 +00:00
Added missing equal and notEqual function for mat
This commit is contained in:
parent
6e7bad6bbc
commit
6afce5da27
@ -25,6 +25,18 @@ namespace glm
|
||||
/// @addtogroup ext_vector_relational
|
||||
/// @{
|
||||
|
||||
/// Returns the component-wise comparison of |x - y| <= 0.0.
|
||||
/// True if this expression is satisfied.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see ext_vector_relational
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<C, bool, Q> equal(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of |x - y| < epsilon.
|
||||
/// True if this expression is satisfied.
|
||||
///
|
||||
@ -80,6 +92,18 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL bool equal(genType const& x, genType const& y, genType const& epsilon);
|
||||
|
||||
/// Returns the component-wise comparison of |x - y| <= 0.0.
|
||||
/// True if this expression is not satisfied.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number of columns of the matrix
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number of rows of the matrix
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see ext_vector_relational
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of |x - y| < epsilon.
|
||||
/// True if this expression is not satisfied.
|
||||
///
|
||||
|
@ -11,7 +11,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER bool equal(genType const& x, genType const& y, genType const& epsilon)
|
||||
{
|
||||
return abs(x - y) < epsilon;
|
||||
return abs(x - y) <= epsilon;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
@ -23,7 +23,13 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
|
||||
{
|
||||
return lessThan(abs(x - y), epsilon);
|
||||
return lessThanEqual(abs(x - y), epsilon);
|
||||
}
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
|
||||
{
|
||||
return equal(a, b, static_cast<T>(0));
|
||||
}
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
@ -44,7 +50,7 @@ namespace glm
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER bool notEqual(genType const& x, genType const& y, genType const& epsilon)
|
||||
{
|
||||
return abs(x - y) >= epsilon;
|
||||
return abs(x - y) > epsilon;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
@ -56,7 +62,13 @@ namespace glm
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
|
||||
{
|
||||
return greaterThanEqual(abs(x - y), epsilon);
|
||||
return greaterThan(abs(x - y), epsilon);
|
||||
}
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
|
||||
{
|
||||
return notEqual(x, y, static_cast<T>(0));
|
||||
}
|
||||
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
|
@ -16,6 +16,7 @@ int test_equal()
|
||||
|
||||
Error += glm::all(glm::equal(glm::mat4x3(1), glm::mat4x3(1), 0.001f)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(glm::mat4x3(1), glm::mat4x3(2), glm::vec4(0.001f))) ? 1 : 0;
|
||||
Error += glm::all(glm::equal(glm::mat4x3(1), glm::mat4x3(1))) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
@ -34,6 +35,7 @@ int test_notEqual()
|
||||
|
||||
Error += !glm::any(glm::notEqual(glm::mat4x3(1), glm::mat4x3(1), 0.001f)) ? 0 : 1;
|
||||
Error += !glm::any(glm::notEqual(glm::mat4x3(1), glm::mat4x3(2), glm::vec4(0.001f))) ? 1 : 0;
|
||||
Error += !glm::any(glm::notEqual(glm::mat4x3(1), glm::mat4x3(1))) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user