readMESH.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef IGL_READMESH_H
  2. #define IGL_READMESH_H
  3. #include "igl_inline.h"
  4. #include <string>
  5. #include <vector>
  6. #include <Eigen/Core>
  7. namespace igl
  8. {
  9. // load a tetrahedral volume mesh from a .mesh file
  10. //
  11. // Templates:
  12. // Scalar type for positions and vectors (will be read as double and cast
  13. // to Scalar)
  14. // Index type for indices (will be read as int and cast to Index)
  15. // Input:
  16. // mesh_file_name path of .mesh file
  17. // Outputs:
  18. // V double matrix of vertex positions #V by 3
  19. // T #T list of tet indices into vertex positions
  20. // F #F list of face indices into vertex positions
  21. template <typename Scalar, typename Index>
  22. IGL_INLINE bool readMESH(
  23. const std::string mesh_file_name,
  24. std::vector<std::vector<Scalar > > & V,
  25. std::vector<std::vector<Index > > & T,
  26. std::vector<std::vector<Index > > & F);
  27. // Input:
  28. // mesh_file_name path of .mesh file
  29. // Outputs:
  30. // V eigen double matrix #V by 3
  31. // T eigen int matrix #T by 4
  32. // F eigen int matrix #F by 3
  33. IGL_INLINE bool readMESH(
  34. const std::string str,
  35. Eigen::MatrixXd& V,
  36. Eigen::MatrixXi& T,
  37. Eigen::MatrixXi& F);
  38. }
  39. #ifdef IGL_HEADER_ONLY
  40. # include "readMESH.cpp"
  41. #endif
  42. #endif