9
3

vector_common.hpp 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /// @ref ext_vector_common
  2. /// @file glm/ext/vector_common.hpp
  3. ///
  4. /// @defgroup ext_vector_common GLM_EXT_vector_common
  5. /// @ingroup ext
  6. ///
  7. /// Exposes min and max functions for 3 to 4 vector parameters.
  8. ///
  9. /// Include <glm/ext/vector_common.hpp> to use the features of this extension.
  10. ///
  11. /// @see core_common
  12. /// @see ext_scalar_common
  13. #pragma once
  14. // Dependency:
  15. #include "../ext/scalar_common.hpp"
  16. #include "../common.hpp"
  17. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  18. # pragma message("GLM: GLM_EXT_vector_common extension included")
  19. #endif
  20. namespace glm
  21. {
  22. /// @addtogroup ext_vector_common
  23. /// @{
  24. /// Return the minimum component-wise values of 3 inputs
  25. ///
  26. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  27. /// @tparam T Floating-point or integer scalar types
  28. /// @tparam Q Value from qualifier enum
  29. template<length_t L, typename T, qualifier Q>
  30. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c);
  31. /// Return the minimum component-wise values of 4 inputs
  32. ///
  33. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  34. /// @tparam T Floating-point or integer scalar types
  35. /// @tparam Q Value from qualifier enum
  36. template<length_t L, typename T, qualifier Q>
  37. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> min(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c, vec<L, T, Q> const& d);
  38. /// Return the maximum component-wise values of 3 inputs
  39. ///
  40. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  41. /// @tparam T Floating-point or integer scalar types
  42. /// @tparam Q Value from qualifier enum
  43. template<length_t L, typename T, qualifier Q>
  44. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z);
  45. /// Return the maximum component-wise values of 4 inputs
  46. ///
  47. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  48. /// @tparam T Floating-point or integer scalar types
  49. /// @tparam Q Value from qualifier enum
  50. template<length_t L, typename T, qualifier Q>
  51. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> max( vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& z, vec<L, T, Q> const& w);
  52. /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  53. ///
  54. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  55. /// @tparam T Floating-point scalar types
  56. /// @tparam Q Value from qualifier enum
  57. ///
  58. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmin">std::fmin documentation</a>
  59. template<length_t L, typename T, qualifier Q>
  60. GLM_FUNC_DECL vec<L, T, Q> fmin(vec<L, T, Q> const& x, T y);
  61. /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  62. ///
  63. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  64. /// @tparam T Floating-point scalar types
  65. /// @tparam Q Value from qualifier enum
  66. ///
  67. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmin">std::fmin documentation</a>
  68. template<length_t L, typename T, qualifier Q>
  69. GLM_FUNC_DECL vec<L, T, Q> fmin(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  70. /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  71. ///
  72. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  73. /// @tparam T Floating-point scalar types
  74. /// @tparam Q Value from qualifier enum
  75. ///
  76. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmin">std::fmin documentation</a>
  77. template<length_t L, typename T, qualifier Q>
  78. GLM_FUNC_DECL vec<L, T, Q> fmin(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c);
  79. /// Returns y if y < x; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  80. ///
  81. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  82. /// @tparam T Floating-point scalar types
  83. /// @tparam Q Value from qualifier enum
  84. ///
  85. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmin">std::fmin documentation</a>
  86. template<length_t L, typename T, qualifier Q>
  87. GLM_FUNC_DECL vec<L, T, Q> fmin(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c, vec<L, T, Q> const& d);
  88. /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  89. ///
  90. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  91. /// @tparam T Floating-point scalar types
  92. /// @tparam Q Value from qualifier enum
  93. ///
  94. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
  95. template<length_t L, typename T, qualifier Q>
  96. GLM_FUNC_DECL vec<L, T, Q> fmax(vec<L, T, Q> const& a, T b);
  97. /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  98. ///
  99. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  100. /// @tparam T Floating-point scalar types
  101. /// @tparam Q Value from qualifier enum
  102. ///
  103. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
  104. template<length_t L, typename T, qualifier Q>
  105. GLM_FUNC_DECL vec<L, T, Q> fmax(vec<L, T, Q> const& a, vec<L, T, Q> const& b);
  106. /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  107. ///
  108. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  109. /// @tparam T Floating-point scalar types
  110. /// @tparam Q Value from qualifier enum
  111. ///
  112. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
  113. template<length_t L, typename T, qualifier Q>
  114. GLM_FUNC_DECL vec<L, T, Q> fmax(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c);
  115. /// Returns y if x < y; otherwise, it returns x. If one of the two arguments is NaN, the value of the other argument is returned.
  116. ///
  117. /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
  118. /// @tparam T Floating-point scalar types
  119. /// @tparam Q Value from qualifier enum
  120. ///
  121. /// @see <a href="http://en.cppreference.com/w/cpp/numeric/math/fmax">std::fmax documentation</a>
  122. template<length_t L, typename T, qualifier Q>
  123. GLM_FUNC_DECL vec<L, T, Q> fmax(vec<L, T, Q> const& a, vec<L, T, Q> const& b, vec<L, T, Q> const& c, vec<L, T, Q> const& d);
  124. /// @}
  125. }//namespace glm
  126. #include "vector_common.inl"