@@ -11,7 +11,7 @@ namespace detail {
11
11
template <typename MapT, typename ShapeT>
12
12
void cropLeavesBatch (typename MapT::Block::OctreeType::NodeRefType node,
13
13
const OctreeIndex& node_index, FloatingPoint& node_value,
14
- ShapeT&& shape , FloatingPoint min_cell_width) {
14
+ ShapeT&& mask , FloatingPoint min_cell_width) {
15
15
// Decompress child values
16
16
using Transform = typename MapT::Block::Transform;
17
17
auto & node_details = node.data ();
@@ -23,7 +23,7 @@ void cropLeavesBatch(typename MapT::Block::OctreeType::NodeRefType node,
23
23
const OctreeIndex child_index = node_index.computeChildIndex (child_idx);
24
24
const Point3D t_W_child =
25
25
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 )) {
27
27
child_values[child_idx] = 0 .f ;
28
28
if (0 < child_index.height ) {
29
29
node.eraseChild (child_idx);
@@ -41,7 +41,7 @@ void cropLeavesBatch(typename MapT::Block::OctreeType::NodeRefType node,
41
41
template <typename MapT, typename ShapeT>
42
42
void cropNodeRecursive (typename MapT::Block::OctreeType::NodeRefType node,
43
43
const OctreeIndex& node_index, FloatingPoint& node_value,
44
- ShapeT&& shape , FloatingPoint min_cell_width,
44
+ ShapeT&& mask , FloatingPoint min_cell_width,
45
45
IndexElement termination_height) {
46
46
using NodeRefType = decltype (node);
47
47
@@ -57,13 +57,13 @@ void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
57
57
const OctreeIndex child_index = node_index.computeChildIndex (child_idx);
58
58
const AABB<Point3D> child_aabb =
59
59
convert::nodeIndexToAABB (child_index, min_cell_width);
60
- if (shape::is_inside (child_aabb, shape )) {
60
+ if (shape::is_inside (child_aabb, mask )) {
61
61
continue ;
62
62
}
63
63
64
64
// If the node is fully outside the cropping shape, set it to zero
65
65
auto & child_value = child_values[child_idx];
66
- if (!shape::overlaps (child_aabb, shape )) {
66
+ if (!shape::overlaps (child_aabb, mask )) {
67
67
child_value = 0 .f ;
68
68
node.eraseChild (child_idx);
69
69
continue ;
@@ -72,10 +72,10 @@ void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
72
72
// Otherwise, continue at a higher resolution
73
73
NodeRefType child_node = node.getOrAllocateChild (child_idx);
74
74
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 ,
76
76
min_cell_width);
77
77
} else {
78
- cropNodeRecursive<MapT>(child_node, child_index, child_value, shape ,
78
+ cropNodeRecursive<MapT>(child_node, child_index, child_value, mask ,
79
79
min_cell_width, termination_height);
80
80
}
81
81
}
@@ -88,7 +88,7 @@ void cropNodeRecursive(typename MapT::Block::OctreeType::NodeRefType node,
88
88
} // namespace detail
89
89
90
90
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,
92
92
const std::shared_ptr<ThreadPool>& thread_pool) {
93
93
using NodePtrType = typename MapT::Block::OctreeType::NodePtrType;
94
94
const IndexElement tree_height = map.getTreeHeight ();
@@ -102,12 +102,12 @@ void crop(MapT& map, ShapeT shape, IndexElement termination_height,
102
102
const auto block_aabb =
103
103
convert::nodeIndexToAABB (block_node_index, min_cell_width);
104
104
// 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 )) {
106
106
++it;
107
107
continue ;
108
108
}
109
109
// 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 )) {
111
111
it = map.getHashMap ().erase (it);
112
112
continue ;
113
113
}
@@ -123,16 +123,16 @@ void crop(MapT& map, ShapeT shape, IndexElement termination_height,
123
123
NodePtrType root_node_ptr = &block.getRootNode ();
124
124
// Recursively crop all nodes
125
125
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,
127
127
root_value_ptr, min_cell_width,
128
128
termination_height]() {
129
129
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,
131
131
termination_height);
132
132
});
133
133
} else {
134
134
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,
136
136
termination_height);
137
137
}
138
138
// Advance to the next block
0 commit comments