quaternion_relational.inl 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. namespace glm
  2. {
  3. template<typename T, qualifier Q>
  4. GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua<T, Q> const& x, qua<T, Q> const& y)
  5. {
  6. vec<4, bool, Q> Result;
  7. for(length_t i = 0; i < x.length(); ++i)
  8. Result[i] = x[i] == y[i];
  9. return Result;
  10. }
  11. template<typename T, qualifier Q>
  12. GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(qua<T, Q> const& x, qua<T, Q> const& y, T epsilon)
  13. {
  14. vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
  15. return lessThan(abs(v), vec<4, T, Q>(epsilon));
  16. }
  17. template<typename T, qualifier Q>
  18. GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua<T, Q> const& x, qua<T, Q> const& y)
  19. {
  20. vec<4, bool, Q> Result;
  21. for(length_t i = 0; i < x.length(); ++i)
  22. Result[i] = x[i] != y[i];
  23. return Result;
  24. }
  25. template<typename T, qualifier Q>
  26. GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(qua<T, Q> const& x, qua<T, Q> const& y, T epsilon)
  27. {
  28. vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
  29. return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon));
  30. }
  31. }//namespace glm