unproject_to_zero_plane.h 987 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef IGL_UNPROJECT_TO_ZERO_PLANE_H
  2. #define IGL_UNPROJECT_TO_ZERO_PLANE_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 to unproject a screen postion
  9. // (winX,winY) to a 3d location at same depth as the current origin.
  10. // Inputs:
  11. // win* screen space x, y, and z coordinates respectively
  12. // Outputs:
  13. // obj* pointers to 3D objects' x, y, and z coordinates respectively
  14. // Returns return value of gluUnProject call
  15. IGL_INLINE int unproject_to_zero_plane(
  16. const double winX,
  17. const double winY,
  18. double* objX,
  19. double* objY,
  20. double* objZ);
  21. template <typename Derivedwin, typename Derivedobj>
  22. IGL_INLINE int unproject_to_zero_plane(
  23. const Eigen::PlainObjectBase<Derivedwin> & win,
  24. Eigen::PlainObjectBase<Derivedobj> & obj);
  25. }
  26. #ifdef IGL_HEADER_ONLY
  27. # include "unproject_to_zero_plane.cpp"
  28. #endif
  29. #endif