tetgenio_to_tetmesh.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. // F #F by 3 list of marked facets
  24. // Returns true on success, false on error
  25. IGL_INLINE bool tetgenio_to_tetmesh(
  26. const tetgenio & out,
  27. std::vector<std::vector<REAL > > & V,
  28. std::vector<std::vector<int> > & T,
  29. std::vector<std::vector<int> > & F);
  30. IGL_INLINE bool tetgenio_to_tetmesh(
  31. const tetgenio & out,
  32. std::vector<std::vector<REAL > > & V,
  33. std::vector<std::vector<int> > & T);
  34. // Wrapper with Eigen types
  35. // Templates:
  36. // DerivedV real-value: i.e. from MatrixXd
  37. // DerivedT integer-value: i.e. from MatrixXi
  38. template <typename DerivedV, typename DerivedT, typename DerivedF>
  39. IGL_INLINE bool tetgenio_to_tetmesh(
  40. const tetgenio & out,
  41. Eigen::PlainObjectBase<DerivedV>& V,
  42. Eigen::PlainObjectBase<DerivedT>& T,
  43. Eigen::PlainObjectBase<DerivedF>& F);
  44. template <typename DerivedV, typename DerivedT>
  45. IGL_INLINE bool tetgenio_to_tetmesh(
  46. const tetgenio & out,
  47. Eigen::PlainObjectBase<DerivedV>& V,
  48. Eigen::PlainObjectBase<DerivedT>& T);
  49. }
  50. #ifndef IGL_STATIC_LIBRARY
  51. # include "tetgenio_to_tetmesh.cpp"
  52. #endif
  53. #endif