tetgenio_to_tetmesh.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef IGL_TETGENIO_TO_TETMESH_H
  2. #define IGL_TETGENIO_TO_TETMESH_H
  3. #include "../igl_inline.h"
  4. #define TETLIBRARY
  5. #include "tetgen.h" // Defined tetgenio, REAL
  6. #include <vector>
  7. #include <Eigen/Core>
  8. namespace igl
  9. {
  10. // Extract a tetrahedral mesh from a tetgenio object
  11. // Inputs:
  12. // out tetgenio output object
  13. // Outputs:
  14. // V #V by 3 vertex position list
  15. // T #T by 4 list of tetrahedra indices into V
  16. // Returns true on success, false on error
  17. IGL_INLINE bool tetgenio_to_tetmesh(
  18. const tetgenio & out,
  19. std::vector<std::vector<REAL > > & V,
  20. std::vector<std::vector<int> > & T);
  21. // Wrapper with Eigen types
  22. // Templates:
  23. // DerivedV real-value: i.e. from MatrixXd
  24. // DerivedT integer-value: i.e. from MatrixXi
  25. template <typename DerivedV, typename DerivedT>
  26. IGL_INLINE bool tetgenio_to_tetmesh(
  27. const tetgenio & out,
  28. Eigen::PlainObjectBase<DerivedV>& V,
  29. Eigen::PlainObjectBase<DerivedT>& T);
  30. }
  31. #ifdef IGL_HEADER_ONLY
  32. # include "tetgenio_to_tetmesh.cpp"
  33. #endif
  34. #endif