triangulate.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. }
  38. }
  39. #ifndef IGL_STATIC_LIBRARY
  40. # include "triangulate.cpp"
  41. #endif
  42. #endif