40 #include <pcl/filters/filter.h>
45 template <
typename Po
intT>
48 using Pod =
typename traits::POD<PointT>::type;
52 p2_ (reinterpret_cast<
Pod&>(p2))
58 using T =
typename pcl::traits::datatype<PointT, Key>::type;
59 std::uint8_t* data_ptr =
reinterpret_cast<std::uint8_t*
>(&p2_) + pcl::traits::offset<PointT, Key>::value;
60 *
reinterpret_cast<T*
>(data_ptr) =
static_cast<T
> (p1_[f_idx_++]);
64 const Eigen::VectorXf &p1_;
70 template <
typename Po
intT>
73 using Pod =
typename traits::POD<PointT>::type;
76 : p1_ (reinterpret_cast<const
Pod&>(p1)), p2_ (p2) { }
81 using T =
typename pcl::traits::datatype<PointT, Key>::type;
82 const std::uint8_t* data_ptr =
reinterpret_cast<const std::uint8_t*
>(&p1_) + pcl::traits::offset<PointT, Key>::value;
83 p2_[f_idx_++] =
static_cast<float> (*
reinterpret_cast<const T*
>(data_ptr));
99 template <
typename Po
intT>
115 int ix{0}, iy{0}, iz{0};
117 Eigen::VectorXf centroid;
122 using Ptr = shared_ptr<ApproximateVoxelGrid<PointT> >;
123 using ConstPtr = shared_ptr<const ApproximateVoxelGrid<PointT> >;
149 for (std::size_t i = 0; i <
histsize_; i++)
173 for (std::size_t i = 0; i <
histsize_; i++)
200 inline Eigen::Vector3f
231 using FieldList =
typename pcl::traits::fieldList<PointT>::type;
242 flush (
PointCloud &output, std::size_t op, he *hhe,
int rgba_index,
int centroid_size);
246 #ifdef PCL_NO_PRECOMPILE
247 #include <pcl/filters/impl/approximate_voxel_grid.hpp>
ApproximateVoxelGrid assembles a local 3D grid over a given PointCloud, and downsamples + filters the...
bool downsample_all_data_
Set to true if all fields need to be downsampled, or false if just XYZ.
Eigen::Array3f inverse_leaf_size_
Compute 1/leaf_size_ to avoid division later.
shared_ptr< ApproximateVoxelGrid< PointT > > Ptr
typename pcl::traits::fieldList< PointT >::type FieldList
std::size_t histsize_
history buffer size, power of 2
ApproximateVoxelGrid()
Empty constructor.
void applyFilter(PointCloud &output) override
Downsample a Point Cloud using a voxelized grid approach.
Eigen::Vector3f leaf_size_
The size of a leaf.
struct he * history_
history buffer
~ApproximateVoxelGrid() override
Destructor.
void setLeafSize(float lx, float ly, float lz)
Set the voxel grid leaf size.
ApproximateVoxelGrid & operator=(const ApproximateVoxelGrid &src)
Copy operator.
ApproximateVoxelGrid(const ApproximateVoxelGrid &src)
Copy constructor.
void setDownsampleAllData(bool downsample)
Set to true if all fields need to be downsampled, or false if just XYZ.
void flush(PointCloud &output, std::size_t op, he *hhe, int rgba_index, int centroid_size)
Write a single point from the hash to the output cloud.
bool getDownsampleAllData() const
Get the state of the internal downsampling parameter (true if all fields need to be downsampled,...
void setLeafSize(const Eigen::Vector3f &leaf_size)
Set the voxel grid leaf size.
Eigen::Vector3f getLeafSize() const
Get the voxel grid leaf size.
shared_ptr< const ApproximateVoxelGrid< PointT > > ConstPtr
Filter represents the base filter class.
std::string filter_name_
The filter name.
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.
Helper functor structure for copying data between an Eigen::VectorXf and a PointT.
typename traits::POD< PointT >::type Pod
xNdCopyEigenPointFunctor(const Eigen::VectorXf &p1, PointT &p2)
Helper functor structure for copying data between an Eigen::VectorXf and a PointT.
xNdCopyPointEigenFunctor(const PointT &p1, Eigen::VectorXf &p2)
typename traits::POD< PointT >::type Pod