GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestMerge.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 1821 1825 99.8%
Functions: 16 16 100.0%
Branches: 2253 11889 19.0%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include <openvdb/openvdb.h>
5 #include <openvdb/tools/Merge.h>
6
7 #include <gtest/gtest.h>
8
9
10 using namespace openvdb;
11
12 5 class TestMerge: public ::testing::Test
13 {
14 };
15
16 namespace
17 {
18
19 120 auto getTileCount = [](const auto& node) -> Index
20 {
21 Index sum = 0;
22
2/2
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 60 times.
344 for (auto iter = node.cbeginValueAll(); iter; ++iter) sum++;
23 120 return sum;
24 };
25
26 46 auto getActiveTileCount = [](const auto& node) -> Index
27 {
28 Index sum = 0;
29
3/3
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 20 times.
116 for (auto iter = node.cbeginValueOn(); iter; ++iter) sum++;
30 46 return sum;
31 };
32
33 22 auto getInactiveTileCount = [](const auto& node) -> Index
34 {
35 Index sum = 0;
36
2/2
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 22 times.
62 for (auto iter = node.cbeginValueOff(); iter; ++iter) sum++;
37 22 return sum;
38 };
39
40 30 auto getInsideTileCount = [](const auto& node) -> Index
41 {
42 using ValueT = typename std::remove_reference<decltype(node)>::type::ValueType;
43 Index sum = 0;
44
3/3
✓ Branch 0 taken 163834 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 10 times.
327738 for (auto iter = node.cbeginValueAll(); iter; ++iter) {
45
2/2
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 163837 times.
327688 if (iter.getValue() < zeroVal<ValueT>()) sum++;
46 }
47 30 return sum;
48 };
49
50 24 auto getOutsideTileCount = [](const auto& node) -> Index
51 {
52 using ValueT = typename std::remove_reference<decltype(node)>::type::ValueType;
53 Index sum = 0;
54
3/3
✓ Branch 0 taken 65533 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 10 times.
131130 for (auto iter = node.cbeginValueAll(); iter; ++iter) {
55
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 65535 times.
131086 if (iter.getValue() > zeroVal<ValueT>()) sum++;
56 }
57 24 return sum;
58 };
59
60 auto getChildCount = [](const auto& node) -> Index
61 {
62 29 return node.childCount();
63 };
64
65 8 auto hasOnlyInactiveNegativeBackgroundTiles = [](const auto& node) -> bool
66 {
67
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 if (getActiveTileCount(node) > Index(0)) return false;
68
2/2
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 8 times.
24 for (auto iter = node.cbeginValueAll(); iter; ++iter) {
69
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 if (iter.getValue() != -node.background()) return false;
70 }
71 8 return true;
72 };
73
74 } // namespace
75
76
77
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestMerge, testTreeToMerge)
78 {
79 using RootChildNode = FloatTree::RootNodeType::ChildNodeType;
80 using LeafNode = FloatTree::LeafNodeType;
81
82 { // non-const tree
83 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
84
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().touchLeaf(Coord(8));
85
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index(1), grid->tree().leafCount());
86
87 1 tools::TreeToMerge<FloatTree> treeToMerge{grid->tree(), Steal()};
88
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(&grid->constTree().root(), treeToMerge.rootPtr());
89
90 // probe root child
91
92
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 const RootChildNode* nodePtr = treeToMerge.probeConstNode<RootChildNode>(Coord(8));
93
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(nodePtr);
94
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(grid->constTree().probeConstNode<RootChildNode>(Coord(8)), nodePtr);
95
96 // probe leaf node
97
98
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 const LeafNode* leafNode = treeToMerge.probeConstNode<LeafNode>(Coord(8));
99
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(leafNode);
100
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(grid->constTree().probeConstLeaf(Coord(8)), leafNode);
101
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(1), grid->tree().leafCount());
102
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), grid->tree().root().childCount());
103
104 // steal leaf node
105
106
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 std::unique_ptr<LeafNode> leafNodePtr = treeToMerge.stealOrDeepCopyNode<LeafNode>(Coord(8));
107
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(leafNodePtr);
108
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(0), grid->tree().leafCount());
109
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(leafNodePtr->origin(), Coord(8));
110
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), grid->tree().root().childCount());
111
112 // steal root child
113
114
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().touchLeaf(Coord(8));
115
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 std::unique_ptr<RootChildNode> node2Ptr = treeToMerge.stealOrDeepCopyNode<RootChildNode>(Coord(8));
116
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(node2Ptr);
117
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().childCount());
118
119 // attempt to add leaf node tile (set value)
120
121
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().touchLeaf(Coord(8));
122
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(0), grid->tree().activeTileCount());
123 1 treeToMerge.addTile<LeafNode>(Coord(8), 1.6f, true);
124 // value has not been set
125
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(3.0f, grid->tree().probeConstLeaf(Coord(8))->getFirstValue());
126
127 // add root child tile
128
129
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 treeToMerge.addTile<RootChildNode>(Coord(8), 1.7f, true);
130
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(1), grid->tree().activeTileCount());
131
132 // tile in node that does not exist
133
134
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().clear();
135
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 treeToMerge.addTile<RootChildNode>(Coord(0), 1.8f, true);
136
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(0), grid->tree().activeTileCount());
137 }
138
139 { // const tree
140 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
141
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().touchLeaf(Coord(8));
142
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index(1), grid->tree().leafCount());
143
144
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 tools::TreeToMerge<FloatTree> treeToMerge{grid->constTree(), DeepCopy(), /*initialize=*/false};
145
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(!treeToMerge.hasMask());
146
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 treeToMerge.initializeMask();
147
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(treeToMerge.hasMask());
148
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(&grid->constTree().root(), treeToMerge.rootPtr());
149
150 // probe root child
151
152
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 const RootChildNode* nodePtr = treeToMerge.probeConstNode<RootChildNode>(Coord(8));
153
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(nodePtr);
154
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(grid->constTree().probeConstNode<RootChildNode>(Coord(8)), nodePtr);
155
156 // probe leaf node
157
158
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
1 const LeafNode* leafNode = treeToMerge.probeConstNode<LeafNode>(Coord(8));
159
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(leafNode);
160
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(grid->constTree().probeConstLeaf(Coord(8)), leafNode);
161
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(1), grid->tree().leafCount());
162
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), grid->tree().root().childCount());
163
164 { // deep copy leaf node
165
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 tools::TreeToMerge<FloatTree> treeToMerge2{grid->constTree(), DeepCopy()};
166
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 std::unique_ptr<LeafNode> leafNodePtr = treeToMerge2.stealOrDeepCopyNode<LeafNode>(Coord(8));
167
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(leafNodePtr);
168
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(1), grid->tree().leafCount()); // leaf has not been stolen
169
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(leafNodePtr->origin(), Coord(8));
170
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), grid->tree().root().childCount());
171 }
172
173 { // deep copy root child
174
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 tools::TreeToMerge<FloatTree> treeToMerge2{grid->constTree(), DeepCopy()};
175
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().touchLeaf(Coord(8));
176
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 std::unique_ptr<RootChildNode> node2Ptr = treeToMerge2.stealOrDeepCopyNode<RootChildNode>(Coord(8));
177
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(node2Ptr);
178
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), grid->tree().root().childCount());
179 }
180
181 { // add root child tile
182
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 tools::TreeToMerge<FloatTree> treeToMerge2{grid->constTree(), DeepCopy()};
183
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(treeToMerge2.probeConstNode<RootChildNode>(Coord(8)));
184
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 treeToMerge2.addTile<RootChildNode>(Coord(8), 1.7f, true);
185
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(!treeToMerge2.probeConstNode<RootChildNode>(Coord(8))); // tile has been added to mask
186
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(0), grid->tree().activeTileCount());
187 }
188
189 // tile in node that does not exist
190
191
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().clear();
192
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 treeToMerge.addTile<RootChildNode>(Coord(0), 1.8f, true);
193
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(0), grid->tree().activeTileCount());
194 }
195
196 { // non-const tree shared pointer
197 { // shared pointer constructor
198 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
199
0/2
✗ Branch 1 not taken.
✗ Branch 2 not taken.
1 grid->tree().touchLeaf(Coord(8));
200
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
2 tools::TreeToMerge<FloatTree> treeToMerge(grid->treePtr(), Steal());
201
202 // verify tree shared ownership
203
204
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(treeToMerge.treeToSteal());
205
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!treeToMerge.treeToDeepCopy());
206
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(treeToMerge.rootPtr());
207
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(treeToMerge.probeConstNode<FloatTree::LeafNodeType>(Coord(8)));
208 }
209
210 // empty tree
211 2 FloatTree tree;
212 1 tools::TreeToMerge<FloatTree> treeToMerge(tree, DeepCopy());
213
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!treeToMerge.treeToSteal());
214
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(treeToMerge.treeToDeepCopy());
215
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(treeToMerge.rootPtr());
216
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(!treeToMerge.probeConstNode<FloatTree::LeafNodeType>(Coord(8)));
217
218 {
219
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatTree::Ptr emptyPtr;
220
5/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
3 EXPECT_THROW(treeToMerge.reset(emptyPtr, Steal()), RuntimeError);
221
222
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
223
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().touchLeaf(Coord(8));
224
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(1), grid->tree().leafCount());
225
226
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 treeToMerge.reset(grid->treePtr(), Steal());
227 }
228
229 // verify tree shared ownership
230
231
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(treeToMerge.treeToSteal());
232
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!treeToMerge.treeToDeepCopy());
233
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(treeToMerge.rootPtr());
234
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(treeToMerge.probeConstNode<FloatTree::LeafNodeType>(Coord(8)));
235
236 // verify tree pointers are updated on reset()
237
238 2 const FloatTree tree2;
239
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 tools::TreeToMerge<FloatTree> treeToMerge2(tree2, DeepCopy());
240
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 treeToMerge2.initializeMask(); // no-op
241
242
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!treeToMerge2.treeToSteal());
243
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(treeToMerge2.treeToDeepCopy());
244
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(0), treeToMerge2.treeToDeepCopy()->leafCount());
245
246
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
247 1 grid->tree().touchLeaf(Coord(8));
248
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
2 treeToMerge2.reset(grid->treePtr(), Steal());
249
250
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(treeToMerge2.treeToSteal());
251
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!treeToMerge2.treeToDeepCopy());
252
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index(1), treeToMerge2.treeToSteal()->leafCount());
253 }
254 1 }
255
256
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestMerge, testCsgUnion)
257 {
258 using RootChildType = FloatTree::RootNodeType::ChildNodeType;
259 using LeafParentType = RootChildType::ChildNodeType;
260 using LeafT = FloatTree::LeafNodeType;
261
262 { // construction
263 2 FloatTree tree1;
264 2 FloatTree tree2;
265 2 const FloatTree tree3;
266
267 { // one non-const tree (steal)
268
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(tree1, Steal());
269
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
270 }
271 { // one non-const tree (deep-copy)
272
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(tree1, DeepCopy());
273
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
274 }
275 { // one const tree (deep-copy)
276
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(tree2, DeepCopy());
277
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
278 }
279 { // vector of tree pointers
280
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
281
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
282
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp.size());
283 }
284 { // deque of tree pointers
285
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::deque<FloatTree*> trees{&tree1, &tree2};
286
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, DeepCopy());
287
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp.size());
288 }
289 { // vector of TreesToMerge (to mix const and non-const trees)
290 1 std::vector<tools::TreeToMerge<FloatTree>> trees;
291
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 trees.emplace_back(tree1, Steal());
292
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 trees.emplace_back(tree3, DeepCopy()); // const tree
293
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 trees.emplace_back(tree2, Steal());
294 tools::CsgUnionOp<FloatTree> mergeOp(trees);
295
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(3), mergeOp.size());
296 }
297 { // implicit copy constructor
298
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
299
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
300 tools::CsgUnionOp<FloatTree> mergeOp2(mergeOp);
301
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp2.size());
302 }
303 { // implicit assignment operator
304
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
305
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
306 tools::CsgUnionOp<FloatTree> mergeOp2 = mergeOp;
307
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp2.size());
308 }
309 }
310
311 /////////////////////////////////////////////////////////////////////////
312
313 { // empty merge trees
314 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
315 auto& root = grid->tree().root();
316 std::vector<FloatTree*> trees;
317
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
318
319
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(0), mergeOp.size());
320
321 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
322
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
323
324
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
325 }
326
327 /////////////////////////////////////////////////////////////////////////
328
329 { // test one tile or one child
330
331 { // test one background tile
332 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
333
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
334
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
335
336
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
337
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
338 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
339
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
340
341
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
342 }
343
344 { // test one background tile
345 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
346
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
347
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
348
349
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
350
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
351 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
352
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
353
354
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
355 }
356
357 { // test one background tile
358 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
359
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
360
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
361
362
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
363
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
364 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
365
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
366
367 const auto& root = grid->tree().root();
368
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
369
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-grid->background(), grid->cbeginValueAll().getValue());
370 }
371
372 { // test one background tile
373 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
374
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
375
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
376
377
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
378
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
379 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
380
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
381
382 const auto& root = grid->tree().root();
383
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
384
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-grid->background(), grid->cbeginValueAll().getValue());
385 }
386
387 { // test one child node
388 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
389
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), false));
390
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
391
392
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
393
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
394 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
395
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
396
397 const auto& root = grid->tree().root();
398
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
399
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
400 }
401
402 { // test one child node
403 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
404
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid->background(), false));
405
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
406
407
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
408
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
409 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
410
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
411
412 const auto& root = grid->tree().root();
413
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
414
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginChildOn()->getFirstValue());
415 }
416
417 { // test one child node
418 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
419
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), 1.0, false));
420
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
421
422
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
423
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
424 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
425
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
426
427 const auto& root = grid->tree().root();
428
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
429
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(1.0, root.cbeginChildOn()->getFirstValue());
430 }
431
432 { // test one child node
433 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
434
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), 1.0, true));
435
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
436
437
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
438
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
439 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
440
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
441
442 const auto& root = grid->tree().root();
443
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
444
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(1.0, root.cbeginChildOn()->getFirstValue());
445 }
446
447 { // test one child node
448 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
449
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
450
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
451
452
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
453
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
454 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
455
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
456
457 const auto& root = grid->tree().root();
458
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
459
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
460 }
461
462 { // test one child node
463 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
464
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
465
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid2->background(), false));
466
467
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
468
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
469 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
470
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
471
472 const auto& root = grid->tree().root();
473
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
474
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginChildOn()->getFirstValue());
475 }
476
477 { // test one child node
478 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
479
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
480
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), 1.0, false));
481
482
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
483
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
484 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
485
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
486
487 const auto& root = grid->tree().root();
488
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
489
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(1.0, root.cbeginChildOn()->getFirstValue());
490 }
491 }
492
493 /////////////////////////////////////////////////////////////////////////
494
495 { // test two tiles
496
497 { // test outside background tiles
498 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
499
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
500
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
501
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
502
503
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
504
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
505 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
506
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
507
508
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
509 }
510
511 { // test inside vs outside background tiles
512 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
513
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
514
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
515
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
516
517
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
518
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
519 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
520
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
521
522 const auto& root = grid->tree().root();
523
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
524
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
525
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
526 }
527
528 { // test inside vs outside background tiles
529 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
530
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
531
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
532
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
533
534
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
535
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
536 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
537
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
538
539 const auto& root = grid->tree().root();
540
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
541
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
542
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
543 }
544
545 { // test inside background tiles
546 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
547
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
548
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
549
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
550
551
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
552
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
553 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
554
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
555
556 const auto& root = grid->tree().root();
557
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
558
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
559
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
560 }
561
562 { // test outside background tiles (different background values)
563 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
564
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
565
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
566
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
567
568
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
569
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
570 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
571
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
572
573
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
574 }
575
576 { // test inside vs outside background tiles (different background values)
577 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
578
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
579
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
580
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
581
582
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
583
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
584 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
585
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
586
587 const auto& root = grid->tree().root();
588
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
589
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
590
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
591 }
592
593 { // test inside vs outside background tiles (different background values)
594 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
595
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
596
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
597
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
598
599
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
600
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
601 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
602
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
603
604 const auto& root = grid->tree().root();
605
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
606
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
607
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
608 }
609
610 { // test inside background tiles (different background values)
611 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
612
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
613
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
614
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
615
616
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
617
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
618 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
619
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
620
621 const auto& root = grid->tree().root();
622
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
623
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
624
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
625 }
626 }
627
628 /////////////////////////////////////////////////////////////////////////
629
630 { // test one tile, one child
631
632 { // test background tiles vs child nodes
633 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
634
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
635
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
636
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
637
638
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
639
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
640 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
641
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
642
643 const auto& root = grid->tree().root();
644
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
645
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
646 }
647
648 { // test background tiles vs child nodes
649 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
650
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
651
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
652
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
653
654
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
655
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
656 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
657
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
658
659 const auto& root = grid->tree().root();
660
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
661
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
662
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
663 }
664
665 { // test background tiles vs child nodes
666 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
667
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
668
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
669
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid2->background(), false));
670
671
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
672
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
673 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
674
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
675
676 const auto& root = grid->tree().root();
677
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
678
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
679
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginChildOn()->getFirstValue());
680 }
681
682 { // test background tiles vs child nodes
683 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
684
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), false));
685
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
686
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
687
688
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
689
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
690 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
691
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
692
693 const auto& root = grid->tree().root();
694
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
695
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
696 }
697 }
698
699 /////////////////////////////////////////////////////////////////////////
700
701 { // test two children
702
703 { // test two child nodes
704 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
705
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), false));
706
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
707
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), true));
708
709
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
710
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
711 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
712
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
713
714 const auto& root = grid->tree().root();
715
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
716
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
717
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(false, root.cbeginChildOn()->isValueOn(0));
718 }
719
720 { // test two child nodes
721 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
722
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), true));
723
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
724
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
725
726
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
727
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
728 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
729
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
730
731 const auto& root = grid->tree().root();
732
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
733
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
734
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(true, root.cbeginChildOn()->isValueOn(0));
735 }
736
737 { // test two child nodes
738 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
739
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid->background(), false));
740
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
741
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), true));
742
743
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
744
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
745 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
746
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
747
748 const auto& root = grid->tree().root();
749
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
750
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginChildOn()->getFirstValue());
751
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(false, root.cbeginChildOn()->isValueOn(0));
752 }
753
754 { // test two child nodes
755 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
756
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), true));
757
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
758
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid2->background(), false));
759
760
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
761
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
762 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
763
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
764
765 const auto& root = grid->tree().root();
766
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
767
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginChildOn()->getFirstValue());
768
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(false, root.cbeginChildOn()->isValueOn(0));
769 }
770 }
771
772 /////////////////////////////////////////////////////////////////////////
773
774 { // test multiple root node elements
775
776 { // merge a child node into a grid with an existing child node
777 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
778 auto& root = grid->tree().root();
779
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
780
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), grid->background(), false);
781
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
782 auto& root2 = grid2->tree().root();
783
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), grid2->background(), false);
784
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(8192, 0, 0), 2.0f, false));
785
786
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
787 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
788
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
789
790
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), getChildCount(root));
791
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->cbeginValueAll());
792
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(1.0f, root.cbeginChildOn()->getFirstValue());
793
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(2.0f, (++root.cbeginChildOn())->getFirstValue());
794 }
795
796 { // merge a child node into a grid with an existing child node
797 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
798 auto& root = grid->tree().root();
799
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root.addTile(Coord(0, 0, 0), grid->background(), false);
800
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 root.addChild(new RootChildType(Coord(8192, 0, 0), 2.0f, false));
801
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
802 auto& root2 = grid2->tree().root();
803
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
804
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(8192, 0, 0), grid2->background(), false);
805
806
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
807 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
808
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
809
810
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), getChildCount(root));
811
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->cbeginValueAll());
812
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(1.0f, root.cbeginChildOn()->getFirstValue());
813
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(2.0f, (++root.cbeginChildOn())->getFirstValue());
814 }
815
816 { // merge background tiles and child nodes
817 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
818 auto& root = grid->tree().root();
819
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
820
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), -grid->background(), false);
821
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
822 auto& root2 = grid2->tree().root();
823
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), -grid2->background(), false);
824
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(8192, 0, 0), 2.0f, false));
825
826
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
827 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
828
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
829
830
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root));
831
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
832
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(-grid->background(), *(++root.cbeginValueOff()));
833 }
834 }
835
836 /////////////////////////////////////////////////////////////////////////
837
838 { // test merging internal node children
839
840 { // merge two internal nodes into a grid with an inside tile and an outside tile
841 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
842 auto& root = grid->tree().root();
843
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
3 auto rootChild = std::make_unique<RootChildType>(Coord(0, 0, 0), -123.0f, false);
844 1 rootChild->addTile(0, grid->background(), false);
845
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root.addChild(rootChild.release());
846
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
847 auto& root2 = grid2->tree().root();
848
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
3 auto rootChild2 = std::make_unique<RootChildType>(Coord(0, 0, 0), 55.0f, false);
849
850
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 0), 29.0f, false));
851
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 128), 31.0f, false));
852
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 rootChild2->addTile(2, -grid->background(), false);
853
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addChild(rootChild2.release());
854
855
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
856 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
857
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
858
859
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getChildCount(*root.cbeginChildOn()));
860
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(Index(0), getOutsideTileCount(*root.cbeginChildOn()));
861
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isChildMaskOn(0));
862
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isChildMaskOn(1));
863
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(29.0f, root.cbeginChildOn()->cbeginChildOn()->getFirstValue());
864
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(-123.0f, root.cbeginChildOn()->cbeginValueAll().getValue());
865 }
866
867 { // merge two internal nodes into a grid with an inside tile and an outside tile
868 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
869 auto& root = grid->tree().root();
870
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
3 auto rootChild = std::make_unique<RootChildType>(Coord(0, 0, 0), 123.0f, false);
871
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root.addChild(rootChild.release());
872
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
873 auto& root2 = grid2->tree().root();
874
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
3 auto rootChild2 = std::make_unique<RootChildType>(Coord(0, 0, 0), -55.0f, false);
875
876
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 0), 29.0f, false));
877
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 128), 31.0f, false));
878 1 rootChild2->addTile(2, -140.0f, false);
879 1 rootChild2->addTile(3, grid2->background(), false);
880
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addChild(rootChild2.release());
881
882
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
883 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
884
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
885
886
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getChildCount(*root.cbeginChildOn()));
887
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(*root.cbeginChildOn()));
888
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isChildMaskOn(0));
889
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isChildMaskOn(1));
890
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isChildMaskOn(2));
891
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isChildMaskOn(3));
892
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(29.0f, root.cbeginChildOn()->cbeginChildOn()->getFirstValue());
893
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(-grid->background(), root.cbeginChildOn()->cbeginValueAll().getItem(2));
894
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(123.0f, root.cbeginChildOn()->cbeginValueAll().getItem(3));
895 }
896 }
897
898 /////////////////////////////////////////////////////////////////////////
899
900 { // test merging leaf nodes
901
902 { // merge a leaf node into an empty grid
903 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
904
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
905
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
906
907
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
908 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
909
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
910
911
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
912 }
913
914 { // merge a leaf node into a grid with an outside tile
915 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
916
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -10.0f, false);
917
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
918
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
919
920
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
921 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
922
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
923
924 const auto& root = grid->tree().root();
925
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
926
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
927 }
928
929 { // merge a leaf node into a grid with an outside tile
930 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
931 grid->tree().touchLeaf(Coord(0, 0, 0));
932
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
933
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -10.0f, false);
934
935
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
936 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
937
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
938
939 const auto& root = grid->tree().root();
940
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
941
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
942 }
943
944 { // merge a leaf node into a grid with an internal node inside tile
945 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
946
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 auto rootChild = std::make_unique<RootChildType>(Coord(0, 0, 0), grid->background(), false);
947
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().root().addChild(rootChild.release());
948
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
949
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = grid2->tree().touchLeaf(Coord(0, 0, 0));
950
951 leaf->setValueOnly(11, grid2->background());
952
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 leaf->setValueOnly(12, -grid2->background());
953
954
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
955 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
956
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
957
958
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
959
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid2->tree().leafCount());
960
961 // test background values are remapped
962
963
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
964
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(grid->background(), testLeaf->getValue(11));
965
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-grid->background(), testLeaf->getValue(12));
966 }
967
968 { // merge a leaf node into a grid with a partially constructed leaf node
969 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
970
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
971
972
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid->tree().addLeaf(new LeafT(PartialCreate(), Coord(0, 0, 0)));
973 1 auto* leaf = grid2->tree().touchLeaf(Coord(0, 0, 0));
974
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 leaf->setValueOnly(10, -2.3f);
975
976
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
977 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
978
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
979
980
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
981
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-2.3f, testLeaf->getValue(10));
982 }
983
984 { // merge three leaf nodes from different grids
985 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
986
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
987
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
988
989
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = grid->tree().touchLeaf(Coord(0, 0, 0));
990
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf2 = grid2->tree().touchLeaf(Coord(0, 0, 0));
991 1 auto* leaf3 = grid3->tree().touchLeaf(Coord(0, 0, 0));
992
993 // active state from the voxel with the minimum value preserved
994
995
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(5, 4.0f);
996
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf2->setValueOnly(5, 2.0f);
997 leaf2->setValueOn(5);
998
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(5, 3.0f);
999
1000
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(7, 2.0f);
1001 leaf->setValueOn(7);
1002
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(7, 3.0f);
1003
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(7, 4.0f);
1004
1005
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(9, 4.0f);
1006 leaf->setValueOn(9);
1007
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(9, 3.0f);
1008
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 leaf3->setValueOnly(9, 2.0f);
1009
1010
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1011
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
1012 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1013
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1014
1015
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
1016
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2.0f, testLeaf->getValue(5));
1017
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(testLeaf->isValueOn(5));
1018
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2.0f, testLeaf->getValue(7));
1019
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(testLeaf->isValueOn(7));
1020
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2.0f, testLeaf->getValue(9));
1021
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!testLeaf->isValueOn(9));
1022 }
1023
1024 { // merge a leaf node into an empty grid from a const grid
1025 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1026
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), 1.0f, false);
1027
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1028
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
1029
1030
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid->tree().leafCount());
1031
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
1032
1033 // merge from a const tree
1034
1035 1 std::vector<tools::TreeToMerge<FloatTree>> treesToMerge;
1036
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 treesToMerge.emplace_back(grid2->constTree(), DeepCopy());
1037 tools::CsgUnionOp<FloatTree> mergeOp(treesToMerge);
1038 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1039
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1040
1041
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
1042 // leaf has been deep copied not stolen
1043
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
1044 }
1045 }
1046
1047 /////////////////////////////////////////////////////////////////////////
1048
1049 { // merge multiple grids
1050
1051 { // merge two background root tiles from two different grids
1052 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1053 auto& root = grid->tree().root();
1054
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1055 auto& root2 = grid2->tree().root();
1056
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(0, 0, 0), /*background=*/grid2->background(), false);
1057
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(8192, 0, 0), /*background=*/-grid2->background(), false);
1058
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
1059 auto& root3 = grid3->tree().root();
1060
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(0, 0, 0), /*background=*/-grid3->background(), false);
1061
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(8192, 0, 0), /*background=*/grid3->background(), false);
1062
1063
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1064
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
1065 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1066
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1067
1068
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root));
1069
1070
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginValueAll().getValue());
1071
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(-grid->background(), (++root.cbeginValueAll()).getValue());
1072 }
1073
1074 { // merge two outside root tiles from two different grids
1075 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1076 auto& root = grid->tree().root();
1077
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1078 auto& root2 = grid2->tree().root();
1079
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(0, 0, 0), /*background=*/-10.0f, false);
1080
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(8192, 0, 0), /*background=*/grid2->background(), false);
1081
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
1082 auto& root3 = grid3->tree().root();
1083
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root3.addTile(Coord(0, 0, 0), /*background=*/grid3->background(), false);
1084
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(8192, 0, 0), /*background=*/-11.0f, false);
1085
1086
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1087
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
1088 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1089
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1090
1091
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root));
1092
1093
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginValueAll().getValue());
1094
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(-grid->background(), (++root.cbeginValueAll()).getValue());
1095 }
1096
1097 { // merge two active, outside root tiles from two different grids
1098 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1099 auto& root = grid->tree().root();
1100
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root.addTile(Coord(0, 0, 0), /*background=*/grid->background(), false);
1101
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), /*background=*/grid->background(), false);
1102
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1103 auto& root2 = grid2->tree().root();
1104
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(0, 0, 0), /*background=*/-10.0f, true);
1105
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(8192, 0, 0), /*background=*/grid2->background(), false);
1106
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
1107 auto& root3 = grid3->tree().root();
1108
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root3.addTile(Coord(0, 0, 0), /*background=*/grid3->background(), false);
1109
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(8192, 0, 0), /*background=*/-11.0f, true);
1110
1111
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1112
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
1113 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1114
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1115
1116
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root));
1117
1118
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginValueAll().getValue());
1119
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(-grid->background(), (++root.cbeginValueAll()).getValue());
1120 }
1121
1122 { // merge three root tiles, one of which is a background tile
1123 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1124 auto& root = grid->tree().root();
1125
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), grid->background(), true);
1126
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1127 auto& root2 = grid2->tree().root();
1128
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(0, 0, 0), -grid2->background(), true);
1129
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>();
1130 auto& root3 = grid3->tree().root();
1131
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(0, 0, 0), -grid3->background(), false);
1132
1133
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1134
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgUnionOp<FloatTree> mergeOp(trees, Steal());
1135 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1136
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1137
1138
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
1139
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginValueOn().getValue());
1140 }
1141 }
1142 1 }
1143
1144
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestMerge, testCsgIntersection)
1145 {
1146 using RootChildType = FloatTree::RootNodeType::ChildNodeType;
1147 using LeafParentType = RootChildType::ChildNodeType;
1148 using LeafT = FloatTree::LeafNodeType;
1149
1150 { // construction
1151 2 FloatTree tree1;
1152 2 FloatTree tree2;
1153 2 const FloatTree tree3;
1154
1155 { // one non-const tree (steal)
1156
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(tree1, Steal());
1157
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
1158 }
1159 { // one non-const tree (deep-copy)
1160
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(tree1, DeepCopy());
1161
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
1162 }
1163 { // one const tree (deep-copy)
1164
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(tree2, DeepCopy());
1165
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
1166 }
1167 { // vector of tree pointers
1168
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
1169
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1170
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp.size());
1171 }
1172 { // deque of tree pointers
1173
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::deque<FloatTree*> trees{&tree1, &tree2};
1174
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1175
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp.size());
1176 }
1177 { // vector of TreesToMerge (to mix const and non-const trees)
1178 1 std::vector<tools::TreeToMerge<FloatTree>> trees;
1179
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 trees.emplace_back(tree1, Steal());
1180
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 trees.emplace_back(tree3, DeepCopy()); // const tree
1181
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 trees.emplace_back(tree2, Steal());
1182 tools::CsgIntersectionOp<FloatTree> mergeOp(trees);
1183
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(3), mergeOp.size());
1184 }
1185 { // implicit copy constructor
1186
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
1187
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1188 tools::CsgIntersectionOp<FloatTree> mergeOp2(mergeOp);
1189
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp2.size());
1190 }
1191 { // implicit assignment operator
1192
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
1193
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1194 tools::CsgIntersectionOp<FloatTree> mergeOp2 = mergeOp;
1195
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp2.size());
1196 }
1197 }
1198
1199 /////////////////////////////////////////////////////////////////////////
1200
1201 { // empty merge trees
1202 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1203 auto& root = grid->tree().root();
1204 std::vector<FloatTree*> trees;
1205
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1206
1207
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(0), mergeOp.size());
1208
1209 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1210
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1211
1212
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
1213 }
1214
1215 /////////////////////////////////////////////////////////////////////////
1216
1217 { // test one tile or one child
1218
1219 { // test one background tile
1220 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1221
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1222
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1223
1224
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1225
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1226 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1227
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1228
1229
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1230 }
1231
1232 { // test one background tile
1233 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1234
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1235
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
1236
1237
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1238
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1239 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1240
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1241
1242
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1243 }
1244
1245 { // test one background tile
1246 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1247
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1248
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1249
1250
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1251
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1252 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1253
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1254
1255
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1256 }
1257
1258 { // test one background tile
1259 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1260
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1261
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
1262
1263
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1264
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1265 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1266
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1267
1268
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1269 }
1270
1271 { // test one child node
1272 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1273
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), false));
1274
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1275
1276
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1277
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1278 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1279
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1280
1281
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1282 }
1283
1284 { // test one child node
1285 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1286
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid->background(), false));
1287
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1288
1289
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1290
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1291 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1292
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1293
1294
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1295 }
1296
1297 { // test one child node
1298 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1299
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), 1.0, false));
1300
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1301
1302
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1303
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1304 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1305
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1306
1307
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1308 }
1309
1310 { // test one child node
1311 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1312
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), 1.0, true));
1313
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1314
1315
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1316
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1317 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1318
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1319
1320
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1321 }
1322
1323 { // test one child node
1324 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1325
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1326
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
1327
1328
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1329
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1330 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1331
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1332
1333
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1334 }
1335
1336 { // test one child node
1337 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1338
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1339
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid2->background(), false));
1340
1341
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1342
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1343 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1344
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1345
1346
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1347 }
1348
1349 { // test one child node
1350 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1351
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1352
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), 1.0, false));
1353
1354
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1355
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1356 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1357
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1358
1359
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1360 }
1361 }
1362
1363 /////////////////////////////////////////////////////////////////////////
1364
1365 { // test two tiles
1366
1367 { // test outside background tiles
1368 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1369
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1370
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1371
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
1372
1373
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1374
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1375 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1376
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1377
1378
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1379 }
1380
1381 { // test inside vs outside background tiles
1382 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1383
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1384
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1385
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
1386
1387
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1388
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1389 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1390
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1391
1392
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1393 }
1394
1395 { // test inside vs outside background tiles
1396 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1397
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1398
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1399
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
1400
1401
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1402
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1403 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1404
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1405
1406
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1407 }
1408
1409 { // test inside background tiles
1410 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1411
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1412
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1413
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
1414
1415
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1416
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1417 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1418
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1419
1420 const auto& root = grid->tree().root();
1421
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
1422
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
1423
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
1424 }
1425
1426 { // test outside background tiles (different background values)
1427 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1428
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1429
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1430
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
1431
1432
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1433
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1434 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1435
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1436
1437
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1438 }
1439
1440 { // test inside vs outside background tiles (different background values)
1441 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1442
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1443
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1444
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
1445
1446
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1447
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1448 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1449
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1450
1451
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1452 }
1453
1454 { // test inside vs outside background tiles (different background values)
1455 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1456
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1457
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1458
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
1459
1460
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1461
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1462 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1463
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1464
1465
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1466 }
1467
1468 { // test inside background tiles (different background values)
1469 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1470
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1471
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1472
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), -grid2->background(), false);
1473
1474
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1475
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1476 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1477
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1478
1479 const auto& root = grid->tree().root();
1480
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(hasOnlyInactiveNegativeBackgroundTiles(root));
1481
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
1482
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(-grid->background(), *root.cbeginValueOff());
1483 }
1484 }
1485
1486 /////////////////////////////////////////////////////////////////////////
1487
1488 { // test one tile, one child
1489
1490 { // test background tiles vs child nodes
1491 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1492
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1493
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1494
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
1495
1496
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1497
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1498 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1499
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1500
1501
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1502 }
1503
1504 { // test background tiles vs child nodes
1505 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1506
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1507
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1508
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
1509
1510
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1511
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1512 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1513
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1514
1515 const auto& root = grid->tree().root();
1516
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
1517
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
1518 }
1519
1520 { // test background tiles vs child nodes
1521 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1522
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1523
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1524
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid2->background(), false));
1525
1526
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1527
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1528 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1529
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1530
1531
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1532 }
1533
1534 { // test background tiles vs child nodes
1535 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1536
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1537
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1538
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid2->background(), false));
1539
1540
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1541
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1542 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1543
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1544
1545 const auto& root = grid->tree().root();
1546
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
1547
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(-grid->background(), root.cbeginChildOn()->getFirstValue());
1548 }
1549
1550 { // test background tiles vs child nodes
1551 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1552
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), false));
1553
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1554
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), grid2->background(), false);
1555
1556
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1557
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1558 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1559
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1560
1561
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1562 }
1563 }
1564
1565 /////////////////////////////////////////////////////////////////////////
1566
1567 { // test two children
1568
1569 { // test two child nodes
1570 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1571
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), false));
1572
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1573
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), true));
1574
1575
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1576
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1577 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1578
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1579
1580 const auto& root = grid->tree().root();
1581
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
1582
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
1583
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(false, root.cbeginChildOn()->isValueOn(0));
1584 }
1585
1586 { // test two child nodes
1587 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1588
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), true));
1589
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1590
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), false));
1591
1592
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1593
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1594 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1595
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1596
1597 const auto& root = grid->tree().root();
1598
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
1599
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
1600
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(true, root.cbeginChildOn()->isValueOn(0));
1601 }
1602
1603 { // test two child nodes
1604 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1605
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid->background(), false));
1606
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1607
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid2->background(), true));
1608
1609
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1610
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1611 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1612
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1613
1614 const auto& root = grid->tree().root();
1615
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
1616
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
1617
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(true, root.cbeginChildOn()->isValueOn(0));
1618 }
1619
1620 { // test two child nodes
1621 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1622
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
1 grid->tree().root().addChild(new RootChildType(Coord(0, 0, 0), grid->background(), true));
1623
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1624
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid2->tree().root().addChild(new RootChildType(Coord(0, 0, 0), -grid2->background(), false));
1625
1626
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree()};
1627
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1628 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1629
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1630
1631 const auto& root = grid->tree().root();
1632
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
1633
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->getFirstValue());
1634
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(true, root.cbeginChildOn()->isValueOn(0));
1635 }
1636 }
1637
1638 /////////////////////////////////////////////////////////////////////////
1639
1640 { // test multiple root node elements
1641
1642 { // merge a child node into a grid with an existing child node
1643 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1644 auto& root = grid->tree().root();
1645
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
1646
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), -grid->background(), false);
1647
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1648 auto& root2 = grid2->tree().root();
1649
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), -grid2->background(), false);
1650
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(8192, 0, 0), 2.0f, false));
1651
1652
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1653 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1654
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1655
1656
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), getChildCount(root));
1657
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->cbeginValueAll());
1658
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(1.0f, root.cbeginChildOn()->getFirstValue());
1659
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(2.0f, (++root.cbeginChildOn())->getFirstValue());
1660 }
1661
1662 { // merge a child node into a grid with an existing child node
1663 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1664 auto& root = grid->tree().root();
1665
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root.addTile(Coord(0, 0, 0), -grid->background(), false);
1666
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 root.addChild(new RootChildType(Coord(8192, 0, 0), 2.0f, false));
1667
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1668 auto& root2 = grid2->tree().root();
1669
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
1670
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(8192, 0, 0), -grid2->background(), false);
1671
1672
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1673 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1674
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1675
1676
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), getChildCount(root));
1677
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->cbeginValueAll());
1678
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(1.0f, root.cbeginChildOn()->getFirstValue());
1679
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(2.0f, (++root.cbeginChildOn())->getFirstValue());
1680 }
1681
1682 { // merge background tiles and child nodes
1683 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1684 auto& root = grid->tree().root();
1685
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
1686
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), grid->background(), false);
1687
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1688 auto& root2 = grid2->tree().root();
1689
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), grid2->background(), false);
1690
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(8192, 0, 0), 2.0f, false));
1691
1692
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1693 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1694
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1695
1696
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
1697 }
1698 }
1699
1700 /////////////////////////////////////////////////////////////////////////
1701
1702 { // test merging internal node children
1703
1704 { // merge two internal nodes into a grid with an inside tile and an outside tile
1705 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1706 auto& root = grid->tree().root();
1707
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
3 auto rootChild = std::make_unique<RootChildType>(Coord(0, 0, 0), 123.0f, false);
1708
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 rootChild->addTile(0, -grid->background(), false);
1709
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root.addChild(rootChild.release());
1710
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1711 auto& root2 = grid2->tree().root();
1712
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
3 auto rootChild2 = std::make_unique<RootChildType>(Coord(0, 0, 0), 55.0f, false);
1713
1714
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 0), 29.0f, false));
1715
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 128), 31.0f, false));
1716
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 rootChild2->addTile(2, -grid->background(), false);
1717
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addChild(rootChild2.release());
1718
1719
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1720 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1721
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1722
1723
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getChildCount(*root.cbeginChildOn()));
1724
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(*root.cbeginChildOn()));
1725
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isChildMaskOn(0));
1726
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isChildMaskOn(1));
1727
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(29.0f, root.cbeginChildOn()->cbeginChildOn()->getFirstValue());
1728
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(123.0f, root.cbeginChildOn()->cbeginValueAll().getValue());
1729 }
1730
1731 { // merge two internal nodes into a grid with an inside tile and an outside tile
1732 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1733 auto& root = grid->tree().root();
1734
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
3 auto rootChild = std::make_unique<RootChildType>(Coord(0, 0, 0), -123.0f, false);
1735
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root.addChild(rootChild.release());
1736
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1737 auto& root2 = grid2->tree().root();
1738
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
3 auto rootChild2 = std::make_unique<RootChildType>(Coord(0, 0, 0), 55.0f, false);
1739
1740
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 0), 29.0f, false));
1741
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 128), 31.0f, false));
1742 1 rootChild2->addTile(2, 140.0f, false);
1743
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 rootChild2->addTile(3, -grid2->background(), false);
1744
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addChild(rootChild2.release());
1745
1746
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1747 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1748
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1749
1750
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getChildCount(*root.cbeginChildOn()));
1751
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(Index(1), getInsideTileCount(*root.cbeginChildOn()));
1752
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isChildMaskOn(0));
1753
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isChildMaskOn(1));
1754
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isChildMaskOn(2));
1755
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isChildMaskOn(3));
1756
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(29.0f, root.cbeginChildOn()->cbeginChildOn()->getFirstValue());
1757
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginChildOn()->cbeginValueAll().getItem(2));
1758
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
2 EXPECT_EQ(-123.0f, root.cbeginChildOn()->cbeginValueAll().getItem(3));
1759 }
1760 }
1761
1762 /////////////////////////////////////////////////////////////////////////
1763
1764 { // test merging leaf nodes
1765
1766 { // merge a leaf node into an empty grid
1767 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1768
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1769
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
1770
1771
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1772 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1773
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1774
1775
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid->tree().leafCount());
1776 }
1777
1778 { // merge a leaf node into a grid with a background tile
1779 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1780
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), grid->background(), false);
1781
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1782
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
1783
1784
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1785 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1786
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1787
1788
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid->tree().leafCount());
1789 }
1790
1791 { // merge a leaf node into a grid with an outside tile
1792 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1793
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), 10.0f, false);
1794
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1795
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
1796
1797
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1798 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1799
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1800
1801
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1802 }
1803
1804 { // merge a leaf node into a grid with an outside tile
1805 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1806 grid->tree().touchLeaf(Coord(0, 0, 0));
1807
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1808
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 grid2->tree().root().addTile(Coord(0, 0, 0), 10.0f, false);
1809
1810
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1811 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1812
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1813
1814
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1815 }
1816
1817 { // merge a leaf node into a grid with an internal node inside tile
1818 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1819
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
3 auto rootChild = std::make_unique<RootChildType>(Coord(0, 0, 0), -grid->background(), false);
1820
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid->tree().root().addChild(rootChild.release());
1821
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1822
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = grid2->tree().touchLeaf(Coord(0, 0, 0));
1823
1824 leaf->setValueOnly(11, grid2->background());
1825
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 leaf->setValueOnly(12, -grid2->background());
1826
1827
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1828 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1829
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1830
1831
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
1832
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid2->tree().leafCount());
1833
1834 // test background values are remapped
1835
1836
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
1837
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(grid->background(), testLeaf->getValue(11));
1838
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-grid->background(), testLeaf->getValue(12));
1839 }
1840
1841 { // merge a leaf node into a grid with a partially constructed leaf node
1842 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1843
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -grid->background(), false);
1844
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1845
1846
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid->tree().addLeaf(new LeafT(PartialCreate(), Coord(0, 0, 0)));
1847 1 auto* leaf = grid2->tree().touchLeaf(Coord(0, 0, 0));
1848
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 leaf->setValueOnly(10, 6.4f);
1849
1850
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp{grid2->tree(), Steal()};
1851 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1852
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1853
1854
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
1855
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(6.4f, testLeaf->getValue(10));
1856 }
1857
1858 { // merge three leaf nodes from different grids
1859 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1860
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1861
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
1862
1863
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = grid->tree().touchLeaf(Coord(0, 0, 0));
1864
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf2 = grid2->tree().touchLeaf(Coord(0, 0, 0));
1865 1 auto* leaf3 = grid3->tree().touchLeaf(Coord(0, 0, 0));
1866
1867 // active state from the voxel with the maximum value preserved
1868
1869
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(5, 4.0f);
1870
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf2->setValueOnly(5, 2.0f);
1871 leaf2->setValueOn(5);
1872
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(5, 3.0f);
1873
1874
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(7, 2.0f);
1875 leaf->setValueOn(7);
1876
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(7, 3.0f);
1877
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(7, 4.0f);
1878
1879
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(9, 4.0f);
1880 leaf->setValueOn(9);
1881
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(9, 3.0f);
1882
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 leaf3->setValueOnly(9, 2.0f);
1883
1884
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1885
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1886 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1887
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1888
1889
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
1890
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(4.0f, testLeaf->getValue(5));
1891
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!testLeaf->isValueOn(5));
1892
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(4.0f, testLeaf->getValue(7));
1893
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!testLeaf->isValueOn(7));
1894
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(4.0f, testLeaf->getValue(9));
1895
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(testLeaf->isValueOn(9));
1896 }
1897
1898 { // merge a leaf node into an empty grid from a const grid
1899 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1900
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().root().addTile(Coord(0, 0, 0), -1.0f, false);
1901
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1902
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
1903
1904
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid->tree().leafCount());
1905
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
1906
1907 // merge from a const tree
1908
1909 1 std::vector<tools::TreeToMerge<FloatTree>> treesToMerge;
1910
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 treesToMerge.emplace_back(grid2->constTree(), DeepCopy());
1911 tools::CsgIntersectionOp<FloatTree> mergeOp(treesToMerge);
1912 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1913
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1914
1915
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
1916 // leaf has been deep copied not stolen
1917
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
1918 }
1919
1920 { // merge three leaf nodes from four grids
1921 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1922
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
1923
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>();
1924
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid4 = createLevelSet<FloatGrid>();
1925
1926
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = grid->tree().touchLeaf(Coord(0, 0, 0));
1927
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf2 = grid2->tree().touchLeaf(Coord(0, 0, 0));
1928 1 auto* leaf3 = grid3->tree().touchLeaf(Coord(0, 0, 0));
1929
1930 // active state from the voxel with the maximum value preserved
1931
1932
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(5, 4.0f);
1933
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf2->setValueOnly(5, 2.0f);
1934 leaf2->setValueOn(5);
1935
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(5, 3.0f);
1936
1937
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(7, 2.0f);
1938 leaf->setValueOn(7);
1939
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(7, 3.0f);
1940
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(7, 4.0f);
1941
1942
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(9, 4.0f);
1943 leaf->setValueOn(9);
1944
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(9, 3.0f);
1945
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 leaf3->setValueOnly(9, 2.0f);
1946
1947
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree(), &grid4->tree()};
1948
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1949 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1950
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1951
1952
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), grid->tree().root().getTableSize());
1953 }
1954
1955 }
1956
1957 /////////////////////////////////////////////////////////////////////////
1958
1959 { // merge multiple grids
1960
1961 { // merge two background root tiles from two different grids
1962 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1963 auto& root = grid->tree().root();
1964
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root.addTile(Coord(0, 0, 0), /*background=*/-grid->background(), false);
1965
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), /*background=*/-grid->background(), false);
1966
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1967 auto& root2 = grid2->tree().root();
1968
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(0, 0, 0), /*background=*/grid2->background(), false);
1969
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(8192, 0, 0), /*background=*/-grid2->background(), false);
1970
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
1971 auto& root3 = grid3->tree().root();
1972
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(0, 0, 0), /*background=*/-grid3->background(), false);
1973
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(8192, 0, 0), /*background=*/grid3->background(), false);
1974
1975
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1976
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1977 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
1978
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
1979
1980
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
1981 }
1982
1983 { // merge two outside root tiles from two different grids
1984 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
1985 auto& root = grid->tree().root();
1986
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root.addTile(Coord(0, 0, 0), /*background=*/-grid->background(), false);
1987
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), /*background=*/-grid->background(), false);
1988
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
1989 auto& root2 = grid2->tree().root();
1990
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(0, 0, 0), /*background=*/10.0f, false);
1991
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(8192, 0, 0), /*background=*/-grid2->background(), false);
1992
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
1993 auto& root3 = grid3->tree().root();
1994
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root3.addTile(Coord(0, 0, 0), /*background=*/-grid3->background(), false);
1995
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(8192, 0, 0), /*background=*/11.0f, false);
1996
1997
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
1998
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
1999 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2000
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2001
2002
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
2003 }
2004
2005 { // merge two active, outside root tiles from two different grids
2006 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2007 auto& root = grid->tree().root();
2008
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root.addTile(Coord(0, 0, 0), /*background=*/-grid->background(), false);
2009
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), /*background=*/-grid->background(), false);
2010
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/5);
2011 auto& root2 = grid2->tree().root();
2012
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(0, 0, 0), /*background=*/10.0f, true);
2013
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(8192, 0, 0), /*background=*/-grid2->background(), false);
2014
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*narrowBandWidth=*/7);
2015 auto& root3 = grid3->tree().root();
2016
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root3.addTile(Coord(0, 0, 0), /*background=*/-grid3->background(), false);
2017
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(8192, 0, 0), /*background=*/11.0f, true);
2018
2019
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
2020
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
2021 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2022
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2023
2024
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root));
2025
2026
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginValueAll().getValue());
2027
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(grid->background(), (++root.cbeginValueAll()).getValue());
2028 }
2029
2030 { // merge three root tiles, one of which is a background tile
2031 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2032 auto& root = grid->tree().root();
2033
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), -grid->background(), true);
2034
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2035 auto& root2 = grid2->tree().root();
2036
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(0, 0, 0), grid2->background(), true);
2037
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>();
2038 auto& root3 = grid3->tree().root();
2039
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(0, 0, 0), grid3->background(), false);
2040
2041
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
2042
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
2043 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2044
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2045
2046
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2047
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2048 }
2049
2050 { // merge three root tiles, one of which is a background tile
2051 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2052 auto& root = grid->tree().root();
2053
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), -grid->background(), true);
2054
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2055 auto& root2 = grid2->tree().root();
2056
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root2.addTile(Coord(0, 0, 0), grid2->background(), false);
2057
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid3 = createLevelSet<FloatGrid>();
2058 auto& root3 = grid3->tree().root();
2059
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root3.addTile(Coord(0, 0, 0), grid3->background(), true);
2060
2061
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<FloatTree*> trees{&grid2->tree(), &grid3->tree()};
2062
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::CsgIntersectionOp<FloatTree> mergeOp(trees, Steal());
2063 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2064
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2065
2066
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
2067 }
2068
2069 }
2070 1 }
2071
2072
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestMerge, testCsgDifference)
2073 {
2074 using RootChildType = FloatTree::RootNodeType::ChildNodeType;
2075 using LeafParentType = RootChildType::ChildNodeType;
2076 using LeafT = FloatTree::LeafNodeType;
2077
2078 { // construction
2079 2 FloatTree tree1;
2080 2 const FloatTree tree2;
2081
2082 { // one non-const tree (steal)
2083 tools::CsgDifferenceOp<FloatTree> mergeOp(tree1, Steal());
2084
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2085 }
2086 { // one non-const tree (deep-copy)
2087 tools::CsgDifferenceOp<FloatTree> mergeOp(tree1, DeepCopy());
2088
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2089 }
2090 { // one const tree (deep-copy)
2091 tools::CsgDifferenceOp<FloatTree> mergeOp(tree2, DeepCopy());
2092
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2093 }
2094 { // one non-const tree wrapped in TreeToMerge
2095 1 tools::TreeToMerge<FloatTree> tree3(tree1, Steal());
2096 tools::CsgDifferenceOp<FloatTree> mergeOp(tree3);
2097
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2098 }
2099 { // one const tree wrapped in TreeToMerge
2100
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 tools::TreeToMerge<FloatTree> tree4(tree2, DeepCopy());
2101 tools::CsgDifferenceOp<FloatTree> mergeOp(tree4);
2102
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2103 }
2104 { // implicit copy constructor
2105 tools::CsgDifferenceOp<FloatTree> mergeOp(tree2, DeepCopy());
2106
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2107 tools::CsgDifferenceOp<FloatTree> mergeOp2(mergeOp);
2108
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp2.size());
2109 }
2110 { // implicit assignment operator
2111 tools::CsgDifferenceOp<FloatTree> mergeOp(tree2, DeepCopy());
2112
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2113 tools::CsgDifferenceOp<FloatTree> mergeOp2 = mergeOp;
2114
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp2.size());
2115 }
2116 }
2117
2118 { // merge two different outside root tiles from one grid into an empty grid (noop)
2119 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2120 auto& root = grid->tree().root();
2121
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2122 auto& root2 = grid2->tree().root();
2123
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(0, 0, 0), grid->background(), false);
2124
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 root2.addTile(Coord(8192, 0, 0), grid->background(), true);
2125
2126
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), root2.getTableSize());
2127
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root2));
2128
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(root2));
2129
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root2));
2130
2131 // test container constructor here
2132 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2133 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2134
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2135
2136
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
2137 }
2138
2139 { // merge an outside root tile to a grid which already has this tile
2140 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2141 auto& root = grid->tree().root();
2142
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), grid->background(), false);
2143
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2144 auto& root2 = grid2->tree().root();
2145
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), grid->background(), true);
2146
2147 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2148 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2149
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2150
2151
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
2152 }
2153
2154 { // merge an outside root tile to a grid which already has this tile
2155 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2156 auto& root = grid->tree().root();
2157
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), grid->background(), true);
2158
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2159 auto& root2 = grid2->tree().root();
2160
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), grid->background(), false);
2161
2162 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2163 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2164
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2165
2166
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2167
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2168 // tile in merge grid should not replace existing tile - tile should remain inactive
2169
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(root));
2170
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInactiveTileCount(root));
2171
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(root));
2172
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(root));
2173 }
2174
2175 { // merge an outside root tile to a grid which has an inside tile (noop)
2176 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2177 auto& root = grid->tree().root();
2178
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), -grid->background(), false);
2179
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2180 auto& root2 = grid2->tree().root();
2181
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addTile(Coord(0, 0, 0), 123.0f, true);
2182
2183
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInsideTileCount(root));
2184
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(0), getOutsideTileCount(root));
2185
2186 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2187 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2188
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2189
2190
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2191
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2192
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getActiveTileCount(root));
2193
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
2194
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInsideTileCount(root));
2195
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getOutsideTileCount(root));
2196 }
2197
2198 { // merge an outside root tile to a grid which has a child (noop)
2199 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2200 auto& root = grid->tree().root();
2201
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
2202
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2203 auto& root2 = grid2->tree().root();
2204
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addTile(Coord(0, 0, 0), 123.0f, true);
2205
2206
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
2207
2208 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2209 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2210
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2211
2212
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2213
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
2214
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
2215 }
2216
2217 { // merge a child to a grid which has an outside root tile (noop)
2218 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2219 auto& root = grid->tree().root();
2220
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), 123.0f, true);
2221
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2222 auto& root2 = grid2->tree().root();
2223
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 root2.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
2224
2225
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(root));
2226
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(root));
2227
2228 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2229 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2230
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2231
2232
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2233
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2234
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), getChildCount(root));
2235
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(root));
2236
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInactiveTileCount(root));
2237
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(root));
2238
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(root));
2239 }
2240
2241 { // merge an inside root tile to a grid which has an outside tile (noop)
2242 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2243 auto& root = grid->tree().root();
2244
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), grid->background(), true);
2245
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2246 auto& root2 = grid2->tree().root();
2247
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addTile(Coord(0, 0, 0), -123.0f, true);
2248
2249
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(root));
2250
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(root));
2251
2252 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2253 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2254
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2255
2256
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2257
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2258
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(root));
2259
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInactiveTileCount(root));
2260
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(root));
2261
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(root));
2262 }
2263
2264 { // merge two grids with outside tiles, active state should be carried across
2265 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2266 auto& root = grid->tree().root();
2267
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), 0.1f, false);
2268
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2269 auto& root2 = grid2->tree().root();
2270
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), 0.2f, true);
2271
2272 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2273 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2274
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2275
2276
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2277
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2278 // outside tile should now be inactive
2279
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getActiveTileCount(root));
2280
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
2281
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(root));
2282
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(root));
2283
2284
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(0.1f, root.cbeginValueAll().getValue());
2285 }
2286
2287 { // merge two grids with outside tiles, active state should be carried across
2288 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2289 auto& root = grid->tree().root();
2290
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), -0.1f, true);
2291
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2292 auto& root2 = grid2->tree().root();
2293
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(0, 0, 0), -0.2f, false);
2294
2295 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2296 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2297
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2298
2299
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), root.getTableSize());
2300 }
2301
2302 { // merge an inside root tile to a grid which has a child, inside tile has precedence
2303 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2304 auto& root = grid->tree().root();
2305
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
2306
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2307 auto& root2 = grid2->tree().root();
2308
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addTile(Coord(0, 0, 0), -123.0f, true);
2309
2310
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
2311
2312 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2313 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2314
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2315
2316
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2317
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2318
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), getChildCount(root));
2319
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(root));
2320
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInactiveTileCount(root));
2321
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(root));
2322
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getOutsideTileCount(root));
2323
2324
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginValueAll().getValue());
2325 }
2326
2327 { // merge a child to a grid which has an inside root tile, child should be stolen
2328 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2329 auto& root = grid->tree().root();
2330
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(0, 0, 0), -123.0f, true);
2331 // use a different background value
2332
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>(/*voxelSize=*/1.0, /*halfWidth=*/5);
2333 auto& root2 = grid2->tree().root();
2334
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
2 auto childPtr = std::make_unique<RootChildType>(Coord(0, 0, 0), 5.0f, false);
2335
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 childPtr->addTile(Index(1), 1.3f, true);
2336
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addChild(childPtr.release());
2337
2338
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInsideTileCount(root));
2339
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getOutsideTileCount(root));
2340
2341 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2342 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2343
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2344
2345
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), root.getTableSize());
2346
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
2347
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
2348
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(0), getChildCount(root2));
2349
2350
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isValueOn(Index(0)));
2351
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isValueOn(Index(1)));
2352
2353
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 auto iter = root.cbeginChildOn()->cbeginValueAll();
2354
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-3.0f, iter.getValue());
2355 ++iter;
2356
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-1.3f, iter.getValue());
2357 }
2358
2359 { // merge two child nodes into a grid with two inside tiles
2360 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2361 auto& root = grid->tree().root();
2362
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root.addTile(Coord(0, 0, 0), -2.0f, false);
2363
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 root.addTile(Coord(8192, 0, 0), -4.0f, false);
2364
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2365 auto& root2 = grid2->tree().root();
2366
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(0, 0, 0), 1.0f, false));
2367
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root2.addChild(new RootChildType(Coord(8192, 0, 0), -123.0f, true));
2368
2369
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), root2.getTableSize());
2370
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root2));
2371
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(Index(2), getChildCount(root2));
2372
2373 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2374 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2375
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2376
2377
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), root.getTableSize());
2378
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
2379
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), getChildCount(root));
2380 }
2381
2382 { // merge an inside tile and an outside tile into a grid with two child nodes
2383 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2384 auto& root = grid->tree().root();
2385
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 123.0f, false));
2386
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 root.addChild(new RootChildType(Coord(8192, 0, 0), 1.9f, false));
2387
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2388 auto& root2 = grid2->tree().root();
2389
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addTile(Coord(0, 0, 0), 15.0f, true); // should not replace child
2390
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 root2.addTile(Coord(8192, 0, 0), -25.0f, true); // should replace child
2391
2392 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2393 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2394
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2395
2396
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
2397
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(root));
2398
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(123.0f, root.cbeginChildOn()->getFirstValue());
2399
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(root.cbeginChildAll().isChildNode());
2400
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(!(++root.cbeginChildAll()).isChildNode());
2401
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(grid->background(), root.cbeginValueOn().getValue());
2402 }
2403
2404 { // merge an inside tile and an outside tile into a grid with two child nodes
2405 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2406 auto& root = grid->tree().root();
2407
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 root.addChild(new RootChildType(Coord(0, 0, 0), 123.0f, false));
2408
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 root.addChild(new RootChildType(Coord(8192, 0, 0), 1.9f, false));
2409
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2410 auto& root2 = grid2->tree().root();
2411
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addTile(Coord(0, 0, 0), 15.0f, false); // should not replace child
2412
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addTile(Coord(8192, 0, 0), -25.0f, false); // should replace child
2413
2414
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), getChildCount(root));
2415
2/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root2));
2416
2417 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2418 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2419
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2420
2421
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
2422
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
2423
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(123.0f, root.cbeginChildOn()->getFirstValue());
2424 }
2425
2426 { // merge two internal nodes into a grid with an inside tile and an outside tile
2427 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2428 auto& root = grid->tree().root();
2429
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 auto rootChild = std::make_unique<RootChildType>(Coord(0, 0, 0), 123.0f, false);
2430 1 rootChild->addTile(0, -14.0f, false);
2431 1 rootChild->addTile(1, 15.0f, false);
2432
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 rootChild->addTile(2, -13.0f, false);
2433
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root.addChild(rootChild.release());
2434
2435
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2436 auto& root2 = grid2->tree().root();
2437
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
3 auto rootChild2 = std::make_unique<RootChildType>(Coord(0, 0, 0), 55.0f, false);
2438
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 0), 29.0f, false));
2439
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rootChild2->addChild(new LeafParentType(Coord(0, 0, 128), 31.0f, false));
2440 1 rootChild2->addTile(2, -17.0f, true);
2441
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 rootChild2->addTile(9, 19.0f, true);
2442
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 root2.addChild(rootChild2.release());
2443
2444
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(Index(2), getInsideTileCount(*root.cbeginChildOn()));
2445
2/16
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(Index(0), getActiveTileCount(*root.cbeginChildOn()));
2446
2447
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getChildCount(*root2.cbeginChildOn()));
2448
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(Index(1), getInsideTileCount(*root2.cbeginChildOn()));
2449
2/16
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(Index(2), getActiveTileCount(*root2.cbeginChildOn()));
2450
2451 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2452 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2453
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2454
2455
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getChildCount(*root.cbeginChildOn()));
2456
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_EQ(Index(0), getInsideTileCount(*root.cbeginChildOn()));
2457
2/16
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(*root.cbeginChildOn()));
2458
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(root.cbeginChildOn()->isChildMaskOn(0));
2459
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
2 EXPECT_TRUE(!root.cbeginChildOn()->isChildMaskOn(1));
2460
3/18
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(-29.0f, root.cbeginChildOn()->cbeginChildOn()->getFirstValue());
2461
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 auto iter = root.cbeginChildOn()->cbeginValueAll();
2462
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(15.0f, iter.getValue());
2463 ++iter;
2464
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(3.0f, iter.getValue());
2465
2466
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getChildCount(*root2.cbeginChildOn()));
2467 }
2468
2469 { // merge a leaf node into a grid with an inside tile
2470 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2471
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().addTile(1, Coord(0, 0, 0), -1.3f, true);
2472
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2473
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
2474
2475
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid->tree().leafCount());
2476
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
2477
2478 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2479 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2480
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2481
2482
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
2483
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid2->tree().leafCount());
2484 }
2485
2486 { // merge two leaf nodes into a grid
2487 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2488 grid->tree().touchLeaf(Coord(0, 0, 0));
2489
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2490
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
2491
2492
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
2493
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
2494
2495 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2496 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2497
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2498
2499
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 const auto* leaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
2500
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(leaf);
2501 }
2502
2503 { // merge a leaf node into a grid with a partially constructed leaf node
2504 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2505
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2506
2507
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 grid->tree().addLeaf(new LeafT(PartialCreate(), Coord(0, 0, 0)));
2508 1 auto* leaf = grid2->tree().touchLeaf(Coord(0, 0, 0));
2509
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 leaf->setValueOnly(10, 6.4f);
2510
2511 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2512 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2513
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2514
2515
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
2516
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(3.0f, testLeaf->getValue(10));
2517 }
2518
2519 { // merge two leaf nodes from different grids
2520 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2521
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2522
2523
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = grid->tree().touchLeaf(Coord(0, 0, 0));
2524 1 auto* leaf2 = grid2->tree().touchLeaf(Coord(0, 0, 0));
2525
2526 // active state from the voxel with the maximum value preserved
2527
2528
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(5, 98.0f);
2529
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf2->setValueOnly(5, 2.0f);
2530 leaf2->setValueOn(5);
2531
2532
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(7, 2.0f);
2533 leaf->setValueOn(7);
2534
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(7, 100.0f);
2535
2536
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(9, 4.0f);
2537 leaf->setValueOn(9);
2538
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 leaf2->setValueOnly(9, -100.0f);
2539
2540 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->tree(), Steal());
2541 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2542
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2543
2544
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = grid->tree().probeConstLeaf(Coord(0, 0, 0));
2545
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(98.0f, testLeaf->getValue(5));
2546
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!testLeaf->isValueOn(5));
2547
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2.0f, testLeaf->getValue(7));
2548
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(testLeaf->isValueOn(7));
2549
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(100.0f, testLeaf->getValue(9));
2550
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(!testLeaf->isValueOn(9));
2551 }
2552
2553 { // merge a leaf node into a grid with an inside tile from a const tree
2554 1 FloatGrid::Ptr grid = createLevelSet<FloatGrid>();
2555
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 grid->tree().addTile(1, Coord(0, 0, 0), -1.3f, true);
2556
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
2557
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 grid2->tree().touchLeaf(Coord(0, 0, 0));
2558
2559
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(0), grid->tree().leafCount());
2560
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
2561
2562 tools::CsgDifferenceOp<FloatTree> mergeOp(grid2->constTree(), DeepCopy());
2563 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(grid->tree());
2564
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2565
2566
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid->tree().leafCount());
2567
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index32(1), grid2->tree().leafCount());
2568 }
2569 1 }
2570
2571
2572
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestMerge, testSum)
2573 {
2574 using RootChildType = FloatTree::RootNodeType::ChildNodeType;
2575 using LeafT = FloatTree::LeafNodeType;
2576
2577 { // construction
2578 2 FloatTree tree1;
2579 2 FloatTree tree2;
2580 2 const FloatTree tree3;
2581
2582 { // one non-const tree (steal)
2583
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree1, Steal());
2584
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2585 }
2586 { // one non-const tree (deep-copy)
2587
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree1, DeepCopy());
2588
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2589 }
2590 { // one const tree (deep-copy)
2591
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, DeepCopy());
2592
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), mergeOp.size());
2593 }
2594 { // vector of tree pointers
2595
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
2596
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(trees, Steal());
2597
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp.size());
2598 }
2599 { // deque of tree pointers
2600
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::deque<FloatTree*> trees{&tree1, &tree2};
2601
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(trees, DeepCopy());
2602
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp.size());
2603 }
2604 { // vector of TreesToMerge (to mix const and non-const trees)
2605 1 std::vector<tools::TreeToMerge<FloatTree>> trees;
2606
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 trees.emplace_back(tree1, Steal());
2607
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 trees.emplace_back(tree3, DeepCopy()); // const tree
2608
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 trees.emplace_back(tree2, Steal());
2609 tools::SumMergeOp<FloatTree> mergeOp(trees);
2610
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(3), mergeOp.size());
2611 }
2612 { // implicit copy constructor
2613
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
2614
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(trees, Steal());
2615 tools::SumMergeOp<FloatTree> mergeOp2(mergeOp);
2616
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp2.size());
2617 }
2618 { // implicit assignment operator
2619
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree1, &tree2};
2620
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(trees, Steal());
2621 tools::SumMergeOp<FloatTree> mergeOp2 = mergeOp;
2622
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), mergeOp2.size());
2623 }
2624 }
2625
2626 { // merge two different background root tiles from one tree into an empty tree
2627 2 FloatTree tree, tree2;
2628
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree2.root().addTile(Coord(0, 0, 0), tree2.background(), false);
2629
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree2.root().addTile(Coord(8192, 0, 0), tree2.background(), true);
2630
2631 const auto& root2 = tree2.root();
2632
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), root2.getTableSize());
2633
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(root2));
2634
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(root2));
2635
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root2));
2636
2637
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2638 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2639
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2640
2641 // background tiles are not erased
2642
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), tree.root().getTableSize());
2643 }
2644
2645 { // merge two different root tiles from one tree into an empty tree
2646 2 FloatTree tree, tree2;
2647
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(0, 0, 0), 1.1f, false);
2648
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(8192, 0, 0), 2.2f, true);
2649
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(tree2.root()));
2650
2651
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2652 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2653
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2654
2655
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(2), tree.root().getTableSize());
2656
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(tree.root()));
2657
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(tree.root()));
2658 }
2659
2660 { // merge two different root tiles from one tree into a tree with one root tile
2661 2 FloatTree tree, tree2;
2662
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addTile(Coord(-8192, 0, 0), -3.3f, true);
2663
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(0, 0, 0), 1.1f, false);
2664
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(8192, 0, 0), 2.2f, true);
2665
2666
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(tree.root()));
2667
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(tree2.root()));
2668
2669
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2670 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2671
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2672
2673 const auto& root = tree.root();
2674
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(3), root.getTableSize());
2675
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getActiveTileCount(root));
2676
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getInactiveTileCount(root));
2677 1 auto iter = root.cbeginValueAll();
2678
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-3.3f, *iter);
2679
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2680 ++iter;
2681
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(1.1f, *iter);
2682
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOff());
2683 ++iter;
2684
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2.2f, *iter);
2685
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2686 }
2687
2688 { // merge root tiles with the same active state
2689 2 FloatTree tree, tree2;
2690
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addTile(Coord(0, 0, 0), 1.1f, false);
2691
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(0, 0, 0), 2.2f, false);
2692
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addTile(Coord(8192, 0, 0), 1.1f, true);
2693
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(8192, 0, 0), 2.2f, true);
2694
2695
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(tree.root()));
2696
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(tree2.root()));
2697
2698
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2699 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2700
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2701
2702 const auto& root = tree.root();
2703
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getActiveTileCount(root));
2704 1 auto iter = root.cbeginValueAll();
2705
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(1.1f+2.2f, *iter);
2706
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOff());
2707 ++iter;
2708
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(1.1f+2.2f, *iter);
2709
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2710 }
2711
2712 { // merge root tiles with different active state
2713 2 FloatTree tree, tree2;
2714
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addTile(Coord(0, 0, 0), 1.1f, false);
2715
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(0, 0, 0), 2.2f, true);
2716
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addTile(Coord(8192, 0, 0), 1.1f, true);
2717
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(8192, 0, 0), 2.2f, false);
2718
2719
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(tree.root()));
2720
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(tree2.root()));
2721
2722
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2723 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2724
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2725
2726 const auto& root = tree.root();
2727
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getActiveTileCount(root));
2728 1 auto iter = root.cbeginValueAll();
2729
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(1.1f+2.2f, *iter);
2730
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2731 ++iter;
2732
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(1.1f+2.2f, *iter);
2733
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2734 }
2735
2736 { // merge root tiles from three trees
2737 2 FloatTree tree, tree2, tree3;
2738
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addTile(Coord(0, 0, 0), 1.1f, false);
2739
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(0, 0, 0), 2.2f, false);
2740
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree3.root().addTile(Coord(0, 0, 0), 3.3f, false);
2741
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(8192, 0, 0), 2.2f, false);
2742
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree3.root().addTile(Coord(8192, 0, 0), 3.3f, true);
2743
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree3.root().addTile(Coord(-8192, 0, 0), -9.9f, false);
2744
2745
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(1), getTileCount(tree.root()));
2746
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(2), getTileCount(tree2.root()));
2747
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(3), getTileCount(tree3.root()));
2748
2749
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<FloatTree*> trees{&tree2, &tree3};
2750
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(trees, Steal());
2751 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2752
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2753
2754 const auto& root = tree.root();
2755 1 auto iter = root.cbeginValueAll();
2756
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-9.9f, *iter);
2757
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOff());
2758 ++iter;
2759
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(1.1f+2.2f+3.3f, *iter);
2760
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOff());
2761 ++iter;
2762
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2.2f+3.3f, *iter);
2763
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2764 }
2765
2766 { // merge root tiles and root children
2767 2 FloatTree tree, tree2;
2768
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree.root().addTile(Coord(0, 0, 0), 1.1f, false);
2769
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 tree2.root().addChild(new RootChildType(Coord(0, 0, 0), 2.2f, false));
2770
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree.root().addTile(Coord(8192, 0, 0), 1.1f, false);
2771
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 tree2.root().addChild(new RootChildType(Coord(8192, 0, 0), 2.2f, true));
2772
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree.root().addTile(Coord(16384, 0, 0), 1.1f, true);
2773
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 tree2.root().addChild(new RootChildType(Coord(16384, 0, 0), 2.2f, false));
2774
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 tree.root().addChild(new RootChildType(Coord(24576, 0, 0), 1.1f, false));
2775
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree2.root().addTile(Coord(24576, 0, 0), 2.2f, false);
2776
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 tree.root().addChild(new RootChildType(Coord(32768, 0, 0), 1.1f, true));
2777
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree2.root().addTile(Coord(32768, 0, 0), 2.2f, false);
2778
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 tree.root().addChild(new RootChildType(Coord(40960, 0, 0), 1.1f, false));
2779
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(40960, 0, 0), 2.2f, true);
2780
2781
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(3), getTileCount(tree.root()));
2782
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(3), getTileCount(tree2.root()));
2783
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(3), getChildCount(tree.root()));
2784
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(3), getChildCount(tree2.root()));
2785
2786
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2787 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2788
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2789
2790 const auto& root = tree.root();
2791
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(6), getChildCount(root));
2792
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
2793 1 auto iter = root.cbeginChildOn();
2794
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2795
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
2796 ++iter;
2797
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2798
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(0));
2799 ++iter;
2800
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2801
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(0));
2802 ++iter;
2803
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2804
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
2805 ++iter;
2806
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2807
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(0));
2808 ++iter;
2809
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2810
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(0));
2811 }
2812
2813 { // merge root children
2814 2 FloatTree tree, tree2;
2815
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 tree.root().addChild(new RootChildType(Coord(0, 0, 0), 1.1f, false));
2816
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 tree2.root().addChild(new RootChildType(Coord(0, 0, 0), 2.2f, false));
2817
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 tree.root().addChild(new RootChildType(Coord(8192, 0, 0), 1.1f, false));
2818
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 tree2.root().addChild(new RootChildType(Coord(8192, 0, 0), 2.2f, true));
2819
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 tree.root().addChild(new RootChildType(Coord(16384, 0, 0), 1.1f, true));
2820
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 tree2.root().addChild(new RootChildType(Coord(16384, 0, 0), 2.2f, false));
2821
2822
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree.root()));
2823
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree2.root()));
2824
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(3), getChildCount(tree.root()));
2825
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(3), getChildCount(tree2.root()));
2826
2827
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2828 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2829
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2830
2831 const auto& root = tree.root();
2832
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(3), getChildCount(root));
2833
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
2834 1 auto iter = root.cbeginChildOn();
2835
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2836
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
2837 ++iter;
2838
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2839
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(0));
2840 ++iter;
2841
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1.1f+2.2f, iter->getFirstValue());
2842
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(0));
2843 }
2844
2845 { // merge root children tiles
2846 2 FloatTree tree, tree2;
2847
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* child = new RootChildType(Coord(0, 0, 0), 0.0f, false);
2848 1 child->addTile(0, 1.1f, false);
2849 1 child->addTile(1, 2.2f, true);
2850 1 child->addTile(2, 3.3f, false);
2851
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addChild(child);
2852
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 child = new RootChildType(Coord(0, 0, 0), 2.2f, false);
2853 1 child->addTile(0, 4.4f, false);
2854 1 child->addTile(1, 5.5f, false);
2855 1 child->addTile(2, 6.6f, true);
2856
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addChild(child);
2857
2858
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2859 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2860
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2861
2862 const auto& root = tree.root();
2863
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index(1), getChildCount(root));
2864
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(root));
2865
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 auto iter = root.cbeginChildOn()->cbeginValueAll();
2866
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(1.1f+4.4f, *iter);
2867
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_FALSE(iter.isValueOn());
2868 ++iter;
2869
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2.2f+5.5f, *iter);
2870
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2871 ++iter;
2872
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(3.3f+6.6f, *iter);
2873
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(iter.isValueOn());
2874 }
2875
2876 /////////////////////////////////////////////////////////////////////////
2877
2878 { // test merging leaf nodes
2879
2880 { // merge a leaf node into an empty tree
2881 2 FloatTree tree, tree2;
2882 1 auto* leaf = tree2.touchLeaf(Coord(0, 0, 0));
2883
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(10, -2.3f);
2884
2885
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2886 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2887
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2888
2889
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
2890
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(tree.cbeginLeaf()->getFirstValue(), 0.0f);
2891 }
2892
2893 { // merge a leaf node into a tree with a tile
2894 2 FloatTree tree, tree2;
2895
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree.root().addTile(Coord(0, 0, 0), 10.0f, false);
2896 1 auto* leaf = tree2.touchLeaf(Coord(0, 0, 0));
2897
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(10, -2.3f);
2898
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOn(11, 1.5f);
2899
2900
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2901 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2902
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2903
2904
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
2905
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree.root()));
2906 auto iter = tree.cbeginLeaf();
2907
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(0), 10.0f);
2908
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
2909
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(10), 10.0f-2.3f);
2910
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(10));
2911
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(11), 10.0f+1.5f);
2912
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(11));
2913 }
2914
2915 { // merge a tile into a tree with a leaf node
2916 2 FloatTree tree, tree2;
2917 1 auto* leaf = tree.touchLeaf(Coord(0, 0, 0));
2918
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(10, -2.3f);
2919
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOn(11, 1.5f);
2920
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().addTile(Coord(0, 0, 0), 10.0f, false);
2921
2922
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, DeepCopy());
2923 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2924
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2925
2926
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
2927
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree.root()));
2928 auto iter = tree.cbeginLeaf();
2929
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(0), 10.0f);
2930
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
2931
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(10), 10.0f-2.3f);
2932
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(10));
2933
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(11), 10.0f+1.5f);
2934
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(11));
2935 }
2936
2937 { // merge a root child tile into a tree with a leaf node
2938 2 FloatTree tree, tree2;
2939 1 auto* leaf = tree.touchLeaf(Coord(0, 0, 0));
2940
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(10, -2.3f);
2941
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 leaf->setValueOn(11, 1.5f);
2942
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 tree2.root().addChild(new RootChildType(Coord(0, 0, 0), 10.0f, true));
2943
2944
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2945 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2946
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2947
2948
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
2949
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree.root()));
2950 auto iter = tree.cbeginLeaf();
2951
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(0), 10.0f);
2952
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(0));
2953
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(10), 10.0f-2.3f);
2954
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(10));
2955
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(11), 10.0f+1.5f);
2956
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(11));
2957 }
2958
2959 { // merge an empty tree with non-zero background value into a tree with a leaf node
2960 2 FloatTree tree, tree2;
2961 1 auto* leaf = tree.touchLeaf(Coord(0, 0, 0));
2962
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(10, -2.3f);
2963
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOn(11, 1.5f);
2964
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.root().setBackground(10.0f, /*updateChildNodes=*/false);
2965
2966
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2967 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2968
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2969
2970
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
2971
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree.root()));
2972 auto iter = tree.cbeginLeaf();
2973
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(0), 10.0f);
2974
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
2975
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(10), 10.0f-2.3f);
2976
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(10));
2977
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(iter->getValue(11), 10.0f+1.5f);
2978
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(11));
2979 }
2980
2981 { // merge a leaf node into a grid with a partially constructed leaf node
2982 2 FloatTree tree, tree2;
2983
2984
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 tree.addLeaf(new LeafT(PartialCreate(), Coord(0, 0, 0)));
2985 1 auto* leaf = tree2.touchLeaf(Coord(0, 0, 0));
2986
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(10, -2.3f);
2987
2988
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<FloatTree> mergeOp(tree2, Steal());
2989 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
2990
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
2991
2992
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = tree.probeConstLeaf(Coord(0, 0, 0));
2993
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(-2.3f, testLeaf->getValue(10));
2994 }
2995
2996 { // merge three leaf nodes from different grids
2997 2 DoubleTree tree, tree2, tree3;
2998
2999
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = tree.touchLeaf(Coord(0, 0, 0));
3000
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf2 = tree2.touchLeaf(Coord(0, 0, 0));
3001 1 auto* leaf3 = tree3.touchLeaf(Coord(0, 0, 0));
3002
3003 // active state from the voxel with the minimum value preserved
3004
3005
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(5, 0.7);
3006
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf2->setValueOnly(5, 0.2);
3007 leaf2->setValueOn(5);
3008
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(5, 0.1);
3009
3010
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 leaf->setValueOnly(7, 0.2);
3011 leaf->setValueOn(7);
3012
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(7, 0.1);
3013
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(7, 0.7);
3014
3015
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(9, 0.7);
3016
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf2->setValueOnly(9, 0.1);
3017
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf3->setValueOnly(9, 0.2);
3018
3019
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<DoubleTree*> trees{&tree2, &tree3};
3020
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<DoubleTree> mergeOp(trees, Steal());
3021 1 tree::DynamicNodeManager<DoubleTree, 3> nodeManager(tree);
3022
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
3023
3024 // non-associativity of floating-point addition
3025
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NE(0.7 + 0.2 + 0.1, 0.7 + 0.1 + 0.2);
3026
3027 // order of additions must be preserved
3028
3029
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const auto* testLeaf = tree.probeConstLeaf(Coord(0, 0, 0));
3030
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(0.7 + 0.2 + 0.1, testLeaf->getValue(5));
3031
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(testLeaf->isValueOn(5));
3032
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(0.2 + 0.1 + 0.7, testLeaf->getValue(7));
3033
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(testLeaf->isValueOn(7));
3034
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(0.7 + 0.1 + 0.2, testLeaf->getValue(9));
3035
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(testLeaf->isValueOn(9));
3036 }
3037
3038 { // merge a leaf node into an empty grid from a const grid
3039 2 FloatTree tree, tree2;
3040
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.root().addTile(Coord(0, 0, 0), 1.0f, false);
3041
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 FloatGrid::Ptr grid2 = createLevelSet<FloatGrid>();
3042
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree2.touchLeaf(Coord(0, 0, 0));
3043
3044
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(0), tree.leafCount());
3045
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(Index32(1), tree2.leafCount());
3046
3047 // merge from a const tree
3048
3049 const FloatTree& constTree2 = tree2;
3050
3051 1 std::vector<tools::TreeToMerge<FloatTree>> treesToMerge;
3052
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 treesToMerge.emplace_back(constTree2, DeepCopy());
3053 tools::SumMergeOp<FloatTree> mergeOp(treesToMerge);
3054 1 tree::DynamicNodeManager<FloatTree, 3> nodeManager(tree);
3055
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
3056
3057
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
3058 // leaf has been deep copied not stolen
3059
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree2.leafCount());
3060 }
3061 }
3062
3063 { // test a Vec3STree
3064 2 Vec3STree tree, tree2;
3065
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree.root().addTile(Coord(0, 0, 0), Vec3s(1.0f, 2.0f, 3.0f), false);
3066
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto* leaf = tree2.touchLeaf(Coord(0, 0, 0));
3067
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf->setValueOnly(10, Vec3s(0.1f, 0.2f, 0.3f));
3068 leaf->setValueOn(11, Vec3s(0.4f, 0.5f, 0.6f));
3069
3070
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<Vec3STree> mergeOp(tree2, Steal());
3071 1 tree::DynamicNodeManager<Vec3STree, 3> nodeManager(tree);
3072
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
3073
3074
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
3075
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree.root()));
3076 auto iter = tree.cbeginLeaf();
3077
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(iter->getValue(0), Vec3s(1.0f, 2.0f, 3.0f));
3078
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
3079
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(iter->getValue(10), Vec3s(1.0f+0.1f, 2.0f+0.2f, 3.0f+0.3f));
3080
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(10));
3081
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(iter->getValue(11), Vec3s(1.0f+0.4f, 2.0f+0.5f, 3.0f+0.6f));
3082
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(11));
3083 }
3084
3085 { // test a MaskTree
3086 2 MaskTree tree, tree2;
3087
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 tree.root().addTile(Coord(0, 0, 0), false, false);
3088 1 auto* leaf = tree2.touchLeaf(Coord(0, 0, 0));
3089 leaf->setValueOnly(10, true);
3090
3091
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::SumMergeOp<MaskTree> mergeOp(tree2, Steal());
3092 1 tree::DynamicNodeManager<MaskTree, 3> nodeManager(tree);
3093
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 nodeManager.foreachTopDown(mergeOp);
3094
3095
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(Index32(1), tree.leafCount());
3096
2/16
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
1 EXPECT_EQ(Index(0), getTileCount(tree.root()));
3097 auto iter = tree.cbeginLeaf();
3098
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_FALSE(iter->isValueOn(0));
3099
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(iter->isValueOn(10));
3100 }
3101 1 }
3102