15#ifndef dealii_cgal_point_conversion_h
16#define dealii_cgal_point_conversion_h
22#ifdef DEAL_II_WITH_CGAL
24# include <CGAL/Cartesian.h>
25# include <CGAL/Exact_predicates_exact_constructions_kernel.h>
26# include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
27# include <CGAL/Simple_cartesian.h>
41 template <
typename CGALPo
intType,
int dim>
43 dealii_point_to_cgal_point(const ::Point<dim> &p);
53 template <
int dim,
typename CGALPo
intType>
55 cgal_point_to_dealii_point(
const CGALPointType &p);
61 template <
typename CGALPo
intType,
int dim>
63 dealii_point_to_cgal_point(const ::Point<dim> &p)
65 constexpr int cdim = CGALPointType::Ambient_dimension::value;
66 static_assert(dim <= cdim,
"Only dim <= cdim supported");
67 if constexpr (cdim == 1)
68 return CGALPointType(p[0]);
69 else if constexpr (cdim == 2)
70 return CGALPointType(p[0], dim > 1 ? p[1] : 0);
71 else if constexpr (cdim == 3)
72 return CGALPointType(p[0], dim > 1 ? p[1] : 0, dim > 2 ? p[2] : 0);
75 return CGALPointType();
80 template <
int dim,
typename CGALPo
intType>
82 cgal_point_to_dealii_point(
const CGALPointType &p)
84 constexpr int cdim = CGALPointType::Ambient_dimension::value;
85 if constexpr (dim == 1)
86 return ::Point<dim>(CGAL::to_double(p.x()));
87 else if constexpr (dim == 2)
88 return ::Point<dim>(CGAL::to_double(p.x()),
89 cdim > 1 ? CGAL::to_double(p.y()) : 0);
90 else if constexpr (dim == 3)
91 return ::Point<dim>(CGAL::to_double(p.x()),
92 cdim > 1 ? CGAL::to_double(p.y()) : 0,
93 cdim > 2 ? CGAL::to_double(p.z()) : 0);
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NOT_IMPLEMENTED()