barycentric_interpolation.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2020 Alec Jacobson <[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_BARYCENTRIC_INTERPOLATION_H
  9. #define IGL_BARYCENTRIC_INTERPOLATION_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Interpolate data on a triangle mesh using barycentric coordinates
  15. ///
  16. /// @param[in] D #D by dim list of per-vertex data
  17. /// @param[in] F #F by 3 list of triangle indices
  18. /// @param[in] B #X by 3 list of barycentric corodinates
  19. /// @param[in] I #X list of triangle indices
  20. /// @param[out] X #X by dim list of interpolated data
  21. template <
  22. typename DerivedD,
  23. typename DerivedF,
  24. typename DerivedB,
  25. typename DerivedI,
  26. typename DerivedX>
  27. IGL_INLINE void barycentric_interpolation(
  28. const Eigen::MatrixBase<DerivedD> & D,
  29. const Eigen::MatrixBase<DerivedF> & F,
  30. const Eigen::MatrixBase<DerivedB> & B,
  31. const Eigen::MatrixBase<DerivedI> & I,
  32. Eigen::PlainObjectBase<DerivedX> & X);
  33. }
  34. #ifndef IGL_STATIC_LIBRARY
  35. # include "barycentric_interpolation.cpp"
  36. #endif
  37. #endif