cdt.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef IGL_TRIANGLE_CDT_H
  2. #define IGL_TRIANGLE_CDT_H
  3. #include "../igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. namespace triangle
  8. {
  9. // CDT Construct the constrained delaunay triangulation of the convex hull
  10. // of a given set of points and segments in 2D. This differs from a direct
  11. // call to triangulate because it will preprocess the input to remove
  12. // duplicates and return an adjusted segment list on the output.
  13. //
  14. //
  15. // BACKGROUND_MESH Construct a background mesh for a (messy) texture mesh with
  16. // cosntraint edges that are about to deform.
  17. //
  18. // Inputs:
  19. // V #V by 2 list of texture mesh vertices
  20. // E #E by 2 list of constraint edge indices into V
  21. // flags string of triangle flags should contain "-c" unless the
  22. // some subset of segments are known to enclose all other
  23. // points/segments.
  24. // Outputs:
  25. // WV #WV by 2 list of background mesh vertices
  26. // WF #WF by 2 list of background mesh triangle indices into WV
  27. // WE #WE by 2 list of constraint edge indices into WV (might be smaller
  28. // than E because degenerate constraints have been removed)
  29. // J #V list of indices into WF/WE for each vertex in V
  30. //
  31. template <
  32. typename DerivedV,
  33. typename DerivedE,
  34. typename DerivedWV,
  35. typename DerivedWF,
  36. typename DerivedWE,
  37. typename DerivedJ>
  38. IGL_INLINE void cdt(
  39. const Eigen::MatrixBase<DerivedV> & V,
  40. const Eigen::MatrixBase<DerivedE> & E,
  41. const std::string & flags,
  42. Eigen::PlainObjectBase<DerivedWV> & WV,
  43. Eigen::PlainObjectBase<DerivedWF> & WF,
  44. Eigen::PlainObjectBase<DerivedWE> & WE,
  45. Eigen::PlainObjectBase<DerivedJ> & J);
  46. }
  47. }
  48. #ifndef IGL_STATIC_LIBRARY
  49. #include "cdt.cpp"
  50. #endif
  51. #endif