mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
Fixed bug #11, added missing quat based epsilonEqual and epsilonNotEqual definitions
This commit is contained in:
parent
47b610c6d3
commit
b8f30c5ad3
@ -254,6 +254,21 @@ namespace glm
|
||||
abs(x.w - y.w) >= epsilon.w);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonEqual
|
||||
(
|
||||
detail::tquat<valType> const & x,
|
||||
detail::tquat<valType> const & y,
|
||||
valType const & epsilon
|
||||
)
|
||||
{
|
||||
return detail::tvec4<bool>(
|
||||
abs(x.x - y.x) < epsilon,
|
||||
abs(x.y - y.y) < epsilon,
|
||||
abs(x.z - y.z) < epsilon,
|
||||
abs(x.w - y.w) < epsilon);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonEqual
|
||||
(
|
||||
@ -269,6 +284,21 @@ namespace glm
|
||||
abs(x.w - y.w) < epsilon.w);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual
|
||||
(
|
||||
detail::tquat<valType> const & x,
|
||||
detail::tquat<valType> const & y,
|
||||
valType const & epsilon
|
||||
)
|
||||
{
|
||||
return detail::tvec4<bool>(
|
||||
abs(x.x - y.x) >= epsilon,
|
||||
abs(x.y - y.y) >= epsilon,
|
||||
abs(x.z - y.z) >= epsilon,
|
||||
abs(x.w - y.w) >= epsilon);
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<bool> epsilonNotEqual
|
||||
(
|
||||
|
@ -12,6 +12,32 @@
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
|
||||
int test_defined()
|
||||
{
|
||||
glm::epsilonEqual(glm::vec2(), glm::vec2(), glm::vec2());
|
||||
glm::epsilonEqual(glm::vec3(), glm::vec3(), glm::vec3());
|
||||
glm::epsilonEqual(glm::vec4(), glm::vec4(), glm::vec4());
|
||||
glm::epsilonEqual(glm::quat(), glm::quat(), glm::quat());
|
||||
|
||||
glm::epsilonNotEqual(glm::vec2(), glm::vec2(), glm::vec2());
|
||||
glm::epsilonNotEqual(glm::vec3(), glm::vec3(), glm::vec3());
|
||||
glm::epsilonNotEqual(glm::vec4(), glm::vec4(), glm::vec4());
|
||||
glm::epsilonNotEqual(glm::quat(), glm::quat(), glm::quat());
|
||||
|
||||
|
||||
glm::epsilonEqual(glm::vec2(), glm::vec2(), 0.0f);
|
||||
glm::epsilonEqual(glm::vec3(), glm::vec3(), 0.0f);
|
||||
glm::epsilonEqual(glm::vec4(), glm::vec4(), 0.0f);
|
||||
glm::epsilonEqual(glm::quat(), glm::quat(), 0.0f);
|
||||
|
||||
glm::epsilonNotEqual(glm::vec2(), glm::vec2(), 0.0f);
|
||||
glm::epsilonNotEqual(glm::vec3(), glm::vec3(), 0.0f);
|
||||
glm::epsilonNotEqual(glm::vec4(), glm::vec4(), 0.0f);
|
||||
glm::epsilonNotEqual(glm::quat(), glm::quat(), 0.0f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int test_equal()
|
||||
{
|
||||
@ -54,6 +80,7 @@ int main()
|
||||
{
|
||||
int Error(0);
|
||||
|
||||
Error += test_defined();
|
||||
Error += test_equal<glm::half>();
|
||||
Error += test_equal<float>();
|
||||
Error += test_equal<double>();
|
||||
|
Loading…
Reference in New Issue
Block a user