PointCloudLibrary / PointCloudLibrary/pcl
[VoxelGrid] Remove getLeafLayout
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 4.7k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 6
Description
Is your feature request related to a problem? Please describe.
Raised while refactoring VoxelGrid https://github.com/PointCloudLibrary/pcl/pull/4829#pullrequestreview-698580970
As we are upgrading point hash datatype from int to size_t, the API std::vector<int> getLeafLayout() is not compatible anymore
Context
Reasons to upgrade to size_t: https://github.com/PointCloudLibrary/pcl/issues/4365 https://github.com/PointCloudLibrary/pcl/issues/585
Expected behavior
Users can query the voxel index using point coordinate or point hash
Current Behavior
We can query the voxel index using point coordinate with int getCentroidIndexAt(const Eigen::Vector3i&).
But if we wanted to query using point hash, we will need to first get a large vector with std::vector<int> getLeafLayout(), and query with the vector
Describe the solution you'd like
Use the following functions to replace getLeafLayout() to avoid return large vector when we upgrade to size_t.
leaf_layout_ will be a unordered_map
// int -> size_t
size_t getCentroidIndexAt(const Eigen::Vector3i& pt) { return leaf_layout_[hashPoint(pt)]; }
// new function
size_t getCentroidIndexAtLeafIdx(const size_t idx) { return leaf_layout_[idx]; }
Describe alternatives you've considered
Same as above, but leaf_layout_ is avector<size_t>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the VoxelGrid implementation and the refactoring context in pull request #4829, then review the linked issues #4365 and #585 for the size_t migration. Trace getLeafLayout(), getCentroidIndexAt(), leaf_layout_, and hashPoint() to determine the affected API and tests. Done means callers can query by point coordinate or leaf hash without the old large int vector.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100