16#ifndef dealii_cgal_point_conversion_h
17#define dealii_cgal_point_conversion_h
23#ifdef DEAL_II_WITH_CGAL
25# include <CGAL/Cartesian.h>
26# include <CGAL/Exact_predicates_exact_constructions_kernel.h>
27# include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
28# include <CGAL/Simple_cartesian.h>
42 template <
typename CGALPo
intType,
int dim>
44 dealii_point_to_cgal_point(const ::Point<dim> &p);
54 template <
int dim,
typename CGALPo
intType>
56 cgal_point_to_dealii_point(
const CGALPointType &p);
62 template <
typename CGALPo
intType,
int dim>
64 dealii_point_to_cgal_point(const ::Point<dim> &p)
66 constexpr int cdim = CGALPointType::Ambient_dimension::value;
67 static_assert(dim <= cdim,
"Only dim <= cdim supported");
68 if constexpr (cdim == 1)
69 return CGALPointType(p[0]);
70 else if constexpr (cdim == 2)
71 return CGALPointType(p[0], dim > 1 ? p[1] : 0);
72 else if constexpr (cdim == 3)
73 return CGALPointType(p[0], dim > 1 ? p[1] : 0, dim > 2 ? p[2] : 0);
76 return CGALPointType();
81 template <
int dim,
typename CGALPo
intType>
83 cgal_point_to_dealii_point(
const CGALPointType &p)
85 constexpr int cdim = CGALPointType::Ambient_dimension::value;
86 if constexpr (dim == 1)
87 return ::Point<dim>(CGAL::to_double(p.x()));
88 else if constexpr (dim == 2)
89 return ::Point<dim>(CGAL::to_double(p.x()),
90 cdim > 1 ? CGAL::to_double(p.y()) : 0);
91 else if constexpr (dim == 3)
92 return ::Point<dim>(CGAL::to_double(p.x()),
93 cdim > 1 ? CGAL::to_double(p.y()) : 0,
94 cdim > 2 ? CGAL::to_double(p.z()) : 0);
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)