triangulate.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. //
  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_TRIANGLE_TRIANGULATE_H
  9. #define IGL_TRIANGLE_TRIANGULATE_H
  10. #include "../igl_inline.h"
  11. #include <string>
  12. #include <Eigen/Core>
  13. namespace igl
  14. {
  15. namespace triangle
  16. {
  17. // Triangulate the interior of a polygon using the triangle library.
  18. //
  19. // Inputs:
  20. // V #V by 2 list of 2D vertex positions
  21. // E #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon
  22. // H #H by 2 coordinates of points contained inside holes of the polygon
  23. // flags string of options pass to triangle (see triangle documentation)
  24. // Outputs:
  25. // V2 #V2 by 2 coordinates of the vertives of the generated triangulation
  26. // F2 #F2 by 3 list of indices forming the faces of the generated triangulation
  27. //
  28. // TODO: expose the option to prevent Steiner points on the boundary
  29. //
  30. IGL_INLINE void triangulate(
  31. const Eigen::MatrixXd& V,
  32. const Eigen::MatrixXi& E,
  33. const Eigen::MatrixXd& H,
  34. const std::string flags,
  35. Eigen::MatrixXd& V2,
  36. Eigen::MatrixXi& F2);
  37. // Triangulate the interior of a polygon using the triangle library.
  38. //
  39. // Inputs:
  40. // V #V by 2 list of 2D vertex positions
  41. // E #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon
  42. // H #H by 2 coordinates of points contained inside holes of the polygon
  43. // M #V list of markers for input vertices
  44. // flags string of options pass to triangle (see triangle documentation)
  45. // Outputs:
  46. // V2 #V2 by 2 coordinates of the vertives of the generated triangulation
  47. // F2 #F2 by 3 list of indices forming the faces of the generated triangulation
  48. // M2 #V2 list of markers for output vertices
  49. //
  50. // TODO: expose the option to prevent Steiner points on the boundary
  51. //
  52. IGL_INLINE void triangulate(
  53. const Eigen::MatrixXd& V,
  54. const Eigen::MatrixXi& E,
  55. const Eigen::MatrixXd& H,
  56. const Eigen::VectorXi& VM,
  57. const Eigen::VectorXi& EM,
  58. const std::string flags,
  59. Eigen::MatrixXd& V2,
  60. Eigen::MatrixXi& F2,
  61. Eigen::VectorXi& M2);
  62. }
  63. }
  64. #ifndef IGL_STATIC_LIBRARY
  65. # include "triangulate.cpp"
  66. #endif
  67. #endif