project.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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_OPENGL2_PROJECT_H
  9. #define IGL_OPENGL2_PROJECT_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Dense>
  12. namespace igl
  13. {
  14. namespace opengl2
  15. {
  16. // Wrapper for gluProject that uses the current GL_MODELVIEW_MATRIX,
  17. // GL_PROJECTION_MATRIX, and GL_VIEWPORT
  18. // Inputs:
  19. // obj* 3D objects' x, y, and z coordinates respectively
  20. // Outputs:
  21. // win* pointers to screen space x, y, and z coordinates respectively
  22. // Returns return value of gluProject call
  23. IGL_INLINE int project(
  24. const double objX,
  25. const double objY,
  26. const double objZ,
  27. double* winX,
  28. double* winY,
  29. double* winZ);
  30. // Eigen wrapper
  31. template <typename Derivedobj, typename Derivedwin>
  32. IGL_INLINE int project(
  33. const Eigen::PlainObjectBase<Derivedobj> & obj,
  34. Eigen::PlainObjectBase<Derivedwin> & win);
  35. // Eigen wrapper with return
  36. template <typename Derivedobj>
  37. IGL_INLINE Eigen::PlainObjectBase<Derivedobj> project(
  38. const Eigen::PlainObjectBase<Derivedobj> & obj);
  39. }
  40. }
  41. #ifndef IGL_STATIC_LIBRARY
  42. # include "project.cpp"
  43. #endif
  44. #endif