unproject_in_mesh.h 1.4 KB

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