readTGF.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_READTGF_H
  9. #define IGL_READTGF_H
  10. #include "igl_inline.h"
  11. #include <vector>
  12. #include <string>
  13. #ifndef IGL_NO_EIGEN
  14. #include <Eigen/Dense>
  15. #endif
  16. namespace igl
  17. {
  18. // READTGF
  19. //
  20. // [V,E,P,BE,CE,PE] = readTGF(filename)
  21. //
  22. // Read a graph from a .tgf file
  23. //
  24. // Input:
  25. // filename .tgf file name
  26. // Ouput:
  27. // V # vertices by 3 list of vertex positions
  28. // E # edges by 2 list of edge indices
  29. // P # point-handles list of point handle indices
  30. // BE # bone-edges by 2 list of bone-edge indices
  31. // CE # cage-edges by 2 list of cage-edge indices
  32. // PE # pseudo-edges by 2 list of pseudo-edge indices
  33. //
  34. // Assumes that graph vertices are 3 dimensional
  35. IGL_INLINE bool readTGF(
  36. const std::string tgf_filename,
  37. std::vector<std::vector<double> > & C,
  38. std::vector<std::vector<int> > & E,
  39. std::vector<int> & P,
  40. std::vector<std::vector<int> > & BE,
  41. std::vector<std::vector<int> > & CE,
  42. std::vector<std::vector<int> > & PE);
  43. #ifndef IGL_NO_EIGEN
  44. IGL_INLINE bool readTGF(
  45. const std::string tgf_filename,
  46. Eigen::MatrixXd & C,
  47. Eigen::MatrixXi & E,
  48. Eigen::VectorXi & P,
  49. Eigen::MatrixXi & BE,
  50. Eigen::MatrixXi & CE,
  51. Eigen::MatrixXi & PE);
  52. IGL_INLINE bool readTGF(
  53. const std::string tgf_filename,
  54. Eigen::MatrixXd & C,
  55. Eigen::MatrixXi & E);
  56. #endif
  57. }
  58. #ifndef IGL_STATIC_LIBRARY
  59. # include "readTGF.cpp"
  60. #endif
  61. #endif