triangulate.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@gmail.com>
  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. // Inputs:
  21. // V #V by 2 list of 2D vertex positions
  22. // E #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon
  23. // H #H by 2 coordinates of points contained inside holes of the polygon
  24. // flags string of options pass to triangle (see triangle documentation)
  25. // Outputs:
  26. // V2 #V2 by 2 coordinates of the vertives of the generated triangulation
  27. // F2 #F2 by 3 list of indices forming the faces of the generated triangulation
  28. //
  29. template <
  30. typename DerivedV,
  31. typename DerivedE,
  32. typename DerivedH,
  33. typename DerivedV2,
  34. typename DerivedF2>
  35. IGL_INLINE void triangulate(
  36. const Eigen::MatrixBase<DerivedV> & V,
  37. const Eigen::MatrixBase<DerivedE> & E,
  38. const Eigen::MatrixBase<DerivedH> & H,
  39. const std::string flags,
  40. Eigen::PlainObjectBase<DerivedV2> & V2,
  41. Eigen::PlainObjectBase<DerivedF2> & F2);
  42. // Triangulate the interior of a polygon using the triangle library.
  43. //
  44. // Inputs:
  45. // V #V by 2 list of 2D vertex positions
  46. // E #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon
  47. // H #H by 2 coordinates of points contained inside holes of the polygon
  48. // M #V list of markers for input vertices
  49. // flags string of options pass to triangle (see triangle documentation)
  50. // Outputs:
  51. // V2 #V2 by 2 coordinates of the vertives of the generated triangulation
  52. // F2 #F2 by 3 list of indices forming the faces of the generated triangulation
  53. // M2 #V2 list of markers for output vertices
  54. //
  55. // TODO: expose the option to prevent Steiner points on the boundary
  56. //
  57. template <
  58. typename DerivedV,
  59. typename DerivedE,
  60. typename DerivedH,
  61. typename DerivedVM,
  62. typename DerivedEM,
  63. typename DerivedV2,
  64. typename DerivedF2,
  65. typename DerivedVM2,
  66. typename DerivedEM2>
  67. IGL_INLINE void triangulate(
  68. const Eigen::MatrixBase<DerivedV> & V,
  69. const Eigen::MatrixBase<DerivedE> & E,
  70. const Eigen::MatrixBase<DerivedH> & H,
  71. const Eigen::MatrixBase<DerivedVM> & VM,
  72. const Eigen::MatrixBase<DerivedEM> & EM,
  73. const std::string flags,
  74. Eigen::PlainObjectBase<DerivedV2> & V2,
  75. Eigen::PlainObjectBase<DerivedF2> & F2,
  76. Eigen::PlainObjectBase<DerivedVM2> & VM2,
  77. Eigen::PlainObjectBase<DerivedEM2> & EM2);
  78. }
  79. }
  80. #ifndef IGL_STATIC_LIBRARY
  81. # include "triangulate.cpp"
  82. #endif
  83. #endif