unproject_in_mesh.h 1.0 KB

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