Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright Contributors to the OpenVDB Project | ||
2 | // SPDX-License-Identifier: MPL-2.0 | ||
3 | |||
4 | #include <openvdb/Types.h> | ||
5 | #include <openvdb/openvdb.h> | ||
6 | #include <openvdb/tools/Morphology.h> | ||
7 | #include <openvdb/tools/LevelSetUtil.h> | ||
8 | #include <openvdb/tools/LevelSetSphere.h> | ||
9 | #include <openvdb/util/Util.h> | ||
10 | |||
11 | #include <gtest/gtest.h> | ||
12 | |||
13 | |||
14 | template<typename TreeT, openvdb::tools::NearestNeighbors NN> | ||
15 | class TestMorphologyInternal | ||
16 | { | ||
17 | public: | ||
18 | static void testMorphActiveLeafValues(); // only tests the IGNORE_TILES policy | ||
19 | static void testMorphActiveValues(); | ||
20 | }; | ||
21 | |||
22 | using TDFF = TestMorphologyInternal<openvdb::FloatTree, openvdb::tools::NN_FACE>; | ||
23 | using TDFE = TestMorphologyInternal<openvdb::FloatTree, openvdb::tools::NN_FACE_EDGE>; | ||
24 | using TDFV = TestMorphologyInternal<openvdb::FloatTree, openvdb::tools::NN_FACE_EDGE_VERTEX>; | ||
25 | using TDMF = TestMorphologyInternal<openvdb::MaskTree, openvdb::tools::NN_FACE>; | ||
26 | using TDME = TestMorphologyInternal<openvdb::MaskTree, openvdb::tools::NN_FACE_EDGE>; | ||
27 | using TDMV = TestMorphologyInternal<openvdb::MaskTree, openvdb::tools::NN_FACE_EDGE_VERTEX>; | ||
28 | |||
29 | 14 | class TestMorphology : public ::testing::Test {}; | |
30 | |||
31 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testFloatFaceActiveLeafValues) { TDFF::testMorphActiveLeafValues(); } |
32 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testFloatFaceActiveValues) { TDFF::testMorphActiveValues(); } |
33 | |||
34 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testFloatEdgeActiveLeafValues) { TDFE::testMorphActiveLeafValues(); } |
35 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testFloatEdgeActiveValues) { TDFE::testMorphActiveValues(); } |
36 | |||
37 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testFloatVertexActiveLeafValues) { TDFV::testMorphActiveLeafValues(); } |
38 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testFloatVertexActiveValues) { TDFV::testMorphActiveValues(); } |
39 | |||
40 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testMaskFaceActiveLeafValues) { TDMF::testMorphActiveLeafValues(); } |
41 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testMaskFaceActiveValues) { TDMF::testMorphActiveValues(); } |
42 | |||
43 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testMaskEdgeActiveLeafValues) { TDME::testMorphActiveLeafValues(); } |
44 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testMaskEdgeActiveValues) { TDME::testMorphActiveValues(); } |
45 | |||
46 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testMaskVertexActiveLeafValues) { TDMV::testMorphActiveLeafValues(); } |
47 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | TEST_F(TestMorphology, testMaskVertexActiveValues) { TDMV::testMorphActiveValues(); } |
48 | |||
49 | template<typename TreeT, openvdb::tools::NearestNeighbors NN> | ||
50 | void | ||
51 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | TestMorphologyInternal<TreeT, NN>::testMorphActiveLeafValues() |
52 | { | ||
53 | using openvdb::Coord; | ||
54 | using openvdb::Index32; | ||
55 | using openvdb::Index64; | ||
56 | using ValueType = typename TreeT::ValueType; | ||
57 | |||
58 | size_t offsets = 0; | ||
59 | if (NN == openvdb::tools::NN_FACE) offsets = 6; | ||
60 | if (NN == openvdb::tools::NN_FACE_EDGE) offsets = 18; | ||
61 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) offsets = 26; | ||
62 | |||
63 | const Coord* const start = openvdb::util::COORD_OFFSETS; | ||
64 | const Coord* const end = start + offsets; | ||
65 | |||
66 | // Small methods to check neighbour activity from an xyz coordinate. Recurse | ||
67 | // parameter allows for recursively checking the acitvity of the xyz | ||
68 | // neighbours, with recurse=0 only checking the immediate neighbours. | ||
69 | std::function<void(const TreeT&, const Coord&, const size_t)> CheckActiveNeighbours; | ||
70 |
1/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
2358368 | CheckActiveNeighbours = [start, end, &CheckActiveNeighbours] |
71 | (const TreeT& acc, const Coord& xyz, const size_t recurse) | ||
72 | { | ||
73 |
6/96✗ Branch 0 not taken.
✓ Branch 1 taken 475807 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.
✗ Branch 24 not taken.
✓ Branch 25 taken 111695 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 2087 times.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✓ Branch 73 taken 475807 times.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✓ Branch 97 taken 111695 times.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✓ Branch 121 taken 2087 times.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
|
1179178 | EXPECT_TRUE(acc.isValueOn(xyz)); |
74 | 1179178 | const Coord* offset(start); | |
75 |
12/12✓ Branch 0 taken 12370982 times.
✓ Branch 1 taken 475807 times.
✓ Branch 2 taken 2010510 times.
✓ Branch 3 taken 111695 times.
✓ Branch 4 taken 12522 times.
✓ Branch 5 taken 2087 times.
✓ Branch 6 taken 12370982 times.
✓ Branch 7 taken 475807 times.
✓ Branch 8 taken 2010510 times.
✓ Branch 9 taken 111695 times.
✓ Branch 10 taken 12522 times.
✓ Branch 11 taken 2087 times.
|
29967206 | while (offset != end) { |
76 | // optionally recurse into neighbour voxels | ||
77 | 28788028 | const Coord ijk = xyz + *offset; | |
78 |
12/12✓ Branch 0 taken 475280 times.
✓ Branch 1 taken 11895702 times.
✓ Branch 3 taken 111168 times.
✓ Branch 4 taken 1899342 times.
✓ Branch 6 taken 1560 times.
✓ Branch 7 taken 10962 times.
✓ Branch 9 taken 475280 times.
✓ Branch 10 taken 11895702 times.
✓ Branch 12 taken 111168 times.
✓ Branch 13 taken 1899342 times.
✓ Branch 15 taken 1560 times.
✓ Branch 16 taken 10962 times.
|
28788028 | if (recurse > 0) CheckActiveNeighbours(acc, ijk, recurse-1); |
79 |
6/96✗ Branch 1 not taken.
✓ Branch 2 taken 12370982 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.
✗ Branch 26 not taken.
✓ Branch 27 taken 2010510 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 12522 times.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✓ Branch 77 taken 12370982 times.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 101 not taken.
✓ Branch 102 taken 2010510 times.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✓ Branch 127 taken 12522 times.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
|
28788028 | EXPECT_TRUE(acc.isValueOn(ijk)); |
80 | 28788028 | ++offset; | |
81 | } | ||
82 | }; | ||
83 | |||
84 | 3144 | auto CheckInactiveNeighbours = [start, end] | |
85 | (const TreeT& acc, const Coord& xyz) { | ||
86 | 3132 | const Coord* offset(start); | |
87 |
12/12✓ Branch 0 taken 13572 times.
✓ Branch 1 taken 522 times.
✓ Branch 2 taken 9396 times.
✓ Branch 3 taken 522 times.
✓ Branch 4 taken 3132 times.
✓ Branch 5 taken 522 times.
✓ Branch 6 taken 13572 times.
✓ Branch 7 taken 522 times.
✓ Branch 8 taken 9396 times.
✓ Branch 9 taken 522 times.
✓ Branch 10 taken 3132 times.
✓ Branch 11 taken 522 times.
|
55332 | while (offset != end) { |
88 |
6/96✗ Branch 1 not taken.
✓ Branch 2 taken 13572 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.
✗ Branch 26 not taken.
✓ Branch 27 taken 9396 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 3132 times.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✓ Branch 77 taken 13572 times.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 101 not taken.
✓ Branch 102 taken 9396 times.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✓ Branch 127 taken 3132 times.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
|
52200 | EXPECT_TRUE(acc.isValueOff(xyz + *offset)); |
89 | 52200 | ++offset; | |
90 | } | ||
91 | }; | ||
92 | |||
93 | constexpr bool IsMask = std::is_same<ValueType, bool>::value; | ||
94 | 24 | TreeT tree(IsMask ? 0.0 : -1.0); | |
95 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.empty()); |
96 | |||
97 | const openvdb::Index leafDim = TreeT::LeafNodeType::DIM; | ||
98 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(1 << 3, int(leafDim)); |
99 | |||
100 | { // Set and dilate a single voxel at the center of a leaf node. | ||
101 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
102 | const Coord xyz(leafDim >> 1); | ||
103 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | tree.setValue(xyz, ValueType(1.0)); |
104 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.isValueOn(xyz)); |
105 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeVoxelCount()); |
106 | // dilate | ||
107 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
108 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz, 0); |
109 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1 + offsets), tree.activeVoxelCount()); |
110 | // erode | ||
111 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
112 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckInactiveNeighbours(tree, xyz); |
113 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeVoxelCount()); |
114 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
115 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(0), tree.activeVoxelCount()); |
116 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(1), tree.leafCount()); |
117 | // check values | ||
118 | if (!IsMask) { | ||
119 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
12 | EXPECT_EQ(tree.getValue(xyz), ValueType(1.0)); |
120 | const Coord* offset(start); | ||
121 |
4/18✓ Branch 0 taken 50 times.
✓ Branch 1 taken 3 times.
✓ Branch 3 taken 50 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 50 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.
|
206 | while (offset != end) EXPECT_EQ(tree.getValue(xyz + *offset++), ValueType(-1.0)); |
122 | } | ||
123 | } | ||
124 | { // Create an active, leaf node-sized tile and a single edge/corner voxel | ||
125 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
126 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
24 | tree.addTile(/*level*/1, Coord(0), ValueType(1.0), true); |
127 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(0), tree.leafCount()); |
128 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); |
129 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
130 | |||
131 | const Coord xyz(leafDim, leafDim - 1, leafDim - 1); | ||
132 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.setValue(xyz, ValueType(1.0)); |
133 | |||
134 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = leafDim * leafDim * leafDim + 1; |
135 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
136 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
137 | |||
138 | // dilate | ||
139 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
140 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz, 0); |
141 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE) expected += 5; // 1 overlapping with tile |
142 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE) expected += 15; // 3 overlapping |
143 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += 22; // 4 overlapping |
144 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
145 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
146 | Index32 leafs; | ||
147 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE) leafs = 3; |
148 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE) leafs = 6; |
149 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) leafs = 7; |
150 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(leafs, tree.leafCount()); |
151 | |||
152 | // erode | ||
153 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
154 | // tile should be umodified | ||
155 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | expected = leafDim * leafDim * leafDim + 1; |
156 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
157 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(leafs, tree.leafCount()); |
158 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
159 | // | ||
160 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
161 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
162 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(leafs, tree.leafCount()); |
163 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | expected = leafDim * leafDim * leafDim; |
164 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
165 | // erode again, only 1 active tile, should be no change | ||
166 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT copy(tree); |
167 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
168 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.hasSameTopology(tree)); |
169 | // check values | ||
170 | if (!IsMask) { | ||
171 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
12 | EXPECT_EQ(tree.getValue(xyz), ValueType(1.0)); |
172 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
12 | EXPECT_EQ(tree.getValue(Coord(0)), ValueType(1.0)); |
173 | } | ||
174 | } | ||
175 | { // Set and dilate a single voxel at each of the eight corners of a leaf node. | ||
176 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 6 times.
|
108 | for (int i = 0; i < 8; ++i) { |
177 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
96 | tree.clear(); |
178 | 288 | const Coord xyz( | |
179 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
|
96 | i & 1 ? leafDim - 1 : 0, |
180 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
|
96 | i & 2 ? leafDim - 1 : 0, |
181 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
|
96 | i & 4 ? leafDim - 1 : 0); |
182 |
2/4✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 48 times.
✗ Branch 5 not taken.
|
192 | tree.setValue(xyz, ValueType(1.0)); |
183 |
2/16✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 48 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.
|
96 | EXPECT_EQ(Index64(1), tree.activeVoxelCount()); |
184 | // dilate | ||
185 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
96 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
186 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
96 | CheckActiveNeighbours(tree, xyz, 0); |
187 |
2/16✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 48 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.
|
96 | EXPECT_EQ(Index64(1 + offsets), tree.activeVoxelCount()); |
188 | // erode | ||
189 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
96 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
190 |
1/2✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
|
96 | CheckInactiveNeighbours(tree, xyz); |
191 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 48 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.
|
96 | EXPECT_TRUE(tree.isValueOn(xyz)); |
192 |
2/16✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 48 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.
|
96 | EXPECT_EQ(Index64(1), tree.activeVoxelCount()); |
193 | // check values | ||
194 | if (!IsMask) { | ||
195 |
2/16✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24 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.
|
96 | EXPECT_EQ(tree.getValue(xyz), ValueType(1.0)); |
196 | const Coord* offset(start); | ||
197 |
4/18✓ Branch 0 taken 400 times.
✓ Branch 1 taken 24 times.
✓ Branch 3 taken 400 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 400 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.
|
1648 | while (offset != end) EXPECT_EQ(tree.getValue(xyz + *offset++), ValueType(-1.0)); |
198 | } | ||
199 | } | ||
200 | } | ||
201 | { // 3 neighbouring voxels | ||
202 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
203 | const Coord xyz1(0), xyz2(1,0,0), xyz3(-1,0,0); | ||
204 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.setValue(xyz1, ValueType(1.0)); |
205 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.setValue(xyz2, ValueType(1.0)); |
206 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.setValue(xyz3, ValueType(1.0)); |
207 | |||
208 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = 3; |
209 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
210 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
211 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz1, 0); |
212 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz2, 0); |
213 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz3, 0); |
214 | |||
215 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE) expected += (6* 3)-4; // dilation - overlapping |
216 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE) expected += (18*3)-20; // dilation - overlapping |
217 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += (26*3)-36; // dilation - overlapping |
218 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
219 | |||
220 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
221 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | expected = 3; |
222 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
223 | // check values | ||
224 | if (!IsMask) { | ||
225 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
12 | EXPECT_EQ(tree.getValue(xyz1), ValueType(1.0)); |
226 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
12 | EXPECT_EQ(tree.getValue(xyz2), ValueType(1.0)); |
227 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
12 | EXPECT_EQ(tree.getValue(xyz3), ValueType(1.0)); |
228 | } | ||
229 | } | ||
230 | { // Perform repeated dilations, starting with a single voxel. | ||
231 | struct Info { int activeVoxelCount, leafCount, nonLeafCount; }; | ||
232 | 12 | Info iterInfo[33] = { | |
233 | /* FACE EDGE VERTEX */ | ||
234 | { 1, 1, 3 }, { 1, 1, 3 }, { 1, 1, 3 }, | ||
235 | { 7, 1, 3 }, { 19, 1, 3 }, { 27, 1, 3 }, | ||
236 | { 25, 1, 3 }, { 93, 1, 3 }, { 125, 1, 3 }, | ||
237 | { 63, 1, 3 }, { 263, 1, 3 }, { 343, 1, 3 }, | ||
238 | { 129, 4, 3 }, { 569, 7, 3 }, { 729, 8, 3 }, | ||
239 | { 231, 7, 9 }, { 1051, 19, 15 }, { 1331, 27, 17 }, | ||
240 | { 377, 7, 9 }, { 1749, 20, 15 }, { 2197, 27, 17 }, | ||
241 | { 575, 7, 9 }, { 2703, 26, 15 }, { 3375, 27, 17 }, | ||
242 | { 833, 10, 9 }, { 3953, 27, 17 }, { 4913, 27, 17 }, | ||
243 | { 1159, 16, 9 }, { 5539, 27, 17 }, { 6859, 27, 17 }, | ||
244 | { 1561, 19, 15 }, { 7501, 27, 17 }, { 9261, 27, 17 }, | ||
245 | }; | ||
246 | |||
247 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
248 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
24 | tree.setValue(Coord(leafDim >> 1), ValueType(1.0)); |
249 | |||
250 | int offset = 0; | ||
251 | if (NN == openvdb::tools::NN_FACE_EDGE) offset = 1; | ||
252 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) offset = 2; | ||
253 | int i = offset; | ||
254 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(iterInfo[i].activeVoxelCount, int(tree.activeVoxelCount())); |
255 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(iterInfo[i].leafCount, int(tree.leafCount())); |
256 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(iterInfo[i].nonLeafCount, int(tree.nonLeafCount())); |
257 | |||
258 | // dilate | ||
259 | i+= 3; | ||
260 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 6 times.
|
132 | for (; i < 33; i+=3) { |
261 |
1/2✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
|
120 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
262 |
2/16✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 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.
|
120 | EXPECT_EQ(iterInfo[i].activeVoxelCount, int(tree.activeVoxelCount())); |
263 |
2/16✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 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.
|
120 | EXPECT_EQ(iterInfo[i].leafCount, int(tree.leafCount())); |
264 |
2/16✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 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.
|
120 | EXPECT_EQ(iterInfo[i].nonLeafCount, int(tree.nonLeafCount())); |
265 | } | ||
266 | // erode | ||
267 | 12 | i-= 6; | |
268 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 60 times.
|
132 | for (; i >= 0; i-=3) { |
269 |
1/2✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
|
120 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
270 | // also prune inactive to clear up empty nodes | ||
271 |
1/2✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
|
120 | openvdb::tools::pruneInactive(tree); |
272 |
2/16✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 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.
|
120 | EXPECT_EQ(iterInfo[i].activeVoxelCount, int(tree.activeVoxelCount())); |
273 |
2/16✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 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.
|
120 | EXPECT_EQ(iterInfo[i].leafCount, int(tree.leafCount())); |
274 |
2/16✓ Branch 1 taken 60 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 60 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.
|
120 | EXPECT_EQ(iterInfo[i].nonLeafCount, int(tree.nonLeafCount())); |
275 | } | ||
276 | // try with values as iterations | ||
277 | int j = 0; | ||
278 | i = offset; | ||
279 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 6 times.
|
144 | for (; i < 33; i+=3, ++j) { |
280 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | tree.clear(); |
281 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | tree.setValue(Coord(leafDim >> 1), ValueType(1.0)); |
282 | // dilate | ||
283 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | openvdb::tools::dilateActiveValues(tree, j, NN, openvdb::tools::IGNORE_TILES); |
284 |
2/16✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 66 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.
|
132 | EXPECT_EQ(iterInfo[i].activeVoxelCount, int(tree.activeVoxelCount())); |
285 |
2/16✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 66 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.
|
132 | EXPECT_EQ(iterInfo[i].leafCount, int(tree.leafCount())); |
286 |
2/16✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 66 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.
|
132 | EXPECT_EQ(iterInfo[i].nonLeafCount, int(tree.nonLeafCount())); |
287 | } | ||
288 | // erode | ||
289 | 12 | i-= 3; | |
290 | j = 0; | ||
291 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 6 times.
|
144 | for (; i >= 0; i-=3, ++j) { |
292 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | tree.clear(); |
293 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | tree.setValue(Coord(leafDim >> 1), ValueType(1.0)); |
294 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | openvdb::tools::dilateActiveValues(tree, 10, NN, openvdb::tools::IGNORE_TILES); |
295 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | openvdb::tools::erodeActiveValues(tree, j, NN, openvdb::tools::IGNORE_TILES); |
296 | // also prune inactive to clear up empty nodes | ||
297 |
1/2✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
|
132 | openvdb::tools::pruneInactive(tree); |
298 |
2/16✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 66 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.
|
132 | EXPECT_EQ(iterInfo[i].activeVoxelCount, int(tree.activeVoxelCount())); |
299 |
2/16✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 66 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.
|
132 | EXPECT_EQ(iterInfo[i].leafCount, int(tree.leafCount())); |
300 |
2/16✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 66 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.
|
132 | EXPECT_EQ(iterInfo[i].nonLeafCount, int(tree.nonLeafCount())); |
301 | } | ||
302 | } | ||
303 | { // Test multiple iterations | ||
304 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
305 | const Coord xyz(leafDim >> 1); | ||
306 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | tree.setValue(xyz, ValueType(1.0)); |
307 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.isValueOn(xyz)); |
308 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = 1; |
309 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
310 | |||
311 | 4 | if (NN == openvdb::tools::NN_FACE) expected = 25; | |
312 | 4 | if (NN == openvdb::tools::NN_FACE_EDGE) expected = 93; | |
313 | 4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected = 125; | |
314 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 2, NN, openvdb::tools::IGNORE_TILES); |
315 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz, /*recurse-once*/1); |
316 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
317 | |||
318 | 4 | if (NN == openvdb::tools::NN_FACE) expected = 231; | |
319 | 4 | if (NN == openvdb::tools::NN_FACE_EDGE) expected = 1051; | |
320 | 4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected = 1331; | |
321 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 3, NN, openvdb::tools::IGNORE_TILES); |
322 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz, /*recurse-four-times*/4); |
323 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
324 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 5, NN, openvdb::tools::IGNORE_TILES); |
325 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeVoxelCount()); |
326 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckInactiveNeighbours(tree, xyz); |
327 | } | ||
328 | |||
329 | {// dilate a narrow band of a sphere | ||
330 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
12 | const openvdb::FloatGrid::ConstPtr grid = |
331 | openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(/*radius=*/20, | ||
332 | /*center=*/openvdb::Vec3f(0, 0, 0), | ||
333 | /*dx=*/1.0f, /*halfWidth*/ 3.0f); | ||
334 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | const Index64 count = grid->tree().activeVoxelCount(); |
335 | { | ||
336 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT copy(grid->tree()); |
337 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(copy, 1, NN, openvdb::tools::IGNORE_TILES); |
338 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.activeVoxelCount() > count); |
339 | } | ||
340 | { | ||
341 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT copy(grid->tree()); |
342 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(copy, 1, NN, openvdb::tools::IGNORE_TILES); |
343 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.activeVoxelCount() < count); |
344 | } | ||
345 | } | ||
346 | |||
347 | {// dilate a fog volume of a sphere | ||
348 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
12 | openvdb::FloatGrid::Ptr grid = |
349 | openvdb::tools::createLevelSetSphere<openvdb::FloatGrid>(/*radius=*/20, | ||
350 | /*center=*/openvdb::Vec3f(0, 0, 0), | ||
351 | /*dx=*/1.0f, /*halfWidth*/ 3.0f); | ||
352 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::sdfToFogVolume(*grid); |
353 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | const Index64 count = grid->tree().activeVoxelCount(); |
354 | { | ||
355 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT copy(grid->tree()); |
356 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(copy, 1, NN, openvdb::tools::IGNORE_TILES); |
357 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.activeVoxelCount() > count); |
358 | } | ||
359 | { | ||
360 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT copy(grid->tree()); |
361 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(copy, 1, NN, openvdb::tools::IGNORE_TILES); |
362 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.activeVoxelCount() < count); |
363 | } | ||
364 | } | ||
365 | |||
366 | { // test dilation/erosion at every position inside a 8x8x8 leaf | ||
367 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 6 times.
|
108 | for (int x=0; x<8; ++x) { |
368 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 48 times.
|
864 | for (int y=0; y<8; ++y) { |
369 |
2/2✓ Branch 0 taken 3072 times.
✓ Branch 1 taken 384 times.
|
6912 | for (int z=0; z<8; ++z) { |
370 |
1/2✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
|
6144 | tree.clear(); |
371 | const openvdb::Coord xyz(x,y,z); | ||
372 |
1/2✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
|
12288 | tree.setValue(xyz, ValueType(1.0)); |
373 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 3072 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.
|
6144 | EXPECT_TRUE(tree.isValueOn(xyz)); |
374 |
2/16✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 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.
|
6144 | EXPECT_EQ(Index64(1), tree.activeVoxelCount()); |
375 | // dilate | ||
376 |
1/2✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
|
6144 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
377 |
1/2✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
|
6144 | CheckActiveNeighbours(tree, xyz, 0); |
378 |
2/16✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 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.
|
6144 | EXPECT_EQ(Index64(1 + offsets), tree.activeVoxelCount()); |
379 | //erode | ||
380 |
1/2✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
|
6144 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
381 |
2/16✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3072 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.
|
6144 | EXPECT_EQ(Index64(1), tree.activeVoxelCount()); |
382 |
1/2✓ Branch 1 taken 3072 times.
✗ Branch 2 not taken.
|
6144 | CheckInactiveNeighbours(tree, xyz); |
383 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 3072 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.
|
6144 | EXPECT_TRUE(tree.isValueOn(xyz)); |
384 |
2/16✓ Branch 1 taken 1536 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 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.
|
3072 | if (!IsMask) { EXPECT_EQ(ValueType(1.0), tree.getValue(xyz)); } |
385 | } | ||
386 | } | ||
387 | } | ||
388 | } | ||
389 | 12 | } | |
390 | |||
391 | template<typename TreeT, openvdb::tools::NearestNeighbors NN> | ||
392 | void | ||
393 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | TestMorphologyInternal<TreeT, NN>::testMorphActiveValues() |
394 | { | ||
395 | using openvdb::Coord; | ||
396 | using openvdb::CoordBBox; | ||
397 | using openvdb::Index32; | ||
398 | using openvdb::Index64; | ||
399 | using ValueType = typename TreeT::ValueType; | ||
400 | |||
401 | size_t offsets = 0; | ||
402 | if (NN == openvdb::tools::NN_FACE) offsets = 6; | ||
403 | if (NN == openvdb::tools::NN_FACE_EDGE) offsets = 18; | ||
404 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) offsets = 26; | ||
405 | |||
406 | const Coord* const start = openvdb::util::COORD_OFFSETS; | ||
407 | const Coord* const end = start + offsets; | ||
408 | |||
409 | // Small method to check neighbour activity from an xyz coordinate. Recurse | ||
410 | // parameter allows for recursively checking the acitvity of the xyz | ||
411 | // neighbours, with recurse=0 only checking the immediate neighbours. | ||
412 | std::function<void(const TreeT&, const Coord&, const size_t)> CheckActiveNeighbours; | ||
413 |
1/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
14060 | CheckActiveNeighbours = [start, end, &CheckActiveNeighbours] |
414 | (const TreeT& acc, const Coord& xyz, const size_t recurse) | ||
415 | { | ||
416 |
6/96✗ Branch 0 not taken.
✓ Branch 1 taken 1180 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.
✗ Branch 24 not taken.
✓ Branch 25 taken 1172 times.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 40 not taken.
✗ Branch 41 not taken.
✗ Branch 44 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✓ Branch 49 taken 1160 times.
✗ Branch 51 not taken.
✗ Branch 52 not taken.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 64 not taken.
✗ Branch 65 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
✗ Branch 70 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✓ Branch 73 taken 1180 times.
✗ Branch 75 not taken.
✗ Branch 76 not taken.
✗ Branch 78 not taken.
✗ Branch 79 not taken.
✗ Branch 81 not taken.
✗ Branch 82 not taken.
✗ Branch 84 not taken.
✗ Branch 85 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 94 not taken.
✗ Branch 95 not taken.
✗ Branch 96 not taken.
✓ Branch 97 taken 1172 times.
✗ Branch 99 not taken.
✗ Branch 100 not taken.
✗ Branch 102 not taken.
✗ Branch 103 not taken.
✗ Branch 105 not taken.
✗ Branch 106 not taken.
✗ Branch 108 not taken.
✗ Branch 109 not taken.
✗ Branch 112 not taken.
✗ Branch 113 not taken.
✗ Branch 116 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 119 not taken.
✗ Branch 120 not taken.
✓ Branch 121 taken 1160 times.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✗ Branch 127 not taken.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 136 not taken.
✗ Branch 137 not taken.
✗ Branch 140 not taken.
✗ Branch 141 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
|
7024 | EXPECT_TRUE(acc.isValueOn(xyz)); |
417 | 7024 | const Coord* offset(start); | |
418 |
12/12✓ Branch 0 taken 30680 times.
✓ Branch 1 taken 1180 times.
✓ Branch 2 taken 21096 times.
✓ Branch 3 taken 1172 times.
✓ Branch 4 taken 6960 times.
✓ Branch 5 taken 1160 times.
✓ Branch 6 taken 30680 times.
✓ Branch 7 taken 1180 times.
✓ Branch 8 taken 21096 times.
✓ Branch 9 taken 1172 times.
✓ Branch 10 taken 6960 times.
✓ Branch 11 taken 1160 times.
|
124496 | while (offset != end) { |
419 | // optionally recurse into neighbour voxels | ||
420 |
12/12✓ Branch 0 taken 26 times.
✓ Branch 1 taken 30654 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 21078 times.
✓ Branch 6 taken 6 times.
✓ Branch 7 taken 6954 times.
✓ Branch 9 taken 26 times.
✓ Branch 10 taken 30654 times.
✓ Branch 12 taken 18 times.
✓ Branch 13 taken 21078 times.
✓ Branch 15 taken 6 times.
✓ Branch 16 taken 6954 times.
|
117472 | if (recurse > 0) CheckActiveNeighbours(acc, xyz + *offset, recurse-1); |
421 |
6/96✗ Branch 1 not taken.
✓ Branch 2 taken 30680 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.
✗ Branch 26 not taken.
✓ Branch 27 taken 21096 times.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 42 not taken.
✗ Branch 43 not taken.
✗ Branch 46 not taken.
✗ Branch 47 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 51 not taken.
✓ Branch 52 taken 6960 times.
✗ Branch 54 not taken.
✗ Branch 55 not taken.
✗ Branch 57 not taken.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✗ Branch 61 not taken.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✗ Branch 67 not taken.
✗ Branch 68 not taken.
✗ Branch 71 not taken.
✗ Branch 72 not taken.
✗ Branch 73 not taken.
✗ Branch 74 not taken.
✗ Branch 76 not taken.
✓ Branch 77 taken 30680 times.
✗ Branch 79 not taken.
✗ Branch 80 not taken.
✗ Branch 82 not taken.
✗ Branch 83 not taken.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
✗ Branch 88 not taken.
✗ Branch 89 not taken.
✗ Branch 92 not taken.
✗ Branch 93 not taken.
✗ Branch 96 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✗ Branch 101 not taken.
✓ Branch 102 taken 21096 times.
✗ Branch 104 not taken.
✗ Branch 105 not taken.
✗ Branch 107 not taken.
✗ Branch 108 not taken.
✗ Branch 110 not taken.
✗ Branch 111 not taken.
✗ Branch 113 not taken.
✗ Branch 114 not taken.
✗ Branch 117 not taken.
✗ Branch 118 not taken.
✗ Branch 121 not taken.
✗ Branch 122 not taken.
✗ Branch 123 not taken.
✗ Branch 124 not taken.
✗ Branch 126 not taken.
✓ Branch 127 taken 6960 times.
✗ Branch 129 not taken.
✗ Branch 130 not taken.
✗ Branch 132 not taken.
✗ Branch 133 not taken.
✗ Branch 135 not taken.
✗ Branch 136 not taken.
✗ Branch 138 not taken.
✗ Branch 139 not taken.
✗ Branch 142 not taken.
✗ Branch 143 not taken.
✗ Branch 146 not taken.
✗ Branch 147 not taken.
✗ Branch 148 not taken.
✗ Branch 149 not taken.
|
117472 | EXPECT_TRUE(acc.isValueOn(xyz + *offset)); |
422 | 117472 | ++offset; | |
423 | } | ||
424 | }; | ||
425 | |||
426 | // This test specifically tests the tile policy with various inputs | ||
427 | |||
428 | 24 | TreeT tree; | |
429 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.empty()); |
430 | |||
431 | const openvdb::Index leafDim = TreeT::LeafNodeType::DIM; | ||
432 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(1 << 3, int(leafDim)); |
433 | |||
434 | { // Test behaviour with an existing active tile at (0,0,0) | ||
435 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
436 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
24 | tree.addTile(/*level*/1, Coord(0), ValueType(1.0), true); |
437 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(0), tree.leafCount()); |
438 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); |
439 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
440 | |||
441 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT copy(tree); |
442 | { // A single active tile exists so this has no effect | ||
443 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
444 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.hasSameTopology(tree)); |
445 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
446 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.hasSameTopology(tree)); |
447 | } | ||
448 | |||
449 | { // erode with EXPAND_TILES/PRESERVE_TILES - center tile should be expanded and eroded | ||
450 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
24 | TreeT erodeexp(tree), erodepres(tree); |
451 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(erodeexp, 1, NN, openvdb::tools::EXPAND_TILES); |
452 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = (leafDim-2) * (leafDim-2) * (leafDim-2); |
453 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(1), erodeexp.leafCount()); |
454 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, erodeexp.activeVoxelCount()); |
455 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(0), erodeexp.activeTileCount()); |
456 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(erodeexp.probeConstLeaf(Coord(0))); |
457 | |||
458 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(erodepres, 1, NN, openvdb::tools::PRESERVE_TILES); |
459 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(erodeexp.hasSameTopology(erodepres)); |
460 | } | ||
461 | |||
462 | { // dilate | ||
463 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::EXPAND_TILES); |
464 | Index64 expected = leafDim * leafDim * leafDim; | ||
465 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE) expected += (leafDim * leafDim) * 6; // faces |
466 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE) expected += ((leafDim * leafDim) * 6) + (leafDim) * 12; // edges |
467 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += ((leafDim * leafDim) * 6) + ((leafDim) * 12) + 8; // edges |
468 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(1+offsets), tree.leafCount()); |
469 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
470 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(0), tree.activeTileCount()); |
471 | // Check actual values around center node faces | ||
472 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.probeConstLeaf(Coord(0))); |
473 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.probeConstLeaf(Coord(0))->isDense()); |
474 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 6 times.
|
108 | for (int i = 0; i < int(leafDim); ++i) { |
475 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 48 times.
|
864 | for (int j = 0; j < int(leafDim); ++j) { |
476 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,j,0}, 0); |
477 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,0,j}, 0); |
478 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {0,i,j}, 0); |
479 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,j,leafDim-1}, 0); |
480 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,leafDim-1,j}, 0); |
481 |
1/2✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
|
768 | CheckActiveNeighbours(tree, {leafDim-1,i,j}, 0); |
482 | } | ||
483 | } | ||
484 | |||
485 | // Voxelize the original copy and run with IGNORE_TILES - should produce the same result | ||
486 | copy.voxelizeActiveTiles(); | ||
487 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(copy, 1, NN, openvdb::tools::IGNORE_TILES); |
488 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.hasSameTopology(tree)); |
489 | } | ||
490 | |||
491 | { // erode the dilated result | ||
492 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT erode(tree); |
493 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(erode, 1, NN, openvdb::tools::IGNORE_TILES); |
494 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = leafDim * leafDim * leafDim; |
495 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(1+offsets), erode.leafCount()); |
496 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, erode.activeVoxelCount()); |
497 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(0), erode.activeTileCount()); |
498 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(erode.probeConstLeaf(Coord(0))); |
499 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(erode.probeConstLeaf(Coord(0))->isDense()); |
500 | } | ||
501 | |||
502 | // clear | ||
503 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
504 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | copy.clear(); |
505 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.addTile(/*level*/1, Coord(0), ValueType(1.0), true); |
506 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
24 | copy.addTile(/*level*/1, Coord(0), ValueType(1.0), true); |
507 | copy.voxelizeActiveTiles(); | ||
508 | |||
509 | { // dilate both with PRESERVE_TILES | ||
510 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::PRESERVE_TILES); |
511 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(copy, 1, NN, openvdb::tools::PRESERVE_TILES); |
512 | Index64 expected = leafDim * leafDim * leafDim; | ||
513 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE) expected += (leafDim * leafDim) * 6; // faces |
514 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE) expected += ((leafDim * leafDim) * 6) + (leafDim) * 12; // edges |
515 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += ((leafDim * leafDim) * 6) + ((leafDim) * 12) + 8; // edges |
516 | |||
517 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(offsets), tree.leafCount()); |
518 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
519 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
520 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(copy.hasSameTopology(tree)); |
521 | |||
522 | // Check actual values around center node faces | ||
523 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(!tree.probeConstLeaf(Coord(0))); |
524 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.isValueOn(Coord(0))); |
525 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 6 times.
|
108 | for (int i = 0; i < int(leafDim); ++i) { |
526 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 48 times.
|
864 | for (int j = 0; j < int(leafDim); ++j) { |
527 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,j,0}, 0); |
528 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,0,j}, 0); |
529 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {0,i,j}, 0); |
530 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,j,leafDim-1}, 0); |
531 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,leafDim-1,j}, 0); |
532 |
1/2✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
|
768 | CheckActiveNeighbours(tree, {leafDim-1,i,j}, 0); |
533 | } | ||
534 | } | ||
535 | } | ||
536 | |||
537 | { // final erode with PRESERVE_TILES | ||
538 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
24 | TreeT erode(tree); // 10x10x10 filled tree, erode back down to a tile |
539 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(erode, 1, NN, openvdb::tools::PRESERVE_TILES); |
540 | // PRESERVE_TILES will prune the result | ||
541 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = leafDim * leafDim * leafDim; |
542 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(0), erode.leafCount()); |
543 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, erode.activeVoxelCount()); |
544 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), erode.activeTileCount()); |
545 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(!erode.probeConstLeaf(Coord(0))); |
546 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(erode.isValueOn(Coord(0))); |
547 | } | ||
548 | } | ||
549 | { // Test tile preservation with voxel topology - create an active, leaf node-sized tile and a single edge voxel | ||
550 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
551 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
24 | tree.addTile(/*level*/1, Coord(0), ValueType(1.0), true); |
552 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(0), tree.leafCount()); |
553 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); |
554 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
555 | |||
556 | const Coord xyz(leafDim, leafDim >> 1, leafDim >> 1); | ||
557 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.setValue(xyz, 1.0); |
558 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = leafDim * leafDim * leafDim + 1; |
559 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
560 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
561 | |||
562 | { // Test tile is preserve with IGNORE_TILES but only the corner gets dilated | ||
563 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::IGNORE_TILES); |
564 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz, 0); |
565 | |||
566 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE) expected += offsets - 1; // 1 overlapping with tile |
567 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE) expected += offsets - 5; // 5 overlapping |
568 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
4 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected += offsets - 9; // 9 overlapping |
569 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
570 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
571 | |||
572 | // Test all topology is dilated but tile is preserved | ||
573 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, NN, openvdb::tools::PRESERVE_TILES); |
574 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | CheckActiveNeighbours(tree, xyz, /*recurse*/1); |
575 | |||
576 | // Check actual values around center node faces | ||
577 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
578 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(offsets), tree.leafCount()); |
579 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(!tree.probeConstLeaf(Coord(0))); |
580 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.isValueOn(Coord(0))); |
581 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 6 times.
|
108 | for (int i = 0; i < int(leafDim); ++i) { |
582 |
2/2✓ Branch 0 taken 384 times.
✓ Branch 1 taken 48 times.
|
864 | for (int j = 0; j < int(leafDim); ++j) { |
583 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,j,0}, 0); |
584 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,0,j}, 0); |
585 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {0,i,j}, 0); |
586 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,j,leafDim-1}, 0); |
587 |
2/4✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 384 times.
✗ Branch 5 not taken.
|
768 | CheckActiveNeighbours(tree, {i,leafDim-1,j}, 0); |
588 |
1/2✓ Branch 1 taken 384 times.
✗ Branch 2 not taken.
|
768 | CheckActiveNeighbours(tree, {leafDim-1,i,j}, 0); |
589 | } | ||
590 | } | ||
591 | } | ||
592 | { // Test tile is preserved with erosions IGNORE_TILES, irrespective of iterations | ||
593 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 10, NN, openvdb::tools::IGNORE_TILES); |
594 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
595 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(offsets), tree.leafCount()); |
596 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(leafDim * leafDim * leafDim), tree.activeVoxelCount()); |
597 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(!tree.probeConstLeaf(Coord(0))); |
598 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.isValueOn(Coord(0))); |
599 | } | ||
600 | } | ||
601 | { // Test constant leaf nodes are pruned with PRESERVE_TILES | ||
602 | constexpr bool IsMask = std::is_same<ValueType, bool>::value; | ||
603 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.clear(); |
604 | // For mask trees, the bg value is the active state, so make sure its 0. | ||
605 | // the second partial leaf should still become dense | ||
606 | 12 | const ValueType bg = IsMask ? 0.0 : 1.0; | |
607 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
12 | tree.root().setBackground(bg, /*update-child*/false); |
608 | // partial leaf node which will become dense, but not constant | ||
609 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | tree.fill(CoordBBox(Coord(0,0,1), Coord(leafDim-1)), ValueType(2.0)); |
610 | // partial leaf node which will become dense and constant | ||
611 |
2/4✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
24 | tree.fill(CoordBBox(Coord(leafDim*3,0,1), Coord(leafDim*3 + leafDim - 1, leafDim-1, leafDim-1)), ValueType(1.0)); |
612 | // dense leaf node | ||
613 | 12 | tree.touchLeaf(Coord(leafDim*6, 0, 0))->setValuesOn(); | |
614 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | Index64 expected = (leafDim * leafDim * leafDim) + |
615 | ((leafDim * leafDim * leafDim) - (leafDim * leafDim)) * 2; | ||
616 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(3), tree.leafCount()); |
617 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
618 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(0), tree.activeTileCount()); |
619 | |||
620 | // Dilate and preserve - first leaf node becomes dense | ||
621 | // (regardless of NN) but not pruned, second dense and pruned, | ||
622 | // third, already being constant, is also pruned | ||
623 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::dilateActiveValues(tree, 1, |
624 | NN, openvdb::tools::PRESERVE_TILES); | ||
625 | |||
626 | // For mask grids, both partial leaf nodes that become dense should be pruned | ||
627 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
6 | if (IsMask) EXPECT_EQ(Index64(3), tree.activeTileCount()); |
628 |
2/16✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 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.
|
6 | else EXPECT_EQ(Index64(2), tree.activeTileCount()); |
629 | |||
630 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | if (NN == openvdb::tools::NN_FACE) expected = offsets*3 -2; |
631 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | if (NN == openvdb::tools::NN_FACE_EDGE) expected = offsets*3 -10; |
632 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | if (NN == openvdb::tools::NN_FACE_EDGE_VERTEX) expected = offsets*3 -18; |
633 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
6 | if (!IsMask) expected += 1; |
634 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(expected), tree.leafCount()); |
635 | // first | ||
636 | if (IsMask) { | ||
637 | // should have been pruned | ||
638 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 3 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.
|
6 | EXPECT_TRUE(!tree.probeConstLeaf(Coord(0))); |
639 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 3 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.
|
6 | EXPECT_TRUE(tree.isValueOn(Coord(0))); |
640 | } | ||
641 | else { | ||
642 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 3 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.
|
6 | EXPECT_TRUE(tree.probeConstLeaf(Coord(0))); |
643 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 3 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.
|
6 | EXPECT_TRUE(tree.probeConstLeaf(Coord(0))->isDense()); |
644 | } | ||
645 | //second | ||
646 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(!tree.probeConstLeaf(Coord(leafDim*3, 0, 0))); |
647 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.isValueOn(Coord(leafDim*3, 0, 0))); |
648 | // third | ||
649 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(!tree.probeConstLeaf(Coord(leafDim*6, 0, 0))); |
650 |
1/16✗ Branch 0 not taken.
✓ Branch 1 taken 6 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.
|
12 | EXPECT_TRUE(tree.isValueOn(Coord(leafDim*6, 0, 0))); |
651 | |||
652 | // test erosion PRESERVE_TILES correctly erodes and prunes the result | ||
653 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | openvdb::tools::erodeActiveValues(tree, 1, NN, |
654 | openvdb::tools::PRESERVE_TILES); | ||
655 |
1/2✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
|
12 | expected = (leafDim * leafDim * leafDim) + |
656 | ((leafDim * leafDim * leafDim) - (leafDim * leafDim)) * 2; | ||
657 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index32(2), tree.leafCount()); |
658 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(expected, tree.activeVoxelCount()); |
659 |
2/16✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 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.
|
12 | EXPECT_EQ(Index64(1), tree.activeTileCount()); |
660 | } | ||
661 | 12 | } | |
662 | |||
663 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestMorphology, testPreserveMaskLeafNodes) |
664 | { | ||
665 | // test that mask leaf pointers are preserved | ||
666 | 2 | openvdb::MaskTree mask; | |
667 | static const openvdb::Int32 count = 160; | ||
668 | |||
669 | std::vector<openvdb::MaskTree::LeafNodeType*> nodes; | ||
670 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | nodes.reserve(count); |
671 | |||
672 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 1 times.
|
161 | for (openvdb::Int32 i = 0; i < count; ++i) { |
673 |
1/4✓ Branch 1 taken 160 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
160 | nodes.emplace_back(mask.touchLeaf({i,i,i})); |
674 | 160 | nodes.back()->setValuesOn(); // activate all | |
675 | } | ||
676 | |||
677 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::tools::morphology::Morphology<openvdb::MaskTree> morph(mask); |
678 | morph.setThreaded(true); // only a problem during mt | ||
679 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | morph.dilateVoxels(/*iter*/3, openvdb::tools::NN_FACE, |
680 | /*prune*/false, /*preserve*/true); | ||
681 | |||
682 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 1 times.
|
161 | for (openvdb::Int32 i = 0; i < count; ++i) { |
683 |
2/16✓ Branch 2 taken 160 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 160 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.
|
160 | EXPECT_EQ(mask.probeConstLeaf({i,i,i}), nodes[i]); |
684 | } | ||
685 | 1 | } | |
686 | |||
687 | |||
688 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestMorphology, testDeprecated) |
689 | { | ||
690 | // just test these can be instantiated | ||
691 | |||
692 | OPENVDB_NO_DEPRECATION_WARNING_BEGIN | ||
693 | 2 | openvdb::FloatTree tree; | |
694 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | openvdb::tree::LeafManager<openvdb::FloatTree> lm(tree); |
695 | |||
696 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::tools::dilateVoxels(tree, 1); |
697 | lm.rebuild(); | ||
698 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::tools::dilateVoxels(lm, 1); |
699 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::tools::erodeVoxels(tree, 1); |
700 | |||
701 | lm.rebuild(); | ||
702 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::tools::erodeVoxels(lm, 1); |
703 | OPENVDB_NO_DEPRECATION_WARNING_END | ||
704 | 1 | } | |
705 |