matrix_relational.inl 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /// @ref ext_vector_relational
  2. /// @file glm/ext/vector_relational.inl
  3. // Dependency:
  4. #include "../ext/vector_relational.hpp"
  5. #include "../common.hpp"
  6. namespace glm
  7. {
  8. template<length_t C, length_t R, typename T, qualifier Q>
  9. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
  10. {
  11. return equal(a, b, static_cast<T>(0));
  12. }
  13. template<length_t C, length_t R, typename T, qualifier Q>
  14. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, T Epsilon)
  15. {
  16. return equal(a, b, vec<C, T, Q>(Epsilon));
  17. }
  18. template<length_t C, length_t R, typename T, qualifier Q>
  19. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& Epsilon)
  20. {
  21. vec<C, bool, Q> Result(true);
  22. for(length_t i = 0; i < C; ++i)
  23. Result[i] = all(equal(a[i], b[i], Epsilon[i]));
  24. return Result;
  25. }
  26. template<length_t C, length_t R, typename T, qualifier Q>
  27. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
  28. {
  29. return notEqual(x, y, static_cast<T>(0));
  30. }
  31. template<length_t C, length_t R, typename T, qualifier Q>
  32. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, T Epsilon)
  33. {
  34. return notEqual(x, y, vec<C, T, Q>(Epsilon));
  35. }
  36. template<length_t C, length_t R, typename T, qualifier Q>
  37. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, T, Q> const& Epsilon)
  38. {
  39. vec<C, bool, Q> Result(true);
  40. for(length_t i = 0; i < C; ++i)
  41. Result[i] = any(notEqual(a[i], b[i], Epsilon[i]));
  42. return Result;
  43. }
  44. template<length_t C, length_t R, typename T, qualifier Q>
  45. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, int MaxULPs)
  46. {
  47. return equal(a, b, vec<C, int, Q>(MaxULPs));
  48. }
  49. template<length_t C, length_t R, typename T, qualifier Q>
  50. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, int, Q> const& MaxULPs)
  51. {
  52. vec<C, bool, Q> Result(true);
  53. for(length_t i = 0; i < C; ++i)
  54. Result[i] = all(equal(a[i], b[i], MaxULPs[i]));
  55. return Result;
  56. }
  57. template<length_t C, length_t R, typename T, qualifier Q>
  58. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, int MaxULPs)
  59. {
  60. return notEqual(x, y, vec<C, int, Q>(MaxULPs));
  61. }
  62. template<length_t C, length_t R, typename T, qualifier Q>
  63. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, vec<C, int, Q> const& MaxULPs)
  64. {
  65. vec<C, bool, Q> Result(true);
  66. for(length_t i = 0; i < C; ++i)
  67. Result[i] = any(notEqual(a[i], b[i], MaxULPs[i]));
  68. return Result;
  69. }
  70. }//namespace glm