unproject_in_mesh.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_UNPROJECT_IN_MESH
  9. #define IGL_UNPROJECT_IN_MESH
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Core>
  12. #include <vector>
  13. #include "Hit.h"
  14. namespace igl
  15. {
  16. // Forward define
  17. class EmbreeIntersector;
  18. // Unproject a screen location (using current opengl viewport, projection, and
  19. // model view) to a 3D position
  20. //
  21. // Inputs:
  22. // x x-coordinate of mouse location
  23. // y y-coordinate of mouse location
  24. // ei EmbreeIntersector containing (V,F)
  25. // Outputs:
  26. // obj 3d unprojected mouse point in mesh
  27. // Returns number of hits
  28. //
  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. template <
  37. typename Derivedobj>
  38. int unproject_in_mesh(
  39. const int x,
  40. const int y,
  41. const igl::EmbreeIntersector & 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