unproject_in_mesh.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. template <
  11. typename Scalar,
  12. typename Index>
  13. class EmbreeIntersector;
  14. // Unproject a screen location (using current opengl viewport, projection, and
  15. // model view) to a 3D position
  16. //
  17. // Inputs:
  18. // x x-coordinate of mouse location
  19. // y y-coordinate of mouse location
  20. // ei EmbreeIntersector containing (V,F)
  21. // Outputs:
  22. // obj 3d unprojected mouse point in mesh
  23. // Returns number of hits
  24. //
  25. template <
  26. typename Scalar,
  27. typename Index,
  28. typename Derivedobj>
  29. int unproject_in_mesh(
  30. const int x,
  31. const int y,
  32. const igl::EmbreeIntersector<Scalar,Index> & ei,
  33. Eigen::PlainObjectBase<Derivedobj> & obj);
  34. template <
  35. typename Scalar,
  36. typename Index,
  37. typename Derivedobj>
  38. int unproject_in_mesh(
  39. const int x,
  40. const int y,
  41. const igl::EmbreeIntersector<Scalar,Index> & ei,
  42. Eigen::PlainObjectBase<Derivedobj> & obj,
  43. std::vector<igl::Hit > & hits);
  44. }
  45. #ifdef IGL_HEADER_ONLY
  46. # include "unproject_in_mesh.cpp"
  47. #endif
  48. #endif