unproject_in_mesh.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef IGL_UNPROJECT_IN_MESH
  2. #define IGL_UNPROJECT_IN_MESH
  3. #include <igl/igl_inline.h>
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Forward define
  8. template <
  9. typename PointMatrixType,
  10. typename FaceMatrixType,
  11. typename RowVector3>
  12. class EmbreeIntersector;
  13. // Unproject a screen location (using current opengl viewport, projection, and
  14. // model view) to a 3D position
  15. //
  16. // Inputs:
  17. // x x-coordinate of mouse location
  18. // y y-coordinate of mouse location
  19. // ei EmbreeIntersector containing (V,F)
  20. // Outputs:
  21. // obj 3d unprojected mouse point in mesh
  22. // Returns true only if ray through (x,y) hits (V,F) at least
  23. // once
  24. //
  25. template <
  26. typename PointMatrixType,
  27. typename FaceMatrixType,
  28. typename RowVector3,
  29. typename Derivedobj>
  30. bool unproject_in_mesh(
  31. const int x,
  32. const int y,
  33. const igl::EmbreeIntersector<PointMatrixType,FaceMatrixType,RowVector3> & ei,
  34. Eigen::PlainObjectBase<Derivedobj> & obj);
  35. }
  36. #ifdef IGL_HEADER_ONLY
  37. # include "unproject_in_mesh.cpp"
  38. #endif
  39. #endif