project_mesh.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_PROJECTMESH_H
  9. #define IGL_PROJECTMESH_H
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. #include <vector>
  14. namespace igl
  15. {
  16. //// Project the triangle mesh V_source, F_source onto the triangle mesh
  17. //// V_target,F_target.
  18. //// A ray is casted for every vertex in the normal direction and its opposite.
  19. ////
  20. //// Input:
  21. //// V_source: #Vx3 Vertices of the source mesh
  22. //// F_source: #Fx3 Faces of the source mesh
  23. //// V_target: #V2x3 Vertices of the target mesh
  24. //// F_target: #F2x3 Faces of the target mesh
  25. ////
  26. //// Output:
  27. //// #Vx3 matrix of baricentric coordinate. Each row corresponds to
  28. //// a vertex of the projected mesh and it has the following format:
  29. //// id b1 b2. id is the id of a face of the source mesh. b1 and b2 are
  30. //// the barycentric coordinates wrt the first two edges of the triangle
  31. //// To convert to standard global coordinates, see barycentric_to_global.h
  32. //template <typename ScalarMatrix, typename IndexMatrix>
  33. //IGL_INLINE ScalarMatrix project_mesh
  34. //(
  35. // const ScalarMatrix & V_source,
  36. // const IndexMatrix & F_source,
  37. // const ScalarMatrix & V_target,
  38. // const IndexMatrix & F_target
  39. //);
  40. // Project the point cloud V_source onto the triangle mesh
  41. // V_target,F_target.
  42. // A ray is casted for every vertex in the direction specified by
  43. // N_source and its opposite.
  44. //
  45. // Input:
  46. // V_source: #Vx3 Vertices of the source mesh
  47. // N_source: #Vx3 Normals of the point cloud
  48. // V_target: #V2x3 Vertices of the target mesh
  49. // F_target: #F2x3 Faces of the target mesh
  50. //
  51. // Output:
  52. // #Vx3 matrix of baricentric coordinate. Each row corresponds to
  53. // a vertex of the projected mesh and it has the following format:
  54. // id b1 b2. id is the id of a face of the source mesh. b1 and b2 are
  55. // the barycentric coordinates wrt the first two edges of the triangle
  56. // To convert to standard global coordinates, see barycentric_to_global.h
  57. template <typename ScalarMatrix, typename IndexMatrix>
  58. IGL_INLINE ScalarMatrix project_points_on_mesh
  59. (
  60. const ScalarMatrix & V_source,
  61. const ScalarMatrix & N_source,
  62. const ScalarMatrix & V_target,
  63. const IndexMatrix & F_target
  64. );
  65. }
  66. #ifndef IGL_STATIC_LIBRARY
  67. # include "project_mesh.cpp"
  68. #endif
  69. #endif