forward_kinematics.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@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_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. // Inputs:
  21. // C #C by dim list of joint positions
  22. // BE #BE by 2 list of bone edge indices
  23. // P #BE list of parent indices into BE
  24. // dQ #BE list of relative rotations
  25. // Outputs:
  26. // vQ #BE list of absolute rotations
  27. // vT #BE list of absolute translations
  28. IGL_INLINE void forward_kinematics(
  29. const Eigen::MatrixXd & C,
  30. const Eigen::MatrixXi & BE,
  31. const Eigen::VectorXi & P,
  32. const std::vector<
  33. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  34. std::vector<
  35. Eigen::Quaterniond,Eigen::aligned_allocator<Eigen::Quaterniond> > & vQ,
  36. std::vector<Eigen::Vector3d> & vT);
  37. // Outputs:
  38. // T #BE*(dim+1) by dim stack of transposed transformation matrices
  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. Eigen::MatrixXd & T);
  46. };
  47. #ifndef IGL_STATIC_LIBRARY
  48. # include "forward_kinematics.cpp"
  49. #endif
  50. #endif