Fixed epsilonEqual build

This commit is contained in:
Christophe Riccio
2017-08-07 03:18:21 +02:00
parent 1e7d12b91b
commit 45a716b893
3 changed files with 74 additions and 110 deletions

View File

@@ -30,41 +30,29 @@ namespace glm
/// True if this expression is satisfied.
///
/// @see gtc_epsilon
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_DECL vecType<L, bool, P> epsilonEqual(
vecType<L, T, P> const& x,
vecType<L, T, P> const& y,
T const & epsilon);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, bool, P> epsilonEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const & epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is satisfied.
///
/// @see gtc_epsilon
template<typename genType>
GLM_FUNC_DECL bool epsilonEqual(
genType const & x,
genType const & y,
genType const & epsilon);
GLM_FUNC_DECL bool epsilonEqual(genType const & x, genType const & y, genType const & epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is not satisfied.
///
/// @see gtc_epsilon
template<typename genType>
GLM_FUNC_DECL typename genType::boolType epsilonNotEqual(
genType const & x,
genType const & y,
typename genType::value_type const & epsilon);
template<length_t L, typename T, precision P>
GLM_FUNC_DECL vec<L, bool, P> epsilonNotEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const & epsilon);
/// Returns the component-wise comparison of |x - y| >= epsilon.
/// True if this expression is not satisfied.
///
/// @see gtc_epsilon
template<typename genType>
GLM_FUNC_DECL bool epsilonNotEqual(
genType const & x,
genType const & y,
genType const & epsilon);
GLM_FUNC_DECL bool epsilonNotEqual(genType const & x, genType const & y, genType const & epsilon);
/// @}
}//namespace glm

View File

@@ -33,91 +33,51 @@ namespace glm
return abs(x - y) < epsilon;
}
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const& epsilon)
{
return lessThan(abs(x - y), vec<L, T, P>(epsilon));
}
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, vec<L, T, P> const& epsilon)
{
return lessThan(abs(x - y), vec<L, T, P>(epsilon));
}
template<>
GLM_FUNC_QUALIFIER bool epsilonNotEqual
(
float const & x,
float const & y,
float const & epsilon
)
GLM_FUNC_QUALIFIER bool epsilonNotEqual(float const& x, float const & y, float const& epsilon)
{
return abs(x - y) >= epsilon;
}
template<>
GLM_FUNC_QUALIFIER bool epsilonNotEqual
(
double const & x,
double const & y,
double const & epsilon
)
GLM_FUNC_QUALIFIER bool epsilonNotEqual(double const& x, double const& y, double const& epsilon)
{
return abs(x - y) >= epsilon;
}
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonEqual
(
vecType<L, T, P> const& x,
vecType<L, T, P> const& y,
T const & epsilon
)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonNotEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const& epsilon)
{
return lessThan(abs(x - y), vecType<L, T, P>(epsilon));
return greaterThanEqual(abs(x - y), vec<L, T, P>(epsilon));
}
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonEqual
(
vecType<L, T, P> const& x,
vecType<L, T, P> const& y,
vecType<L, T, P> const& epsilon
)
template<length_t L, typename T, precision P>
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonNotEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, vec<L, T, P> const& epsilon)
{
return lessThan(abs(x - y), vecType<L, T, P>(epsilon));
}
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonNotEqual
(
vecType<L, T, P> const& x,
vecType<L, T, P> const& y,
T const & epsilon
)
{
return greaterThanEqual(abs(x - y), vecType<L, T, P>(epsilon));
}
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonNotEqual
(
vecType<L, T, P> const& x,
vecType<L, T, P> const& y,
vecType<L, T, P> const& epsilon
)
{
return greaterThanEqual(abs(x - y), vecType<L, T, P>(epsilon));
return greaterThanEqual(abs(x - y), vec<L, T, P>(epsilon));
}
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonEqual
(
tquat<T, P> const & x,
tquat<T, P> const & y,
T const & epsilon
)
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonEqual(tquat<T, P> const& x, tquat<T, P> const & y, T const& epsilon)
{
vec<4, T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return lessThan(abs(v), vec<4, T, P>(epsilon));
}
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonNotEqual
(
tquat<T, P> const & x,
tquat<T, P> const & y,
T const & epsilon
)
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonNotEqual(tquat<T, P> const& x, tquat<T, P> const& y, T const& epsilon)
{
vec<4, T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
return greaterThanEqual(abs(v), vec<4, T, P>(epsilon));