barycentric_to_global.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_BARYCENTRIC2GLOBAL_H
  9. #define IGL_BARYCENTRIC2GLOBAL_H
  10. #include <igl/igl_inline.h>
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. // Converts barycentric coordinates in the embree form to 3D coordinates
  16. // Embree stores barycentric coordinates as triples: fid, bc1, bc2
  17. // fid is the id of a face, bc1 is the displacement of the point wrt the
  18. // first vertex v0 and the edge v1-v0. Similarly, bc2 is the displacement
  19. // wrt v2-v0.
  20. //
  21. // Input:
  22. // V: #Vx3 Vertices of the mesh
  23. // F: #Fxe Faces of the mesh
  24. // bc: #Xx3 Barycentric coordinates, one row per point
  25. //
  26. // Output:
  27. // #X: #Xx3 3D coordinates of all points in bc
  28. template <typename Scalar, typename Index>
  29. IGL_INLINE Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic>
  30. barycentric_to_global(
  31. const Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> & V,
  32. const Eigen::Matrix<Index,Eigen::Dynamic,Eigen::Dynamic> & F,
  33. const Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> & bc);
  34. }
  35. #ifndef IGL_STATIC_LIBRARY
  36. # include "barycentric_to_global.cpp"
  37. #endif
  38. #endif