readBF.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef IGL_READBF_H
  2. #define IGL_READBF_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <string>
  6. namespace igl
  7. {
  8. // Read a bones forest from a file, returns a list of bone roots
  9. // Input:
  10. // file_name path to .bf bones tree file
  11. // Output:
  12. // WI #B list of unique weight indices
  13. // P #B list of parent indices into B, -1 for roots
  14. // O #B by 3 list of tip offset vectors from parent (or position for roots)
  15. // Returns true on success, false on errors
  16. template <
  17. typename DerivedWI,
  18. typename DerivedP,
  19. typename DerivedO>
  20. IGL_INLINE bool readBF(
  21. const std::string & filename,
  22. Eigen::PlainObjectBase<DerivedWI> & WI,
  23. Eigen::PlainObjectBase<DerivedP> & P,
  24. Eigen::PlainObjectBase<DerivedO> & O);
  25. // Read bone forest into pure bone-skeleton format, expects only bones (no
  26. // point handles), and that a root in the .bf <---> no weight attachment.
  27. //
  28. // Input:
  29. // file_name path to .bf bones tree file
  30. // Output:
  31. // WI #B list of unique weight indices
  32. // P #B list of parent indices into B, -1 for roots
  33. // O #B by 3 list of tip offset vectors from parent (or position for roots)
  34. // C #C by 3 list of absolute joint locations
  35. // BE #BE by 3 list of bone indices into C, in order of weight index
  36. // P #BE list of parent bone indices into BE, -1 means root bone
  37. // Returns true on success, false on errors
  38. //
  39. // See also: readTGF, bone_parents, forward_kinematics
  40. template <
  41. typename DerivedWI,
  42. typename DerivedbfP,
  43. typename DerivedO,
  44. typename DerivedC,
  45. typename DerivedBE,
  46. typename DerivedP>
  47. IGL_INLINE bool readBF(
  48. const std::string & filename,
  49. Eigen::PlainObjectBase<DerivedWI> & WI,
  50. Eigen::PlainObjectBase<DerivedbfP> & bfP,
  51. Eigen::PlainObjectBase<DerivedO> & O,
  52. Eigen::PlainObjectBase<DerivedC> & C,
  53. Eigen::PlainObjectBase<DerivedBE> & BE,
  54. Eigen::PlainObjectBase<DerivedP> & P);
  55. }
  56. #ifndef IGL_STATIC_LIBRARY
  57. # include "readBF.cpp"
  58. #endif
  59. #endif