mesh_to_tetgenio.h 1.6 KB

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