triangulate.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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_TRIANGULATE_H
  9. #define IGL_TRIANGULATE_H
  10. #include <igl/igl_inline.h>
  11. #include <string>
  12. #include <Eigen/Core>
  13. namespace igl
  14. {
  15. // Triangulate the interior of a polygon using the triangle library.
  16. //
  17. // Inputs:
  18. // V #V by 2 list of 2D vertex positions
  19. // E #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon
  20. // H #H by 2 coordinates of points contained inside holes of the polygon
  21. // flags string of options pass to triangle (see triangle documentation)
  22. // Outputs:
  23. // V2 #V2 by 2 coordinates of the vertives of the generated triangulation
  24. // F2 #F2 by 3 list of indices forming the faces of the generated triangulation
  25. //
  26. // TODO: expose the option to prevent Steiner points on the boundary
  27. //
  28. IGL_INLINE void triangulate(
  29. const Eigen::MatrixXd& V,
  30. const Eigen::MatrixXi& E,
  31. const Eigen::MatrixXd& H,
  32. const std::string flags,
  33. Eigen::MatrixXd& V2,
  34. Eigen::MatrixXi& F2);
  35. }
  36. #ifndef IGL_STATIC_LIBRARY
  37. # include "triangulate.cpp"
  38. #endif
  39. #endif