line_mesh_intersection.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Daniele Panozzo <[email protected]>
  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_EMBREE_LINE_MESH_INTERSECTION_H
  9. #define IGL_EMBREE_LINE_MESH_INTERSECTION_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. #include <vector>
  14. namespace igl
  15. {
  16. namespace embree
  17. {
  18. /// Project the point cloud V_source onto the triangle mesh
  19. /// V_target,F_target.
  20. /// A ray is casted for every vertex in the direction specified by
  21. /// N_source and its opposite.
  22. ///
  23. /// @param[in] V_source: #Vx3 Vertices of the source mesh
  24. /// @param[in] N_source: #Vx3 Normals of the point cloud
  25. /// @param[in] V_target: #V2x3 Vertices of the target mesh
  26. /// @param[in] F_target: #F2x3 Faces of the target mesh
  27. ///
  28. /// @return #Vx3 matrix of baricentric coordinate. Each row corresponds to
  29. /// a vertex of the projected mesh and it has the following format:
  30. /// id b1 b2. id is the id of a face of the source mesh. b1 and b2 are
  31. /// the barycentric coordinates wrt the first two edges of the triangle
  32. /// To convert to standard global coordinates, see barycentric_to_global.h
  33. template <typename ScalarMatrix, typename IndexMatrix>
  34. IGL_INLINE ScalarMatrix line_mesh_intersection
  35. (
  36. const ScalarMatrix & V_source,
  37. const ScalarMatrix & N_source,
  38. const ScalarMatrix & V_target,
  39. const IndexMatrix & F_target
  40. );
  41. }
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "line_mesh_intersection.cpp"
  45. #endif
  46. #endif