insert_into_cdt.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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/Plane_3.h>
  12. #include <CGAL/Constrained_Delaunay_triangulation_2.h>
  13. #include <CGAL/Constrained_triangulation_plus_2.h>
  14. namespace igl
  15. {
  16. namespace copyleft
  17. {
  18. namespace cgal
  19. {
  20. // Given a current 2D constrained Delaunay triangulation (cdt), insert a
  21. // 3D "object" (e.g., resulting from intersecting two triangles) into the
  22. // cdt, by projecting it via the given plane (P) and adding appropriate
  23. // constraints.
  24. //
  25. // Inputs:
  26. // 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. // P plane obj lies on and upon which the cdt is being performed
  31. // cdt current CDT, see output
  32. // Outputs:
  33. // cdt CDT updated to contain constraints for the given object
  34. //
  35. template <typename Kernel>
  36. IGL_INLINE void insert_into_cdt(
  37. const CGAL::Object & obj,
  38. const CGAL::Plane_3<Kernel> & P,
  39. CGAL::Constrained_triangulation_plus_2<
  40. CGAL::Constrained_Delaunay_triangulation_2<
  41. Kernel,
  42. CGAL::Triangulation_data_structure_2<
  43. CGAL::Triangulation_vertex_base_2<Kernel>,
  44. CGAL::Constrained_triangulation_face_base_2< Kernel>
  45. >,
  46. CGAL::Exact_intersections_tag
  47. >
  48. >
  49. & cdt);
  50. }
  51. }
  52. }
  53. #ifndef IGL_STATIC_LIBRARY
  54. # include "insert_into_cdt.cpp"
  55. #endif
  56. #endif