py_forward_kinematics.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2017 Sebastian Koch <s.koch@tu-berlin.de> and 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. //m.def("forward_kinematics", []
  9. //(
  10. // const Eigen::MatrixXd& C,
  11. // const Eigen::MatrixXi& BE,
  12. // const Eigen::MatrixXi& P,
  13. // std::vector<Eigen::Quaterniond, Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  14. // std::vector<Eigen::Vector3d> & dT,
  15. // std::vector<Eigen::Quaterniond, Eigen::aligned_allocator<Eigen::Quaterniond> > & vQ,
  16. // std::vector<Eigen::Vector3d> & vT
  17. //)
  18. //{
  19. // return igl::forward_kinematics(C, BE, P, dQ, dT, vQ, vT);
  20. //}, __doc_igl_forward_kinematics,
  21. //py::arg("C"), py::arg("BE"), py::arg("P"), py::arg("dQ"), py::arg("dT"), py::arg("vQ"), py::arg("vT"));
  22. m.def("forward_kinematics", []
  23. (
  24. const Eigen::MatrixXd& C,
  25. const Eigen::MatrixXi& BE,
  26. const Eigen::MatrixXi& P,
  27. const RotationList& dQ,
  28. RotationList& vQ,
  29. py::list vT
  30. )
  31. {
  32. std::vector<Eigen::Vector3d> vTl;
  33. igl::forward_kinematics(C, BE, P, dQ, vQ, vTl);
  34. for (auto item : vTl) {
  35. py::object obj = py::cast(Eigen::MatrixXd(item));
  36. vT.append(obj);
  37. }
  38. }, __doc_igl_forward_kinematics,
  39. py::arg("C"), py::arg("BE"), py::arg("P"), py::arg("dQ"), py::arg("vQ"), py::arg("vT"));
  40. //m.def("forward_kinematics", []
  41. //(
  42. // const Eigen::MatrixXd& C,
  43. // const Eigen::MatrixXi& BE,
  44. // const Eigen::MatrixXi& P,
  45. // std::vector<Eigen::Quaterniond, Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  46. // std::vector<Eigen::Vector3d> & dT,
  47. // Eigen::MatrixXd& T
  48. //)
  49. //{
  50. // return igl::forward_kinematics(C, BE, P, dQ, dT, T);
  51. //}, __doc_igl_forward_kinematics,
  52. //py::arg("C"), py::arg("BE"), py::arg("P"), py::arg("dQ"), py::arg("dT"), py::arg("T"));
  53. //m.def("forward_kinematics", []
  54. //(
  55. // const Eigen::MatrixXd& C,
  56. // const Eigen::MatrixXi& BE,
  57. // const Eigen::MatrixXi& P,
  58. // std::vector<Eigen::Quaterniond, Eigen::aligned_allocator<Eigen::Quaterniond> > & dQ,
  59. // Eigen::MatrixXd& T
  60. //)
  61. //{
  62. // return igl::forward_kinematics(C, BE, P, dQ, T);
  63. //}, __doc_igl_forward_kinematics,
  64. //py::arg("C"), py::arg("BE"), py::arg("P"), py::arg("dQ"), py::arg("T"));