24#ifdef DEAL_II_WITH_CGAL
26# include <CGAL/Boolean_set_operations_2.h>
34 template <
typename KernelType>
35 CGAL::Polygon_2<KernelType>
40 CGAL::Polygon_2<KernelType> polygon;
46 CGALWrappers::dealii_point_to_cgal_point<CGAL::Point_2<KernelType>,
49 CGALWrappers::dealii_point_to_cgal_point<CGAL::Point_2<KernelType>,
52 CGALWrappers::dealii_point_to_cgal_point<CGAL::Point_2<KernelType>,
58 CGALWrappers::dealii_point_to_cgal_point<CGAL::Point_2<KernelType>,
61 CGALWrappers::dealii_point_to_cgal_point<CGAL::Point_2<KernelType>,
64 CGALWrappers::dealii_point_to_cgal_point<CGAL::Point_2<KernelType>,
67 CGALWrappers::dealii_point_to_cgal_point<CGAL::Point_2<KernelType>,
79 template <
typename KernelType>
80 CGAL::Polygon_with_holes_2<KernelType>
89 CGAL::Polygon_2<KernelType> outer_boundary;
90 std::vector<CGAL::Polygon_2<KernelType>> holes;
91 holes.reserve(boundaries.size() - 1);
93 for (
const auto &boundary : boundaries)
96 CGAL::Polygon_2<KernelType> current_polygon;
97 for (
const auto &vertices : boundary)
99 current_polygon.push_back(
100 dealii_point_to_cgal_point<CGAL::Point_2<KernelType>, 2>(
104 if (current_polygon.is_counterclockwise_oriented())
106 outer_boundary = current_polygon;
110 holes.push_back(current_polygon);
113 return CGAL::Polygon_with_holes_2<KernelType>(outer_boundary,
119 template <
typename KernelType>
120 CGAL::Polygon_with_holes_2<KernelType>
122 const CGAL::Polygon_2<KernelType> &boundary_outside,
123 const std::vector<CGAL::Polygon_2<KernelType>> &boundary_holes)
125 return CGAL::Polygon_with_holes_2<KernelType>(boundary_outside,
126 boundary_holes.begin(),
127 boundary_holes.end());
132 template <
typename KernelType>
133 std::vector<CGAL::Polygon_with_holes_2<KernelType>>
135 const CGAL::Polygon_with_holes_2<KernelType> &polygon_1,
136 const CGAL::Polygon_with_holes_2<KernelType> &polygon_2,
140 ExcMessage(
"Corefinement has no usecase for 2D polygons"));
142 std::vector<CGAL::Polygon_with_holes_2<KernelType>> polygon_out;
146 CGAL::intersection(polygon_1,
148 std::back_inserter(polygon_out));
152 CGAL::difference(polygon_1, polygon_2, std::back_inserter(polygon_out));
156 polygon_out.resize(1);
157 CGAL::join(polygon_1, polygon_2, polygon_out[0]);
170# include "cgal/polygon.inst"
virtual boost::container::small_vector< Point< spacedim >, ReferenceCells::max_n_vertices< dim >() > get_vertices(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
ReferenceCell reference_cell() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ASSERT_UNREACHABLE()
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
TriaIterator< CellAccessor< dim, spacedim > > cell_iterator
MappingQ< dim, spacedim > StaticMappingQ1< dim, spacedim >::mapping
std::vector< CGAL::Polygon_with_holes_2< KernelType > > compute_boolean_operation(const CGAL::Polygon_with_holes_2< KernelType > &polygon_1, const CGAL::Polygon_with_holes_2< KernelType > &polygon_2, const BooleanOperation &boolean_operation)
CGAL::Polygon_2< KernelType > dealii_cell_to_cgal_polygon(const typename Triangulation< 2, 2 >::cell_iterator &cell, const Mapping< 2, 2 > &mapping)
CGAL::Polygon_with_holes_2< KernelType > dealii_tria_to_cgal_polygon(const Triangulation< 2, 2 > &tria, const Mapping< 2, 2 > &mapping)
CGAL::Polygon_with_holes_2< KernelType > polygon_to_polygon_with_holes(const CGAL::Polygon_2< KernelType > &boundary_outside, const std::vector< CGAL::Polygon_2< KernelType > > &boundary_holes={})
constexpr ReferenceCell Triangle
constexpr ReferenceCell Quadrilateral