unproject_to_zero_plane.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_UNPROJECT_TO_ZERO_PLANE_H
  9. #define IGL_UNPROJECT_TO_ZERO_PLANE_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Wrapper for gluUnproject that uses the current GL_MODELVIEW_MATRIX,
  15. // GL_PROJECTION_MATRIX, and GL_VIEWPORT to unproject a screen postion
  16. // (winX,winY) to a 3d location at same depth as the current origin.
  17. // Inputs:
  18. // win* screen space x, y, and z coordinates respectively
  19. // Outputs:
  20. // obj* pointers to 3D objects' x, y, and z coordinates respectively
  21. // Returns return value of gluUnProject call
  22. IGL_INLINE int unproject_to_zero_plane(
  23. const double winX,
  24. const double winY,
  25. double* objX,
  26. double* objY,
  27. double* objZ);
  28. template <typename Derivedwin, typename Derivedobj>
  29. IGL_INLINE int unproject_to_zero_plane(
  30. const Eigen::PlainObjectBase<Derivedwin> & win,
  31. Eigen::PlainObjectBase<Derivedobj> & obj);
  32. }
  33. #ifndef IGL_STATIC_LIBRARY
  34. # include "unproject_to_zero_plane.cpp"
  35. #endif
  36. #endif