mesh_to_tetgenio.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_TETGEN_MESH_TO_TETGENIO_H
  9. #define IGL_TETGEN_MESH_TO_TETGENIO_H
  10. #include "../igl_inline.h"
  11. #ifndef TETLIBRARY
  12. # define TETLIBRARY
  13. #endif
  14. #include "tetgen.h" // Defined tetgenio, REAL
  15. #include <vector>
  16. #include <Eigen/Core>
  17. namespace igl
  18. {
  19. namespace tetgen
  20. {
  21. // Load a vertex list and face list into a tetgenio object
  22. // Inputs:
  23. // V #V by 3 vertex position list
  24. // F #F list of polygon face indices into V (0-indexed)
  25. // Outputs:
  26. // in tetgenio input object
  27. // Returns true on success, false on error
  28. IGL_INLINE bool mesh_to_tetgenio(
  29. const std::vector<std::vector<REAL > > & V,
  30. const std::vector<std::vector<int> > & F,
  31. tetgenio & in);
  32. // Wrapper with Eigen types
  33. // Templates:
  34. // DerivedV real-value: i.e. from MatrixXd
  35. // DerivedF integer-value: i.e. from MatrixXi
  36. template <typename DerivedV, typename DerivedF>
  37. IGL_INLINE bool mesh_to_tetgenio(
  38. const Eigen::PlainObjectBase<DerivedV>& V,
  39. const Eigen::PlainObjectBase<DerivedF>& F,
  40. tetgenio & in);
  41. }
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "mesh_to_tetgenio.cpp"
  45. #endif
  46. #endif