readBF.h 2.3 KB

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