struct mp2p_icp_filters::PointCloudToVoxelGridSingle::voxel_t

Overview

The single point kept for a voxel.

The fields are stored bare, rather than wrapped in std::optional, since this struct is the value type of the hash map and is therefore touched once per input point: the optionals made it 56 bytes, which is what the per-point cost of this grid is dominated by. pointCount == 0 marks an empty voxel, so no separate “has value” flag is needed.

#include <PointCloudToVoxelGridSingle.h>

struct voxel_t
{
    // fields

    mrpt::math::TPoint3Df point = {0, 0, 0};
    uint32_t pointIdx = 0;
    uint32_t pointCount = 0;
    uint16_t sourceIdx = 0;
};

Fields

uint32_t pointIdx = 0

Index of point within the source cloud.

uint32_t pointCount = 0

Even if we keep the first point only, count them all. Zero means the voxel holds no point yet.

uint16_t sourceIdx = 0

Which of the clouds passed to processPointCloud() pointIdx refers to; resolve it with sourceCloud().