tetgenio_to_tetmesh.h 1.4 KB

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