triangulate.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <[email protected]>
  4. // Copyright (C) 2017 Alec Jacobson
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla Public License
  7. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  8. // obtain one at http://mozilla.org/MPL/2.0/.
  9. #ifndef IGL_TRIANGLE_TRIANGULATE_H
  10. #define IGL_TRIANGLE_TRIANGULATE_H
  11. #include "../igl_inline.h"
  12. #include <string>
  13. #include <Eigen/Core>
  14. namespace igl
  15. {
  16. namespace triangle
  17. {
  18. /// Triangulate the interior of a polygon using the triangle library.
  19. ///
  20. /// @param[in] V #V by 2 list of 2D vertex positions
  21. /// @param[in] E #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon
  22. /// @param[in] H #H by 2 coordinates of points contained inside holes of the polygon
  23. /// @param[in] VM #V list of markers for input vertices
  24. /// @param[in] EM #E list of markers for input edges
  25. /// @param[in] flags string of options pass to triangle (see triangle documentation)
  26. /// @param[out] V2 #V2 by 2 coordinates of the vertives of the generated triangulation
  27. /// @param[out] F2 #F2 by 3 list of indices forming the faces of the generated triangulation
  28. /// @param[out] VM2 #V2 list of markers for output vertices
  29. /// @param[out] E2 #E2 by 2 list of output edges
  30. /// @param[out] EM2 #E2 list of markers for output edges
  31. template <
  32. typename DerivedV,
  33. typename DerivedE,
  34. typename DerivedH,
  35. typename DerivedVM,
  36. typename DerivedEM,
  37. typename DerivedV2,
  38. typename DerivedF2,
  39. typename DerivedVM2,
  40. typename DerivedE2,
  41. typename DerivedEM2>
  42. IGL_INLINE void triangulate(
  43. const Eigen::MatrixBase<DerivedV> & V,
  44. const Eigen::MatrixBase<DerivedE> & E,
  45. const Eigen::MatrixBase<DerivedH> & H,
  46. const Eigen::MatrixBase<DerivedVM> & VM,
  47. const Eigen::MatrixBase<DerivedEM> & EM,
  48. const std::string flags,
  49. Eigen::PlainObjectBase<DerivedV2> & V2,
  50. Eigen::PlainObjectBase<DerivedF2> & F2,
  51. Eigen::PlainObjectBase<DerivedVM2> & VM2,
  52. Eigen::PlainObjectBase<DerivedE2> & E2,
  53. Eigen::PlainObjectBase<DerivedEM2> & EM2);
  54. /// \overload
  55. template <
  56. typename DerivedV,
  57. typename DerivedE,
  58. typename DerivedH,
  59. typename DerivedV2,
  60. typename DerivedF2>
  61. IGL_INLINE void triangulate(
  62. const Eigen::MatrixBase<DerivedV> & V,
  63. const Eigen::MatrixBase<DerivedE> & E,
  64. const Eigen::MatrixBase<DerivedH> & H,
  65. const std::string flags,
  66. Eigen::PlainObjectBase<DerivedV2> & V2,
  67. Eigen::PlainObjectBase<DerivedF2> & F2);
  68. }
  69. }
  70. #ifndef IGL_STATIC_LIBRARY
  71. # include "triangulate.cpp"
  72. #endif
  73. #endif