forward_kinematics.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 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_FORWARD_KINEMATICS_H
  9. #define IGL_FORWARD_KINEMATICS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <Eigen/Geometry>
  13. #include <Eigen/StdVector>
  14. #include <vector>
  15. namespace igl
  16. {
  17. /// Given a skeleton and a set of relative bone rotations compute absolute
  18. /// rigid transformations for each bone.
  19. ///
  20. /// @param[in] C #C by dim list of joint positions
  21. /// @param[in] BE #BE by 2 list of bone edge indices
  22. /// @param[in] P #BE list of parent indices into BE
  23. /// @param[in] dQ #BE list of relative rotations
  24. /// @param[in] dT #BE list of relative translations
  25. /// @param[out] vQ #BE list of absolute rotations
  26. /// @param[out] vT #BE list of absolute translations
  27. IGL_INLINE void forward_kinematics(
  28. const Eigen::MatrixXd & C,
  29. const Eigen::MatrixXi & BE,
  30. const Eigen::VectorXi & P,
  31. const std::vector<
  32. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  33. const std::vector<Eigen::Vector3d> & dT,
  34. std::vector<
  35. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & vQ,
  36. std::vector<Eigen::Vector3d> & vT);
  37. /// \overload
  38. /// \brief assuming each dT[i] == {0,0,0}
  39. IGL_INLINE void forward_kinematics(
  40. const Eigen::MatrixXd & C,
  41. const Eigen::MatrixXi & BE,
  42. const Eigen::VectorXi & P,
  43. const std::vector<
  44. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  45. std::vector<
  46. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & vQ,
  47. std::vector<Eigen::Vector3d> & vT);
  48. /// \overload
  49. /// @param[out] T #BE*(dim+1) by dim stack of transposed transformation matrices
  50. IGL_INLINE void forward_kinematics(
  51. const Eigen::MatrixXd & C,
  52. const Eigen::MatrixXi & BE,
  53. const Eigen::VectorXi & P,
  54. const std::vector<
  55. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  56. const std::vector<Eigen::Vector3d> & dT,
  57. Eigen::MatrixXd & T);
  58. /// \overload
  59. IGL_INLINE void forward_kinematics(
  60. const Eigen::MatrixXd & C,
  61. const Eigen::MatrixXi & BE,
  62. const Eigen::VectorXi & P,
  63. const std::vector<
  64. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  65. Eigen::MatrixXd & T);
  66. };
  67. #ifndef IGL_STATIC_LIBRARY
  68. # include "forward_kinematics.cpp"
  69. #endif
  70. #endif