line_mesh_intersection.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Daniele Panozzo <daniele.panozzo@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_EMBREE_LINE_MESH_INTERSECTION_H
  9. #define IGL_EMBREE_LINE_MESH_INTERSECTION_H
  10. #include <igl/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. // Input:
  24. // V_source: #Vx3 Vertices of the source mesh
  25. // N_source: #Vx3 Normals of the point cloud
  26. // V_target: #V2x3 Vertices of the target mesh
  27. // F_target: #F2x3 Faces of the target mesh
  28. //
  29. // Output:
  30. // #Vx3 matrix of baricentric coordinate. Each row corresponds to
  31. // a vertex of the projected mesh and it has the following format:
  32. // id b1 b2. id is the id of a face of the source mesh. b1 and b2 are
  33. // the barycentric coordinates wrt the first two edges of the triangle
  34. // To convert to standard global coordinates, see barycentric_to_global.h
  35. template <typename ScalarMatrix, typename IndexMatrix>
  36. IGL_INLINE ScalarMatrix line_mesh_intersection
  37. (
  38. const ScalarMatrix & V_source,
  39. const ScalarMatrix & N_source,
  40. const ScalarMatrix & V_target,
  41. const IndexMatrix & F_target
  42. );
  43. }
  44. }
  45. #ifndef IGL_STATIC_LIBRARY
  46. # include "line_mesh_intersection.cpp"
  47. #endif
  48. #endif