Skip to content

Commit 345f198

Browse files
Update crop method argument names to be consistent with sum
1 parent c19f5bb commit 345f198

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

library/cpp/include/wavemap/core/utils/edit/crop.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ namespace detail {
1212
template <typename MapT, typename ShapeT>
1313
void cropLeavesBatch(typename MapT::Block::OctreeType::NodeRefType node,
1414
const OctreeIndex& node_index, FloatingPoint& node_value,
15-
ShapeT&& shape, FloatingPoint min_cell_width);
15+
ShapeT&& mask, FloatingPoint min_cell_width);
1616

1717
template <typename MapT, typename ShapeT>
1818
void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
1919
const OctreeIndex& node_index, FloatingPoint& node_value,
20-
ShapeT&& shape, FloatingPoint min_cell_width,
20+
ShapeT&& mask, FloatingPoint min_cell_width,
2121
IndexElement termination_height = 0);
2222
} // namespace detail
2323

2424
template <typename MapT, typename ShapeT>
25-
void crop(MapT& map, ShapeT shape, IndexElement termination_height = 0,
25+
void crop(MapT& map, ShapeT mask, IndexElement termination_height = 0,
2626
const std::shared_ptr<ThreadPool>& thread_pool = nullptr);
2727
} // namespace wavemap::edit
2828

library/cpp/include/wavemap/core/utils/edit/impl/crop_inl.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace detail {
1111
template <typename MapT, typename ShapeT>
1212
void cropLeavesBatch(typename MapT::Block::OctreeType::NodeRefType node,
1313
const OctreeIndex& node_index, FloatingPoint& node_value,
14-
ShapeT&& shape, FloatingPoint min_cell_width) {
14+
ShapeT&& mask, FloatingPoint min_cell_width) {
1515
// Decompress child values
1616
using Transform = typename MapT::Block::Transform;
1717
auto& node_details = node.data();
@@ -23,7 +23,7 @@ void cropLeavesBatch(typename MapT::Block::OctreeType::NodeRefType node,
2323
const OctreeIndex child_index = node_index.computeChildIndex(child_idx);
2424
const Point3D t_W_child =
2525
convert::nodeIndexToCenterPoint(child_index, min_cell_width);
26-
if (!shape::is_inside(t_W_child, shape)) {
26+
if (!shape::is_inside(t_W_child, mask)) {
2727
child_values[child_idx] = 0.f;
2828
if (0 < child_index.height) {
2929
node.eraseChild(child_idx);
@@ -41,7 +41,7 @@ void cropLeavesBatch(typename MapT::Block::OctreeType::NodeRefType node,
4141
template <typename MapT, typename ShapeT>
4242
void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
4343
const OctreeIndex& node_index, FloatingPoint& node_value,
44-
ShapeT&& shape, FloatingPoint min_cell_width,
44+
ShapeT&& mask, FloatingPoint min_cell_width,
4545
IndexElement termination_height) {
4646
using NodeRefType = decltype(node);
4747

@@ -57,13 +57,13 @@ void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
5757
const OctreeIndex child_index = node_index.computeChildIndex(child_idx);
5858
const AABB<Point3D> child_aabb =
5959
convert::nodeIndexToAABB(child_index, min_cell_width);
60-
if (shape::is_inside(child_aabb, shape)) {
60+
if (shape::is_inside(child_aabb, mask)) {
6161
continue;
6262
}
6363

6464
// If the node is fully outside the cropping shape, set it to zero
6565
auto& child_value = child_values[child_idx];
66-
if (!shape::overlaps(child_aabb, shape)) {
66+
if (!shape::overlaps(child_aabb, mask)) {
6767
child_value = 0.f;
6868
node.eraseChild(child_idx);
6969
continue;
@@ -72,10 +72,10 @@ void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
7272
// Otherwise, continue at a higher resolution
7373
NodeRefType child_node = node.getOrAllocateChild(child_idx);
7474
if (child_index.height <= termination_height + 1) {
75-
cropLeavesBatch<MapT>(child_node, child_index, child_value, shape,
75+
cropLeavesBatch<MapT>(child_node, child_index, child_value, mask,
7676
min_cell_width);
7777
} else {
78-
cropNodeRecursive<MapT>(child_node, child_index, child_value, shape,
78+
cropNodeRecursive<MapT>(child_node, child_index, child_value, mask,
7979
min_cell_width, termination_height);
8080
}
8181
}
@@ -88,7 +88,7 @@ void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
8888
} // namespace detail
8989

9090
template <typename MapT, typename ShapeT>
91-
void crop(MapT& map, ShapeT shape, IndexElement termination_height,
91+
void crop(MapT& map, ShapeT mask, IndexElement termination_height,
9292
const std::shared_ptr<ThreadPool>& thread_pool) {
9393
using NodePtrType = typename MapT::Block::OctreeType::NodePtrType;
9494
const IndexElement tree_height = map.getTreeHeight();
@@ -102,12 +102,12 @@ void crop(MapT& map, ShapeT shape, IndexElement termination_height,
102102
const auto block_aabb =
103103
convert::nodeIndexToAABB(block_node_index, min_cell_width);
104104
// If the block is fully inside the cropping shape, do nothing
105-
if (shape::is_inside(block_aabb, shape)) {
105+
if (shape::is_inside(block_aabb, mask)) {
106106
++it;
107107
continue;
108108
}
109109
// If the block is fully outside the cropping shape, erase it entirely
110-
if (!shape::overlaps(block_aabb, shape)) {
110+
if (!shape::overlaps(block_aabb, mask)) {
111111
it = map.getHashMap().erase(it);
112112
continue;
113113
}
@@ -123,16 +123,16 @@ void crop(MapT& map, ShapeT shape, IndexElement termination_height,
123123
NodePtrType root_node_ptr = &block.getRootNode();
124124
// Recursively crop all nodes
125125
if (thread_pool) {
126-
thread_pool->add_task([&shape, root_node_ptr, block_node_index,
126+
thread_pool->add_task([&mask, root_node_ptr, block_node_index,
127127
root_value_ptr, min_cell_width,
128128
termination_height]() {
129129
detail::cropNodeRecursive<MapT>(*root_node_ptr, block_node_index,
130-
*root_value_ptr, shape, min_cell_width,
130+
*root_value_ptr, mask, min_cell_width,
131131
termination_height);
132132
});
133133
} else {
134134
detail::cropNodeRecursive<MapT>(*root_node_ptr, block_node_index,
135-
*root_value_ptr, shape, min_cell_width,
135+
*root_value_ptr, mask, min_cell_width,
136136
termination_height);
137137
}
138138
// Advance to the next block

0 commit comments

Comments
 (0)