-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
None
A few improvements to modernize some of the existing point methods.
Specifically:
1) There's a common convention in the core library that many free functions take a "threaded" parameter to allow for quickly enabling/disabling threading, which defaults to true.
2) It would be good to switch to LeafManager::foreach() and LeafManager::reduce() where possible as this simplifies the implementation and makes #1 possible with less code.
3) Switching to lambdas instead of using a separate struct in very simple cases generates fewer lines and more readable code.
Here's an example of the implementation of all three improvements with an existing method from points/PointAttribute.h:
template <typename PointDataTreeT> inline void compactAttributes(PointDataTreeT& tree, bool threaded = true) { tree::LeafManager<PointDataTreeT> leafManager(tree); leafManager.foreach( [&](typename PointDataTree::LeafNodeType& leaf, size_t /*idx*/) { leaf.compactAttributes(); }, threaded); }