38 #ifndef PCL_COMMON_IMPL_DETAIL_ACCUMULATORS_HPP
39 #define PCL_COMMON_IMPL_DETAIL_ACCUMULATORS_HPP
43 #include <boost/mpl/filter_view.hpp>
44 #include <boost/fusion/include/mpl.hpp>
45 #include <boost/fusion/include/for_each.hpp>
46 #include <boost/fusion/include/as_vector.hpp>
47 #include <boost/fusion/include/filter_if.hpp>
74 Eigen::Vector3f
xyz = Eigen::Vector3f::Zero ();
76 template <
typename Po
intT>
void
79 template <
typename Po
intT>
void
80 get (
PointT& t, std::size_t n)
const { t.getVector3fMap () =
xyz / n; }
93 Eigen::Vector4f
normal = Eigen::Vector4f::Zero ();
97 template <
typename Po
intT>
void
100 template <
typename Po
intT>
void
103 #if EIGEN_VERSION_AT_LEAST (3, 3, 0)
104 t.getNormalVector4fMap () =
normal.normalized ();
106 if (
normal.squaredNorm() > 0)
107 t.getNormalVector4fMap () =
normal.normalized ();
109 t.getNormalVector4fMap () = Eigen::Vector4f::Zero ();
126 template <
typename Po
intT>
void
129 template <
typename Po
intT>
void
141 float r = 0,
g = 0,
b = 0,
a = 0;
143 template <
typename Po
intT>
void
146 r += static_cast<float> (t.r);
147 g += static_cast<float> (t.g);
148 b += static_cast<float> (t.b);
149 a += static_cast<float> (t.a);
152 template <
typename Po
intT>
void
155 t.rgba = static_cast<std::uint32_t> (
a / n) << 24 |
156 static_cast<std::uint32_t> (
r / n) << 16 |
157 static_cast<std::uint32_t> (
g / n) << 8 |
158 static_cast<std::uint32_t> (
b / n);
172 template <
typename Po
intT>
void
175 template <
typename Po
intT>
void
188 std::map<std::uint32_t, std::size_t>
labels;
190 template <
typename Po
intT>
void
193 auto itr =
labels.find (t.label);
195 labels.insert (std::make_pair (t.label, 1));
200 template <
typename Po
intT>
void
204 for (
const auto &label :
labels)
205 if (label.second > max)
208 t.label = label.first;
216 template <
typename Po
int1T,
typename Po
int2T = Po
int1T>
219 template <
typename AccumulatorT>
221 boost::mpl::apply<typename AccumulatorT::IsCompatible, Point1T>,
222 boost::mpl::apply<typename AccumulatorT::IsCompatible, Point2T>
228 template <
typename Po
intT>
232 typename boost::fusion::result_of::as_vector<
233 typename boost::mpl::filter_view<
249 template <
typename Po
intT>
257 template <
typename AccumulatorT>
void
267 template <
typename Po
intT>
276 template <
typename AccumulatorT>
void
279 accumulator.get (
p,
n);