associated_min_max.hpp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. /// @ref gtx_associated_min_max
  2. /// @file glm/gtx/associated_min_max.hpp
  3. ///
  4. /// @see core (dependence)
  5. /// @see gtx_extented_min_max (dependence)
  6. ///
  7. /// @defgroup gtx_associated_min_max GLM_GTX_associated_min_max
  8. /// @ingroup gtx
  9. ///
  10. /// Include <glm/gtx/associated_min_max.hpp> to use the features of this extension.
  11. ///
  12. /// @brief Min and max functions that return associated values not the compared ones.
  13. #pragma once
  14. // Dependency:
  15. #include "../glm.hpp"
  16. #ifndef GLM_ENABLE_EXPERIMENTAL
  17. # error "GLM: GLM_GTX_associated_min_max is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
  18. #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  19. # pragma message("GLM: GLM_GTX_associated_min_max extension included")
  20. #endif
  21. namespace glm
  22. {
  23. /// @addtogroup gtx_associated_min_max
  24. /// @{
  25. /// Minimum comparison between 2 variables and returns 2 associated variable values
  26. /// @see gtx_associated_min_max
  27. template<typename T, typename U>
  28. GLM_FUNC_DECL U associatedMin(T x, U a, T y, U b);
  29. /// Minimum comparison between 2 variables and returns 2 associated variable values
  30. /// @see gtx_associated_min_max
  31. template<length_t L, typename T, typename U, qualifier Q>
  32. GLM_FUNC_DECL vec<L, U, Q> associatedMin(
  33. vec<L, T, Q> const& x, vec<L, U, Q> const& a,
  34. vec<L, T, Q> const& y, vec<L, U, Q> const& b);
  35. /// Minimum comparison between 2 variables and returns 2 associated variable values
  36. /// @see gtx_associated_min_max
  37. template<length_t L, typename T, typename U, qualifier Q>
  38. GLM_FUNC_DECL vec<L, U, Q> associatedMin(
  39. T x, const vec<L, U, Q>& a,
  40. T y, const vec<L, U, Q>& b);
  41. /// Minimum comparison between 2 variables and returns 2 associated variable values
  42. /// @see gtx_associated_min_max
  43. template<length_t L, typename T, typename U, qualifier Q>
  44. GLM_FUNC_DECL vec<L, U, Q> associatedMin(
  45. vec<L, T, Q> const& x, U a,
  46. vec<L, T, Q> const& y, U b);
  47. /// Minimum comparison between 3 variables and returns 3 associated variable values
  48. /// @see gtx_associated_min_max
  49. template<typename T, typename U>
  50. GLM_FUNC_DECL U associatedMin(
  51. T x, U a,
  52. T y, U b,
  53. T z, U c);
  54. /// Minimum comparison between 3 variables and returns 3 associated variable values
  55. /// @see gtx_associated_min_max
  56. template<length_t L, typename T, typename U, qualifier Q>
  57. GLM_FUNC_DECL vec<L, U, Q> associatedMin(
  58. vec<L, T, Q> const& x, vec<L, U, Q> const& a,
  59. vec<L, T, Q> const& y, vec<L, U, Q> const& b,
  60. vec<L, T, Q> const& z, vec<L, U, Q> const& c);
  61. /// Minimum comparison between 4 variables and returns 4 associated variable values
  62. /// @see gtx_associated_min_max
  63. template<typename T, typename U>
  64. GLM_FUNC_DECL U associatedMin(
  65. T x, U a,
  66. T y, U b,
  67. T z, U c,
  68. T w, U d);
  69. /// Minimum comparison between 4 variables and returns 4 associated variable values
  70. /// @see gtx_associated_min_max
  71. template<length_t L, typename T, typename U, qualifier Q>
  72. GLM_FUNC_DECL vec<L, U, Q> associatedMin(
  73. vec<L, T, Q> const& x, vec<L, U, Q> const& a,
  74. vec<L, T, Q> const& y, vec<L, U, Q> const& b,
  75. vec<L, T, Q> const& z, vec<L, U, Q> const& c,
  76. vec<L, T, Q> const& w, vec<L, U, Q> const& d);
  77. /// Minimum comparison between 4 variables and returns 4 associated variable values
  78. /// @see gtx_associated_min_max
  79. template<length_t L, typename T, typename U, qualifier Q>
  80. GLM_FUNC_DECL vec<L, U, Q> associatedMin(
  81. T x, vec<L, U, Q> const& a,
  82. T y, vec<L, U, Q> const& b,
  83. T z, vec<L, U, Q> const& c,
  84. T w, vec<L, U, Q> const& d);
  85. /// Minimum comparison between 4 variables and returns 4 associated variable values
  86. /// @see gtx_associated_min_max
  87. template<length_t L, typename T, typename U, qualifier Q>
  88. GLM_FUNC_DECL vec<L, U, Q> associatedMin(
  89. vec<L, T, Q> const& x, U a,
  90. vec<L, T, Q> const& y, U b,
  91. vec<L, T, Q> const& z, U c,
  92. vec<L, T, Q> const& w, U d);
  93. /// Maximum comparison between 2 variables and returns 2 associated variable values
  94. /// @see gtx_associated_min_max
  95. template<typename T, typename U>
  96. GLM_FUNC_DECL U associatedMax(T x, U a, T y, U b);
  97. /// Maximum comparison between 2 variables and returns 2 associated variable values
  98. /// @see gtx_associated_min_max
  99. template<length_t L, typename T, typename U, qualifier Q>
  100. GLM_FUNC_DECL vec<L, U, Q> associatedMax(
  101. vec<L, T, Q> const& x, vec<L, U, Q> const& a,
  102. vec<L, T, Q> const& y, vec<L, U, Q> const& b);
  103. /// Maximum comparison between 2 variables and returns 2 associated variable values
  104. /// @see gtx_associated_min_max
  105. template<length_t L, typename T, typename U, qualifier Q>
  106. GLM_FUNC_DECL vec<L, T, Q> associatedMax(
  107. T x, vec<L, U, Q> const& a,
  108. T y, vec<L, U, Q> const& b);
  109. /// Maximum comparison between 2 variables and returns 2 associated variable values
  110. /// @see gtx_associated_min_max
  111. template<length_t L, typename T, typename U, qualifier Q>
  112. GLM_FUNC_DECL vec<L, U, Q> associatedMax(
  113. vec<L, T, Q> const& x, U a,
  114. vec<L, T, Q> const& y, U b);
  115. /// Maximum comparison between 3 variables and returns 3 associated variable values
  116. /// @see gtx_associated_min_max
  117. template<typename T, typename U>
  118. GLM_FUNC_DECL U associatedMax(
  119. T x, U a,
  120. T y, U b,
  121. T z, U c);
  122. /// Maximum comparison between 3 variables and returns 3 associated variable values
  123. /// @see gtx_associated_min_max
  124. template<length_t L, typename T, typename U, qualifier Q>
  125. GLM_FUNC_DECL vec<L, U, Q> associatedMax(
  126. vec<L, T, Q> const& x, vec<L, U, Q> const& a,
  127. vec<L, T, Q> const& y, vec<L, U, Q> const& b,
  128. vec<L, T, Q> const& z, vec<L, U, Q> const& c);
  129. /// Maximum comparison between 3 variables and returns 3 associated variable values
  130. /// @see gtx_associated_min_max
  131. template<length_t L, typename T, typename U, qualifier Q>
  132. GLM_FUNC_DECL vec<L, T, Q> associatedMax(
  133. T x, vec<L, U, Q> const& a,
  134. T y, vec<L, U, Q> const& b,
  135. T z, vec<L, U, Q> const& c);
  136. /// Maximum comparison between 3 variables and returns 3 associated variable values
  137. /// @see gtx_associated_min_max
  138. template<length_t L, typename T, typename U, qualifier Q>
  139. GLM_FUNC_DECL vec<L, U, Q> associatedMax(
  140. vec<L, T, Q> const& x, U a,
  141. vec<L, T, Q> const& y, U b,
  142. vec<L, T, Q> const& z, U c);
  143. /// Maximum comparison between 4 variables and returns 4 associated variable values
  144. /// @see gtx_associated_min_max
  145. template<typename T, typename U>
  146. GLM_FUNC_DECL U associatedMax(
  147. T x, U a,
  148. T y, U b,
  149. T z, U c,
  150. T w, U d);
  151. /// Maximum comparison between 4 variables and returns 4 associated variable values
  152. /// @see gtx_associated_min_max
  153. template<length_t L, typename T, typename U, qualifier Q>
  154. GLM_FUNC_DECL vec<L, U, Q> associatedMax(
  155. vec<L, T, Q> const& x, vec<L, U, Q> const& a,
  156. vec<L, T, Q> const& y, vec<L, U, Q> const& b,
  157. vec<L, T, Q> const& z, vec<L, U, Q> const& c,
  158. vec<L, T, Q> const& w, vec<L, U, Q> const& d);
  159. /// Maximum comparison between 4 variables and returns 4 associated variable values
  160. /// @see gtx_associated_min_max
  161. template<length_t L, typename T, typename U, qualifier Q>
  162. GLM_FUNC_DECL vec<L, U, Q> associatedMax(
  163. T x, vec<L, U, Q> const& a,
  164. T y, vec<L, U, Q> const& b,
  165. T z, vec<L, U, Q> const& c,
  166. T w, vec<L, U, Q> const& d);
  167. /// Maximum comparison between 4 variables and returns 4 associated variable values
  168. /// @see gtx_associated_min_max
  169. template<length_t L, typename T, typename U, qualifier Q>
  170. GLM_FUNC_DECL vec<L, U, Q> associatedMax(
  171. vec<L, T, Q> const& x, U a,
  172. vec<L, T, Q> const& y, U b,
  173. vec<L, T, Q> const& z, U c,
  174. vec<L, T, Q> const& w, U d);
  175. /// @}
  176. } //namespace glm
  177. #include "associated_min_max.inl"