matrix_relational.inl 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. vec<C, bool, Q> Result(true);
  12. for(length_t i = 0; i < C; ++i)
  13. Result[i] = all(equal(a[i], b[i]));
  14. return Result;
  15. }
  16. template<length_t C, length_t R, typename T, qualifier Q>
  17. 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)
  18. {
  19. return equal(a, b, vec<C, T, Q>(Epsilon));
  20. }
  21. template<length_t C, length_t R, typename T, qualifier Q>
  22. 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)
  23. {
  24. vec<C, bool, Q> Result(true);
  25. for(length_t i = 0; i < C; ++i)
  26. Result[i] = all(equal(a[i], b[i], Epsilon[i]));
  27. return Result;
  28. }
  29. template<length_t C, length_t R, typename T, qualifier Q>
  30. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
  31. {
  32. vec<C, bool, Q> Result(true);
  33. for(length_t i = 0; i < C; ++i)
  34. Result[i] = any(notEqual(a[i], b[i]));
  35. return Result;
  36. }
  37. template<length_t C, length_t R, typename T, qualifier Q>
  38. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, T Epsilon)
  39. {
  40. return notEqual(a, b, vec<C, T, Q>(Epsilon));
  41. }
  42. template<length_t C, length_t R, typename T, qualifier Q>
  43. 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)
  44. {
  45. vec<C, bool, Q> Result(true);
  46. for(length_t i = 0; i < C; ++i)
  47. Result[i] = any(notEqual(a[i], b[i], Epsilon[i]));
  48. return Result;
  49. }
  50. template<length_t C, length_t R, typename T, qualifier Q>
  51. 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)
  52. {
  53. return equal(a, b, vec<C, int, Q>(MaxULPs));
  54. }
  55. template<length_t C, length_t R, typename T, qualifier Q>
  56. 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)
  57. {
  58. vec<C, bool, Q> Result(true);
  59. for(length_t i = 0; i < C; ++i)
  60. Result[i] = all(equal(a[i], b[i], MaxULPs[i]));
  61. return Result;
  62. }
  63. template<length_t C, length_t R, typename T, qualifier Q>
  64. GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, int MaxULPs)
  65. {
  66. return notEqual(a, b, vec<C, int, Q>(MaxULPs));
  67. }
  68. template<length_t C, length_t R, typename T, qualifier Q>
  69. 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)
  70. {
  71. vec<C, bool, Q> Result(true);
  72. for(length_t i = 0; i < C; ++i)
  73. Result[i] = any(notEqual(a[i], b[i], MaxULPs[i]));
  74. return Result;
  75. }
  76. }//namespace glm