mesh_to_tetgenio.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. // Load a vertex list and face list into a tetgenio object
  44. // Inputs:
  45. // V #V by 3 vertex position list
  46. // F #F list of polygon face indices into V (0-indexed)
  47. // H #H list of seed point inside each hole
  48. // R #R list of seed point inside each region
  49. // Outputs:
  50. // in tetgenio input object
  51. // Returns true on success, false on error
  52. IGL_INLINE bool mesh_to_tetgenio(
  53. const std::vector<std::vector<REAL> > & V,
  54. const std::vector<std::vector<int> > & F,
  55. const std::vector<std::vector<REAL > > & H,
  56. const std::vector<std::vector<REAL > > & R,
  57. tetgenio & in);
  58. // Wrapper with Eigen types
  59. // Templates:
  60. // DerivedV real-value: i.e. from MatrixXd
  61. // DerivedF integer-value: i.e. from MatrixXi
  62. // DerivedH real-value
  63. // DerivedR real-value
  64. template <typename DerivedV, typename DerivedF, typename DerivedH, typename DerivedR>
  65. IGL_INLINE bool mesh_to_tetgenio(
  66. const Eigen::PlainObjectBase<DerivedV>& V,
  67. const Eigen::PlainObjectBase<DerivedF>& F,
  68. const Eigen::PlainObjectBase<DerivedH>& H,
  69. const Eigen::PlainObjectBase<DerivedR>& R,
  70. tetgenio& in);
  71. }
  72. }
  73. }
  74. #ifndef IGL_STATIC_LIBRARY
  75. # include "mesh_to_tetgenio.cpp"
  76. #endif
  77. #endif