closest_point.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /// @ref gtx_closest_point
  2. /// @file glm/gtx/closest_point.hpp
  3. ///
  4. /// @see core (dependence)
  5. ///
  6. /// @defgroup gtx_closest_point GLM_GTX_closest_point
  7. /// @ingroup gtx
  8. ///
  9. /// Include <glm/gtx/closest_point.hpp> to use the features of this extension.
  10. ///
  11. /// Find the point on a straight line which is the closet of a point.
  12. #pragma once
  13. // Dependency:
  14. #include "../glm.hpp"
  15. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  16. # ifndef GLM_ENABLE_EXPERIMENTAL
  17. # pragma message("GLM: GLM_GTX_closest_point 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. # else
  19. # pragma message("GLM: GLM_GTX_closest_point extension included")
  20. # endif
  21. #endif
  22. namespace glm
  23. {
  24. /// @addtogroup gtx_closest_point
  25. /// @{
  26. /// Find the point on a straight line which is the closet of a point.
  27. /// @see gtx_closest_point
  28. template<typename T, qualifier Q>
  29. GLM_FUNC_DECL vec<3, T, Q> closestPointOnLine(
  30. vec<3, T, Q> const& point,
  31. vec<3, T, Q> const& a,
  32. vec<3, T, Q> const& b);
  33. /// 2d lines work as well
  34. template<typename T, qualifier Q>
  35. GLM_FUNC_DECL vec<2, T, Q> closestPointOnLine(
  36. vec<2, T, Q> const& point,
  37. vec<2, T, Q> const& a,
  38. vec<2, T, Q> const& b);
  39. /// @}
  40. }// namespace glm
  41. #include "closest_point.inl"