writeMESH.h 1.4 KB

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