mesh_to_tetgenio.h 1.5 KB

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