epsilon.hpp 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. /// THE SOFTWARE.
  22. ///
  23. /// @ref gtc_epsilon
  24. /// @file glm/gtc/epsilon.hpp
  25. /// @date 2012-04-07 / 2012-04-07
  26. /// @author Christophe Riccio
  27. ///
  28. /// @see core (dependence)
  29. /// @see gtc_half_float (dependence)
  30. /// @see gtc_quaternion (dependence)
  31. ///
  32. /// @defgroup gtc_epsilon GLM_GTC_epsilon
  33. /// @ingroup gtc
  34. ///
  35. /// @brief Comparison functions for a user defined epsilon values.
  36. ///
  37. /// <glm/gtc/epsilon.hpp> need to be included to use these functionalities.
  38. ///////////////////////////////////////////////////////////////////////////////////
  39. #pragma once
  40. // Dependencies
  41. #include "../detail/setup.hpp"
  42. #include "../detail/precision.hpp"
  43. #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
  44. # pragma message("GLM: GLM_GTC_epsilon extension included")
  45. #endif
  46. namespace glm
  47. {
  48. /// @addtogroup gtc_epsilon
  49. /// @{
  50. /// Returns the component-wise comparison of |x - y| < epsilon.
  51. /// True if this expression is satisfied.
  52. ///
  53. /// @see gtc_epsilon
  54. template <typename T, precision P, template <typename, precision> class vecType>
  55. GLM_FUNC_DECL vecType<bool, P> epsilonEqual(
  56. vecType<T, P> const & x,
  57. vecType<T, P> const & y,
  58. T const & epsilon);
  59. /// Returns the component-wise comparison of |x - y| < epsilon.
  60. /// True if this expression is satisfied.
  61. ///
  62. /// @see gtc_epsilon
  63. template <typename genType>
  64. GLM_FUNC_DECL bool epsilonEqual(
  65. genType const & x,
  66. genType const & y,
  67. genType const & epsilon);
  68. /// Returns the component-wise comparison of |x - y| < epsilon.
  69. /// True if this expression is not satisfied.
  70. ///
  71. /// @see gtc_epsilon
  72. template <typename genType>
  73. GLM_FUNC_DECL typename genType::boolType epsilonNotEqual(
  74. genType const & x,
  75. genType const & y,
  76. typename genType::value_type const & epsilon);
  77. /// Returns the component-wise comparison of |x - y| >= epsilon.
  78. /// True if this expression is not satisfied.
  79. ///
  80. /// @see gtc_epsilon
  81. template <typename genType>
  82. GLM_FUNC_DECL bool epsilonNotEqual(
  83. genType const & x,
  84. genType const & y,
  85. genType const & epsilon);
  86. /// @}
  87. }//namespace glm
  88. #include "epsilon.inl"