project.h 1019 B

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