direct_delta_mush.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2020 Xiangyu Kong <[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_DIRECT_DELTA_MUSH_H
  9. #define IGL_DIRECT_DELTA_MUSH_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Sparse>
  13. #include <Eigen/Geometry>
  14. #include <vector>
  15. namespace igl {
  16. /// Computes Direct Delta Mush Skinning (Variant 0) from "Direct Delta Mush
  17. /// Skinning and Variants"
  18. ///
  19. /// @param[in] V #V by 3 list of rest pose vertex positions
  20. /// @param[in] T #T list of bone pose transformations
  21. /// @param[in] Omega #V by #T*10 list of precomputated matrix values
  22. /// @param[out] U #V by 3 list of output vertex positions
  23. template <
  24. typename DerivedV,
  25. typename DerivedOmega,
  26. typename DerivedU>
  27. IGL_INLINE void direct_delta_mush(
  28. const Eigen::MatrixBase<DerivedV> & V,
  29. const std::vector<
  30. Eigen::Affine3d, Eigen::aligned_allocator<Eigen::Affine3d>
  31. > & T, /* should eventually be templated more generally than double */
  32. const Eigen::MatrixBase<DerivedOmega> & Omega,
  33. Eigen::PlainObjectBase<DerivedU> & U);
  34. /// Precomputation for Direct Delta Mush Skinning.
  35. ///
  36. /// @param[in] V #V by 3 list of rest pose vertex positions
  37. /// @param[in] F #F by 3 list of triangle indices into rows of V
  38. /// @param[in] W #V by #Edges list of weights
  39. /// @param[in] p number of smoothing iterations
  40. /// @param[in] lambda rotation smoothing step size
  41. /// @param[in] kappa translation smoothness step size
  42. /// @param[in] alpha translation smoothness blending weight
  43. /// @param[out] Omega #V by #T*10 list of precomputated matrix values
  44. ///
  45. /// \fileinfo
  46. template <
  47. typename DerivedV,
  48. typename DerivedF,
  49. typename DerivedW,
  50. typename DerivedOmega>
  51. IGL_INLINE void direct_delta_mush_precomputation(
  52. const Eigen::MatrixBase<DerivedV> & V,
  53. const Eigen::MatrixBase<DerivedF> & F,
  54. const Eigen::MatrixBase<DerivedW> & W,
  55. const int p,
  56. const typename DerivedV::Scalar lambda,
  57. const typename DerivedV::Scalar kappa,
  58. const typename DerivedV::Scalar alpha,
  59. Eigen::PlainObjectBase<DerivedOmega> & Omega);
  60. }
  61. #ifndef IGL_STATIC_LIBRARY
  62. # include "direct_delta_mush.cpp"
  63. #endif
  64. #endif