5 #include <boost/preprocessor/seq/for_each.hpp>
7 #include <pcl/point_cloud.h>
8 #include <pcl/point_types.h>
10 #pragma GCC diagnostic push
11 #pragma GCC diagnostic ignored "-Wpedantic"
12 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
13 #include <CGAL/Polyhedron_3.h>
14 #pragma GCC diagnostic pop
22 #define _detail_unpack(r, data, elem) , elem
24 static constexpr
bool is_pcl_point_type_v = is_any_of_v<
T BOOST_PP_SEQ_FOR_EACH(
_detail_unpack,, PCL_XYZ_POINT_TYPES)>;
27 template<
class T,
class =
void>
39 template<
class T,
class =
void>
45 static const auto&
x(
const T&
v)
49 static const auto&
y(
const T&
v)
53 static const auto&
z(
const T&
v)
62 static const auto&
x(
const T&
v)
66 static const auto&
y(
const T&
v)
70 static const auto&
z(
const T&
v)
79 using T = CGAL::Epick::Point_3;
80 static const auto&
x(
const T&
v)
84 static const auto&
y(
const T&
v)
88 static const auto&
z(
const T&
v)
97 static_assert(is_point_type_v<pcl::PointXYZ>);
98 static_assert(is_point_type_v<Eigen::Vector3f>);
99 static_assert(is_point_type_v<Eigen::Vector3i>);
100 static_assert(is_point_type_v<Eigen::RowVector3cd>);
101 static_assert(is_point_type_v<CGAL::Epick::Point_3>);
108 #include <forward_list>
110 #include <unordered_set>
113 #define _detail_containerlist std::vector, std::deque, std::list, std::forward_list, std::set, std::unordered_set
114 static_assert(!TypeTemplateTraits::IsInstanceOfAnyV<int, _detail_containerlist>);
117 template<
class T,
class =
void>
121 struct container_traits<
T,
std::enable_if_t<TypeTemplateTraits::IsInstanceOfAnyV<T, _detail_containerlist>>> : std::true_type
153 #undef _detail_containerlist
155 template<
class PType>
158 using T = pcl::PointCloud<PType>;
162 return t.points.begin();
166 return t.points.begin();
171 return t.points.end();
175 return t.points.end();
185 return t.points.size();
196 static_assert(meta::is_container_type_v<std::vector<Eigen::Vector3f>>);
197 static_assert(meta::is_container_type_v<std::vector<Eigen::Vector3d>>);
198 static_assert(meta::is_container_type_v<std::vector<Eigen::RowVector3cd>>);
199 static_assert(meta::is_container_type_v<pcl::PointCloud<pcl::PointXYZ>>);
201 template<
class T,
class =
void>
213 struct VisitPointLike <
T,
std::enable_if_t < meta::is_container_type_v<T>&& meta::is_point_type_v<typename meta::container_traits<T>::element_t >>> : std::true_type
215 template<
class F,
class F2>
216 static void visit(
const T&
c,
F& sizeinfo, F2& perElem)
220 sizeinfo(ctr::size(
c));
221 auto f = ctr::begin(
c);
222 auto l = ctr::end(
c);
225 auto&& p = ctr::deref(f);
226 perElem(tr::x(p), tr::y(p), tr::z(p));
232 struct VisitPointLike<
T,
std::enable_if_t<VisitPointLike<meta::pointer_type_pointee_t<T>>::value>> : std::true_type
234 template<
class F,
class F2>
235 static void visit(
const T&
c,
F& sizeinfo, F2& perElem)
245 template<
class F,
class F2>
248 sizeinfo(
c.size_of_vertices());
249 for (
auto v =
c.vertices_begin();
v !=
c.vertices_end(); ++
v)
251 perElem(
v->point().x(),
v->point().y(),
v->point().z());