bone_parents.cpp 697 B

12345678910111213141516171819202122232425
  1. #include "bone_parents.h"
  2. template <typename DerivedBE, typename DerivedP>
  3. IGL_INLINE void igl::bone_parents(
  4. const Eigen::PlainObjectBase<DerivedBE>& BE,
  5. Eigen::PlainObjectBase<DerivedP>& P)
  6. {
  7. P.resize(BE.rows(),1);
  8. // Stupid O(n²) version
  9. for(int e = 0;e<BE.rows();e++)
  10. {
  11. P(e) = -1;
  12. for(int f = 0;f<BE.rows();f++)
  13. {
  14. if(BE(e,0) == BE(f,1))
  15. {
  16. P(e) = f;
  17. }
  18. }
  19. }
  20. }
  21. #ifdef IGL_STATIC_LIBRARY
  22. template void igl::bone_parents<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  23. #endif