unproject.h 983 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef IGL_UNPROJECT_H
  2. #define IGL_UNPROJECT_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Wrapper for gluUnproject that uses the current GL_MODELVIEW_MATRIX,
  8. // GL_PROJECTION_MATRIX, and GL_VIEWPORT
  9. // Inputs:
  10. // win* screen space x, y, and z coordinates respectively
  11. // Outputs:
  12. // obj* pointers to 3D objects' x, y, and z coordinates respectively
  13. // Returns return value of gluUnProject call
  14. IGL_INLINE int unproject(
  15. const double winX,
  16. const double winY,
  17. const double winZ,
  18. double* objX,
  19. double* objY,
  20. double* objZ);
  21. template <typename Derivedwin, typename Derivedobj>
  22. IGL_INLINE int unproject(
  23. const Eigen::PlainObjectBase<Derivedwin> & win,
  24. Eigen::PlainObjectBase<Derivedobj> & obj);
  25. template <typename Derivedwin>
  26. IGL_INLINE Eigen::PlainObjectBase<Derivedwin> unproject(
  27. const Eigen::PlainObjectBase<Derivedwin> & win);
  28. }
  29. #ifdef IGL_HEADER_ONLY
  30. # include "unproject.cpp"
  31. #endif
  32. #endif