insert_into_cdt.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Alec Jacobson
  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_COPYLEFT_CGAL_INSERT_INTO_CDT_H
  9. #define IGL_COPYLEFT_CGAL_INSERT_INTO_CDT_H
  10. #include "../../igl_inline.h"
  11. #include <CGAL/double.h> // Workaround https://github.com/CGAL/cgal/issues/2182 with CGAL 4.10-1
  12. #include <CGAL/Plane_3.h>
  13. #include <CGAL/Constrained_Delaunay_triangulation_2.h>
  14. #include <CGAL/Constrained_triangulation_plus_2.h>
  15. namespace igl
  16. {
  17. namespace copyleft
  18. {
  19. namespace cgal
  20. {
  21. /// Given a current 2D constrained Delaunay triangulation (cdt), insert a
  22. /// 3D "object" (e.g., resulting from intersecting two triangles) into the
  23. /// cdt, by projecting it via the given plane (P) and adding appropriate
  24. /// constraints.
  25. ///
  26. /// @param[in] obj CGAL::Object representing a vertex, segment, or (convex)
  27. /// polygon. All vertices should lie on the plane P. If not, then this
  28. /// adds the _projection_ of this object to the cdt and that might not
  29. /// be what you wanted to do.
  30. /// @param[in] P plane obj lies on and upon which the cdt is being performed
  31. /// @param[in] cdt current CDT, see output
  32. /// @param[out] cdt CDT updated to contain constraints for the given object
  33. ///
  34. template <typename Kernel>
  35. IGL_INLINE void insert_into_cdt(
  36. const CGAL::Object & obj,
  37. const CGAL::Plane_3<Kernel> & P,
  38. CGAL::Constrained_triangulation_plus_2<
  39. CGAL::Constrained_Delaunay_triangulation_2<
  40. Kernel,
  41. CGAL::Triangulation_data_structure_2<
  42. CGAL::Triangulation_vertex_base_2<Kernel>,
  43. CGAL::Constrained_triangulation_face_base_2< Kernel>
  44. >,
  45. CGAL::Exact_intersections_tag
  46. >
  47. >
  48. & cdt);
  49. }
  50. }
  51. }
  52. #ifndef IGL_STATIC_LIBRARY
  53. # include "insert_into_cdt.cpp"
  54. #endif
  55. #endif