writeMESH.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. //
  20. // Known bugs: Holes and regions are not supported
  21. template <typename Scalar, typename Index>
  22. IGL_INLINE bool writeMESH(
  23. const std::string mesh_file_name,
  24. const std::vector<std::vector<Scalar > > & V,
  25. const std::vector<std::vector<Index > > & T,
  26. const std::vector<std::vector<Index > > & F);
  27. // Templates:
  28. // DerivedV real-value: i.e. from MatrixXd
  29. // DerivedT integer-value: i.e. from MatrixXi
  30. // DerivedF integer-value: i.e. from MatrixXi
  31. // Input:
  32. // mesh_file_name path of .mesh file
  33. // V eigen double matrix #V by 3
  34. // T eigen int matrix #T by 4
  35. // F eigen int matrix #F by 3
  36. template <typename DerivedV, typename DerivedT, typename DerivedF>
  37. IGL_INLINE bool writeMESH(
  38. const std::string str,
  39. const Eigen::PlainObjectBase<DerivedV> & V,
  40. const Eigen::PlainObjectBase<DerivedT> & T,
  41. const Eigen::PlainObjectBase<DerivedF> & F);
  42. }
  43. #ifdef IGL_HEADER_ONLY
  44. # include "writeMESH.cpp"
  45. #endif
  46. #endif