GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestLinearInterp.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 561 562 99.8%
Functions: 34 34 100.0%
Branches: 640 3220 19.9%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include "gtest/gtest.h"
5 #include <openvdb/Exceptions.h>
6 #include <openvdb/openvdb.h>
7 #include <openvdb/tools/Interpolation.h>
8 #include <openvdb/math/Stencils.h>
9
10 namespace {
11 // Absolute tolerance for floating-point equality comparisons
12 const double TOLERANCE = 1.e-6;
13 }
14
15 20 class TestLinearInterp: public ::testing::Test
16 {
17 public:
18 template<typename GridType>
19 void test();
20 template<typename GridType>
21 void testTree();
22 template<typename GridType>
23 void testAccessor();
24 template<typename GridType>
25 void testConstantValues();
26 template<typename GridType>
27 void testFillValues();
28 template<typename GridType>
29 void testNegativeIndices();
30 template<typename GridType>
31 void testStencilsMatch();
32 };
33
34
35 template<typename GridType>
36 void
37 4 TestLinearInterp::test()
38 {
39 8 typename GridType::TreeType TreeType;
40 2 float fillValue = 256.0f;
41
42
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
8 GridType grid(fillValue);
43 typename GridType::TreeType& tree = grid.tree();
44
45
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 10), 1.0);
46
47
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 10), 2.0);
48
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 10), 2.0);
49
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 10), 2.0);
50
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 10), 2.0);
51
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 10), 2.0);
52
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 10), 2.0);
53
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 10), 2.0);
54
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 9, 10), 2.0);
55
56
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 11), 3.0);
57
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 11), 3.0);
58
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 11), 3.0);
59
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 11), 3.0);
60
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 11), 3.0);
61
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 11), 3.0);
62
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 11), 3.0);
63
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 11), 3.0);
64
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 9, 11), 3.0);
65
66
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 9), 4.0);
67
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 9), 4.0);
68
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 9), 4.0);
69
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 9), 4.0);
70
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 9), 4.0);
71
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 9), 4.0);
72
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 9), 4.0);
73
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 9), 4.0);
74
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
8 tree.setValue(openvdb::Coord(11, 9, 9), 4.0);
75
76 {//using BoxSampler
77
78 // transform used for worldspace interpolation)
79 openvdb::tools::GridSampler<GridType, openvdb::tools::BoxSampler>
80 interpolator(grid);
81 //openvdb::tools::LinearInterp<GridType> interpolator(*tree);
82
83 typename GridType::ValueType val =
84 interpolator.sampleVoxel(10.5, 10.5, 10.5);
85
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.375, val, TOLERANCE);
86
87 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
88
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.0, val, TOLERANCE);
89
90 val = interpolator.sampleVoxel(11.0, 10.0, 10.0);
91
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
92
93 val = interpolator.sampleVoxel(11.0, 11.0, 10.0);
94
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
95
96 val = interpolator.sampleVoxel(11.0, 11.0, 11.0);
97
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(3.0, val, TOLERANCE);
98
99 val = interpolator.sampleVoxel(9.0, 11.0, 9.0);
100
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
101
102 val = interpolator.sampleVoxel(9.0, 10.0, 9.0);
103
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
104
105 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
106
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.1, val, TOLERANCE);
107
108 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
109
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.792, val, TOLERANCE);
110
111 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
112
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
113
114 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
115
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
116
117 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
118
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.71, val, TOLERANCE);
119
120 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
121
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.01, val, TOLERANCE);
122
123 }
124 {//using Sampler<1>
125
126 // transform used for worldspace interpolation)
127 openvdb::tools::GridSampler<GridType, openvdb::tools::Sampler<1> >
128 interpolator(grid);
129 //openvdb::tools::LinearInterp<GridType> interpolator(*tree);
130
131 typename GridType::ValueType val =
132 interpolator.sampleVoxel(10.5, 10.5, 10.5);
133
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.375, val, TOLERANCE);
134
135 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
136
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.0, val, TOLERANCE);
137
138 val = interpolator.sampleVoxel(11.0, 10.0, 10.0);
139
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
140
141 val = interpolator.sampleVoxel(11.0, 11.0, 10.0);
142
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
143
144 val = interpolator.sampleVoxel(11.0, 11.0, 11.0);
145
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(3.0, val, TOLERANCE);
146
147 val = interpolator.sampleVoxel(9.0, 11.0, 9.0);
148
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
149
150 val = interpolator.sampleVoxel(9.0, 10.0, 9.0);
151
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
152
153 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
154
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.1, val, TOLERANCE);
155
156 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
157
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.792, val, TOLERANCE);
158
159 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
160
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
161
162 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
163
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
164
165 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
166
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.71, val, TOLERANCE);
167
168 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
169
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.01, val, TOLERANCE);
170 }
171 4 }
172
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testFloat) { test<openvdb::FloatGrid>(); }
173
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testDouble) { test<openvdb::DoubleGrid>(); }
174
175
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testVec3S)
176 {
177 using namespace openvdb;
178
179 Vec3s fillValue = Vec3s(256.0f, 256.0f, 256.0f);
180
181 2 Vec3SGrid grid(fillValue);
182 Vec3STree& tree = grid.tree();
183
184
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 10), Vec3s(1.0, 1.0, 1.0));
185
186
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 10), Vec3s(2.0, 2.0, 2.0));
187
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 10), Vec3s(2.0, 2.0, 2.0));
188
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 10), Vec3s(2.0, 2.0, 2.0));
189
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 10), Vec3s(2.0, 2.0, 2.0));
190
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 10), Vec3s(2.0, 2.0, 2.0));
191
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 10), Vec3s(2.0, 2.0, 2.0));
192
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 10), Vec3s(2.0, 2.0, 2.0));
193
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 10), Vec3s(2.0, 2.0, 2.0));
194
195
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 11), Vec3s(3.0, 3.0, 3.0));
196
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 11), Vec3s(3.0, 3.0, 3.0));
197
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 11), Vec3s(3.0, 3.0, 3.0));
198
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 11), Vec3s(3.0, 3.0, 3.0));
199
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 11), Vec3s(3.0, 3.0, 3.0));
200
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 11), Vec3s(3.0, 3.0, 3.0));
201
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 11), Vec3s(3.0, 3.0, 3.0));
202
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 11), Vec3s(3.0, 3.0, 3.0));
203
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 11), Vec3s(3.0, 3.0, 3.0));
204
205
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 9), Vec3s(4.0, 4.0, 4.0));
206
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 9), Vec3s(4.0, 4.0, 4.0));
207
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 9), Vec3s(4.0, 4.0, 4.0));
208
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 9), Vec3s(4.0, 4.0, 4.0));
209
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 9), Vec3s(4.0, 4.0, 4.0));
210
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 9), Vec3s(4.0, 4.0, 4.0));
211
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 9), Vec3s(4.0, 4.0, 4.0));
212
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 9), Vec3s(4.0, 4.0, 4.0));
213
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 9), Vec3s(4.0, 4.0, 4.0));
214
215 openvdb::tools::GridSampler<Vec3SGrid, openvdb::tools::BoxSampler>
216 interpolator(grid);
217
218 //openvdb::tools::LinearInterp<Vec3STree> interpolator(*tree);
219
220
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 Vec3SGrid::ValueType val = interpolator.sampleVoxel(10.5, 10.5, 10.5);
221
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.375f)));
222
223
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
224
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.f)));
225
226
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 10.0, 10.0);
227
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.f)));
228
229
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 11.0, 10.0);
230
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.f)));
231
232
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 11.0, 11.0);
233
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(3.f)));
234
235
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(9.0, 11.0, 9.0);
236
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.f)));
237
238
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(9.0, 10.0, 9.0);
239
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.f)));
240
241
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
242
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.1f)));
243
244
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
245
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.792f)));
246
247
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
248
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
249
250
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
251
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
252
253
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
254
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.71f)));
255
256
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
257
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.01f)));
258 1 }
259
260 template<typename GridType>
261 void
262 4 TestLinearInterp::testTree()
263 {
264 2 float fillValue = 256.0f;
265 typedef typename GridType::TreeType TreeType;
266 8 TreeType tree(fillValue);
267
268
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 10), 1.0);
269
270
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 10), 2.0);
271
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 10), 2.0);
272
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 10), 2.0);
273
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 10), 2.0);
274
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 10), 2.0);
275
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 10), 2.0);
276
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 10), 2.0);
277
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 9, 10), 2.0);
278
279
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 11), 3.0);
280
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 11), 3.0);
281
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 11), 3.0);
282
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 11), 3.0);
283
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 11), 3.0);
284
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 11), 3.0);
285
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 11), 3.0);
286
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 11), 3.0);
287
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 9, 11), 3.0);
288
289
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 9), 4.0);
290
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 9), 4.0);
291
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 9), 4.0);
292
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 9), 4.0);
293
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 9), 4.0);
294
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 9), 4.0);
295
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 9), 4.0);
296
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 9), 4.0);
297
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 9, 9), 4.0);
298
299 // transform used for worldspace interpolation)
300 openvdb::tools::GridSampler<TreeType, openvdb::tools::BoxSampler>
301
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
8 interpolator(tree, openvdb::math::Transform());
302
303 typename GridType::ValueType val =
304 interpolator.sampleVoxel(10.5, 10.5, 10.5);
305
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.375, val, TOLERANCE);
306
307 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
308
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.0, val, TOLERANCE);
309
310 val = interpolator.sampleVoxel(11.0, 10.0, 10.0);
311
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
312
313 val = interpolator.sampleVoxel(11.0, 11.0, 10.0);
314
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
315
316 val = interpolator.sampleVoxel(11.0, 11.0, 11.0);
317
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(3.0, val, TOLERANCE);
318
319 val = interpolator.sampleVoxel(9.0, 11.0, 9.0);
320
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
321
322 val = interpolator.sampleVoxel(9.0, 10.0, 9.0);
323
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
324
325 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
326
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.1, val, TOLERANCE);
327
328 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
329
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.792, val, TOLERANCE);
330
331 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
332
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
333
334 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
335
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
336
337 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
338
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.71, val, TOLERANCE);
339
340 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
341
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.01, val, TOLERANCE);
342 4 }
343
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testTreeFloat) { testTree<openvdb::FloatGrid>(); }
344
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testTreeDouble) { testTree<openvdb::DoubleGrid>(); }
345
346
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testTreeVec3S)
347 {
348 using namespace openvdb;
349
350 Vec3s fillValue = Vec3s(256.0f, 256.0f, 256.0f);
351
352 2 Vec3STree tree(fillValue);
353
354
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 10), Vec3s(1.0, 1.0, 1.0));
355
356
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 10), Vec3s(2.0, 2.0, 2.0));
357
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 10), Vec3s(2.0, 2.0, 2.0));
358
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 10), Vec3s(2.0, 2.0, 2.0));
359
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 10), Vec3s(2.0, 2.0, 2.0));
360
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 10), Vec3s(2.0, 2.0, 2.0));
361
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 10), Vec3s(2.0, 2.0, 2.0));
362
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 10), Vec3s(2.0, 2.0, 2.0));
363
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 10), Vec3s(2.0, 2.0, 2.0));
364
365
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 11), Vec3s(3.0, 3.0, 3.0));
366
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 11), Vec3s(3.0, 3.0, 3.0));
367
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 11), Vec3s(3.0, 3.0, 3.0));
368
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 11), Vec3s(3.0, 3.0, 3.0));
369
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 11), Vec3s(3.0, 3.0, 3.0));
370
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 11), Vec3s(3.0, 3.0, 3.0));
371
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 11), Vec3s(3.0, 3.0, 3.0));
372
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 11), Vec3s(3.0, 3.0, 3.0));
373
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 11), Vec3s(3.0, 3.0, 3.0));
374
375
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 9), Vec3s(4.0, 4.0, 4.0));
376
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 9), Vec3s(4.0, 4.0, 4.0));
377
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 9), Vec3s(4.0, 4.0, 4.0));
378
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 9), Vec3s(4.0, 4.0, 4.0));
379
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 9), Vec3s(4.0, 4.0, 4.0));
380
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 9), Vec3s(4.0, 4.0, 4.0));
381
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 9), Vec3s(4.0, 4.0, 4.0));
382
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 9), Vec3s(4.0, 4.0, 4.0));
383 tree.setValue(openvdb::Coord(11, 9, 9), Vec3s(4.0, 4.0, 4.0));
384
385 openvdb::tools::GridSampler<Vec3STree, openvdb::tools::BoxSampler>
386
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 interpolator(tree, openvdb::math::Transform());
387
388 //openvdb::tools::LinearInterp<Vec3STree> interpolator(*tree);
389
390
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 Vec3SGrid::ValueType val = interpolator.sampleVoxel(10.5, 10.5, 10.5);
391
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.375f)));
392
393
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
394
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.f)));
395
396
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 10.0, 10.0);
397
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.f)));
398
399
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 11.0, 10.0);
400
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.f)));
401
402
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 11.0, 11.0);
403
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(3.f)));
404
405
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(9.0, 11.0, 9.0);
406
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.f)));
407
408
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(9.0, 10.0, 9.0);
409
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.f)));
410
411
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
412
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.1f)));
413
414
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
415
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.792f)));
416
417
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
418
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
419
420
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
421
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
422
423
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
424
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.71f)));
425
426
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
427
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.01f)));
428 1 }
429
430 template<typename GridType>
431 void
432 4 TestLinearInterp::testAccessor()
433 {
434 2 float fillValue = 256.0f;
435
436
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
8 GridType grid(fillValue);
437 typedef typename GridType::Accessor AccessorType;
438
439 AccessorType acc = grid.getAccessor();
440
441
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 10, 10), 1.0);
442
443
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 10, 10), 2.0);
444
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 11, 10), 2.0);
445
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 11, 10), 2.0);
446
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 11, 10), 2.0);
447
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 10, 10), 2.0);
448
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 9, 10), 2.0);
449
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 9, 10), 2.0);
450
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 9, 10), 2.0);
451
452
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 10, 11), 3.0);
453
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 10, 11), 3.0);
454
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 11, 11), 3.0);
455
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 11, 11), 3.0);
456
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 11, 11), 3.0);
457
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 10, 11), 3.0);
458
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 9, 11), 3.0);
459
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 9, 11), 3.0);
460
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 9, 11), 3.0);
461
462
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 10, 9), 4.0);
463
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 10, 9), 4.0);
464
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(11, 11, 9), 4.0);
465
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 11, 9), 4.0);
466
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 11, 9), 4.0);
467
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 10, 9), 4.0);
468
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord( 9, 9, 9), 4.0);
469
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 acc.setValue(openvdb::Coord(10, 9, 9), 4.0);
470
2/6
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
4 acc.setValue(openvdb::Coord(11, 9, 9), 4.0);
471
472 // transform used for worldspace interpolation)
473 openvdb::tools::GridSampler<AccessorType, openvdb::tools::BoxSampler>
474 interpolator(acc, grid.transform());
475
476 typename GridType::ValueType val =
477 interpolator.sampleVoxel(10.5, 10.5, 10.5);
478
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.375, val, TOLERANCE);
479
480 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
481
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.0, val, TOLERANCE);
482
483 val = interpolator.sampleVoxel(11.0, 10.0, 10.0);
484
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
485
486 val = interpolator.sampleVoxel(11.0, 11.0, 10.0);
487
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
488
489 val = interpolator.sampleVoxel(11.0, 11.0, 11.0);
490
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(3.0, val, TOLERANCE);
491
492 val = interpolator.sampleVoxel(9.0, 11.0, 9.0);
493
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
494
495 val = interpolator.sampleVoxel(9.0, 10.0, 9.0);
496
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
497
498 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
499
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.1, val, TOLERANCE);
500
501 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
502
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.792, val, TOLERANCE);
503
504 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
505
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
506
507 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
508
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
509
510 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
511
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.71, val, TOLERANCE);
512
513 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
514
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.01, val, TOLERANCE);
515 4 }
516
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testAccessorFloat) { testAccessor<openvdb::FloatGrid>(); }
517
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testAccessorDouble) { testAccessor<openvdb::DoubleGrid>(); }
518
519
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testAccessorVec3S)
520 {
521 using namespace openvdb;
522
523 Vec3s fillValue = Vec3s(256.0f, 256.0f, 256.0f);
524
525 2 Vec3SGrid grid(fillValue);
526 typedef Vec3SGrid::Accessor AccessorType;
527 AccessorType acc = grid.getAccessor();
528
529
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 10, 10), Vec3s(1.0, 1.0, 1.0));
530
531
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 10, 10), Vec3s(2.0, 2.0, 2.0));
532
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 11, 10), Vec3s(2.0, 2.0, 2.0));
533
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 11, 10), Vec3s(2.0, 2.0, 2.0));
534
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 11, 10), Vec3s(2.0, 2.0, 2.0));
535
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 10, 10), Vec3s(2.0, 2.0, 2.0));
536
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 9, 10), Vec3s(2.0, 2.0, 2.0));
537
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 9, 10), Vec3s(2.0, 2.0, 2.0));
538
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 9, 10), Vec3s(2.0, 2.0, 2.0));
539
540
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 10, 11), Vec3s(3.0, 3.0, 3.0));
541
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 10, 11), Vec3s(3.0, 3.0, 3.0));
542
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 11, 11), Vec3s(3.0, 3.0, 3.0));
543
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 11, 11), Vec3s(3.0, 3.0, 3.0));
544
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 11, 11), Vec3s(3.0, 3.0, 3.0));
545
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 10, 11), Vec3s(3.0, 3.0, 3.0));
546
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 9, 11), Vec3s(3.0, 3.0, 3.0));
547
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 9, 11), Vec3s(3.0, 3.0, 3.0));
548
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 9, 11), Vec3s(3.0, 3.0, 3.0));
549
550
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 10, 9), Vec3s(4.0, 4.0, 4.0));
551
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 10, 9), Vec3s(4.0, 4.0, 4.0));
552
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(11, 11, 9), Vec3s(4.0, 4.0, 4.0));
553
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 11, 9), Vec3s(4.0, 4.0, 4.0));
554
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 11, 9), Vec3s(4.0, 4.0, 4.0));
555
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 10, 9), Vec3s(4.0, 4.0, 4.0));
556
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord( 9, 9, 9), Vec3s(4.0, 4.0, 4.0));
557
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 acc.setValue(openvdb::Coord(10, 9, 9), Vec3s(4.0, 4.0, 4.0));
558
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 acc.setValue(openvdb::Coord(11, 9, 9), Vec3s(4.0, 4.0, 4.0));
559
560 openvdb::tools::GridSampler<AccessorType, openvdb::tools::BoxSampler>
561 interpolator(acc, grid.transform());
562
563
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 Vec3SGrid::ValueType val = interpolator.sampleVoxel(10.5, 10.5, 10.5);
564
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.375f)));
565
566
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
567
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.0f)));
568
569
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 10.0, 10.0);
570
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0f)));
571
572
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 11.0, 10.0);
573
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0f)));
574
575
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(11.0, 11.0, 11.0);
576
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(3.0f)));
577
578
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(9.0, 11.0, 9.0);
579
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.0f)));
580
581
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(9.0, 10.0, 9.0);
582
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.0f)));
583
584
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
585
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.1f)));
586
587
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
588
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.792f)));
589
590
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
591
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
592
593
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
594
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
595
596
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
597
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.71f)));
598
599
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
600
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.01f)));
601 1 }
602
603 template<typename GridType>
604 void
605 4 TestLinearInterp::testConstantValues()
606 {
607 typedef typename GridType::TreeType TreeType;
608 2 float fillValue = 256.0f;
609
610
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
8 GridType grid(fillValue);
611 TreeType& tree = grid.tree();
612
613 // Add values to buffer zero.
614
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 10), 2.0);
615
616
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 10), 2.0);
617
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 10), 2.0);
618
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 10), 2.0);
619
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 10), 2.0);
620
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 10), 2.0);
621
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 10), 2.0);
622
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 10), 2.0);
623
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 9, 10), 2.0);
624
625
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 11), 2.0);
626
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 11), 2.0);
627
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 11), 2.0);
628
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 11), 2.0);
629
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 11), 2.0);
630
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 11), 2.0);
631
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 11), 2.0);
632
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 11), 2.0);
633
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 9, 11), 2.0);
634
635
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 10, 9), 2.0);
636
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 10, 9), 2.0);
637
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(11, 11, 9), 2.0);
638
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 11, 9), 2.0);
639
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 11, 9), 2.0);
640
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 10, 9), 2.0);
641
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( 9, 9, 9), 2.0);
642
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(10, 9, 9), 2.0);
643
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
8 tree.setValue(openvdb::Coord(11, 9, 9), 2.0);
644
645 openvdb::tools::GridSampler<TreeType, openvdb::tools::BoxSampler> interpolator(grid);
646 //openvdb::tools::LinearInterp<GridType> interpolator(*tree);
647
648 typename GridType::ValueType val =
649 interpolator.sampleVoxel(10.5, 10.5, 10.5);
650
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
651
652 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
653
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
654
655 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
656
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
657
658 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
659
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
660
661 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
662
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
663
664 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
665
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
666
667 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
668
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
669
670 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
671
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
672 4 }
673
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testConstantValuesFloat) { testConstantValues<openvdb::FloatGrid>(); }
674
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testConstantValuesDouble) { testConstantValues<openvdb::DoubleGrid>(); }
675
676
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testConstantValuesVec3S)
677 {
678 using namespace openvdb;
679
680 Vec3s fillValue = Vec3s(256.0f, 256.0f, 256.0f);
681
682 2 Vec3SGrid grid(fillValue);
683 Vec3STree& tree = grid.tree();
684
685 // Add values to buffer zero.
686
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 10), Vec3s(2.0, 2.0, 2.0));
687
688
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 10), Vec3s(2.0, 2.0, 2.0));
689
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 10), Vec3s(2.0, 2.0, 2.0));
690
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 10), Vec3s(2.0, 2.0, 2.0));
691
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 10), Vec3s(2.0, 2.0, 2.0));
692
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 10), Vec3s(2.0, 2.0, 2.0));
693
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 10), Vec3s(2.0, 2.0, 2.0));
694
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 10), Vec3s(2.0, 2.0, 2.0));
695
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 10), Vec3s(2.0, 2.0, 2.0));
696
697
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 11), Vec3s(2.0, 2.0, 2.0));
698
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 11), Vec3s(2.0, 2.0, 2.0));
699
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 11), Vec3s(2.0, 2.0, 2.0));
700
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 11), Vec3s(2.0, 2.0, 2.0));
701
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 11), Vec3s(2.0, 2.0, 2.0));
702
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 11), Vec3s(2.0, 2.0, 2.0));
703
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 11), Vec3s(2.0, 2.0, 2.0));
704
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 11), Vec3s(2.0, 2.0, 2.0));
705
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 11), Vec3s(2.0, 2.0, 2.0));
706
707
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 10, 9), Vec3s(2.0, 2.0, 2.0));
708
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 10, 9), Vec3s(2.0, 2.0, 2.0));
709
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 11, 9), Vec3s(2.0, 2.0, 2.0));
710
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 11, 9), Vec3s(2.0, 2.0, 2.0));
711
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 11, 9), Vec3s(2.0, 2.0, 2.0));
712
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 10, 9), Vec3s(2.0, 2.0, 2.0));
713
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( 9, 9, 9), Vec3s(2.0, 2.0, 2.0));
714
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(10, 9, 9), Vec3s(2.0, 2.0, 2.0));
715
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(11, 9, 9), Vec3s(2.0, 2.0, 2.0));
716
717 openvdb::tools::GridSampler<Vec3STree, openvdb::tools::BoxSampler> interpolator(grid);
718 //openvdb::tools::LinearInterp<Vec3STree> interpolator(*tree);
719
720
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 Vec3SGrid::ValueType val = interpolator.sampleVoxel(10.5, 10.5, 10.5);
721
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
722
723
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
724
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
725
726
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
727
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
728
729
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
730
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
731
732
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
733
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
734
735
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
736
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
737
738
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
739
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
740
741
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
742
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0, 2.0, 2.0)));
743 1 }
744
745
746 template<typename GridType>
747 void
748 4 TestLinearInterp::testFillValues()
749 {
750 //typedef typename GridType::TreeType TreeType;
751 2 float fillValue = 256.0f;
752
753
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
8 GridType grid(fillValue);
754 //typename GridType::TreeType& tree = grid.tree();
755
756 openvdb::tools::GridSampler<GridType, openvdb::tools::BoxSampler>
757 interpolator(grid);
758 //openvdb::tools::LinearInterp<GridType> interpolator(*tree);
759
760 typename GridType::ValueType val =
761 interpolator.sampleVoxel(10.5, 10.5, 10.5);
762
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
763
764 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
765
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
766
767 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
768
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
769
770 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
771
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
772
773 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
774
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
775
776 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
777
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
778
779 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
780
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
781
782 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
783
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(256.0, val, TOLERANCE);
784 4 }
785
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testFillValuesFloat) { testFillValues<openvdb::FloatGrid>(); }
786
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testFillValuesDouble) { testFillValues<openvdb::DoubleGrid>(); }
787
788
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testFillValuesVec3S)
789 {
790 using namespace openvdb;
791
792 Vec3s fillValue = Vec3s(256.0f, 256.0f, 256.0f);
793
794 2 Vec3SGrid grid(fillValue);
795 //Vec3STree& tree = grid.tree();
796
797 openvdb::tools::GridSampler<Vec3SGrid, openvdb::tools::BoxSampler>
798 interpolator(grid);
799 //openvdb::tools::LinearInterp<Vec3STree> interpolator(*tree);
800
801
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 Vec3SGrid::ValueType val = interpolator.sampleVoxel(10.5, 10.5, 10.5);
802
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
803
804
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.0, 10.0, 10.0);
805
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
806
807
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.0, 10.0);
808
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
809
810
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.8, 10.8);
811
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
812
813
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.1, 10.8, 10.5);
814
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
815
816
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.8, 10.1, 10.5);
817
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
818
819
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.1, 10.8);
820
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
821
822
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(10.5, 10.8, 10.1);
823
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(256.0, 256.0, 256.0)));
824 1 }
825
826
827 template<typename GridType>
828 void
829 4 TestLinearInterp::testNegativeIndices()
830 {
831 typedef typename GridType::TreeType TreeType;
832 2 float fillValue = 256.0f;
833
834
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
8 GridType grid(fillValue);
835 TreeType& tree = grid.tree();
836
837
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -10, -10), 1.0);
838
839
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -10, -10), 2.0);
840
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -11, -10), 2.0);
841
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -11, -10), 2.0);
842
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -11, -10), 2.0);
843
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -10, -10), 2.0);
844
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -9, -10), 2.0);
845
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -9, -10), 2.0);
846
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -9, -10), 2.0);
847
848
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -10, -11), 3.0);
849
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -10, -11), 3.0);
850
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -11, -11), 3.0);
851
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -11, -11), 3.0);
852
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -11, -11), 3.0);
853
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -10, -11), 3.0);
854
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -9, -11), 3.0);
855
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -9, -11), 3.0);
856
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -9, -11), 3.0);
857
858
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -10, -9), 4.0);
859
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -10, -9), 4.0);
860
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-11, -11, -9), 4.0);
861
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -11, -9), 4.0);
862
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -11, -9), 4.0);
863
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -10, -9), 4.0);
864
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord( -9, -9, -9), 4.0);
865
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(-10, -9, -9), 4.0);
866
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
8 tree.setValue(openvdb::Coord(-11, -9, -9), 4.0);
867
868 //openvdb::tools::LinearInterp<GridType> interpolator(*tree);
869 openvdb::tools::GridSampler<TreeType, openvdb::tools::BoxSampler> interpolator(grid);
870
871 typename GridType::ValueType val =
872 interpolator.sampleVoxel(-10.5, -10.5, -10.5);
873
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.375, val, TOLERANCE);
874
875 val = interpolator.sampleVoxel(-10.0, -10.0, -10.0);
876
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.0, val, TOLERANCE);
877
878 val = interpolator.sampleVoxel(-11.0, -10.0, -10.0);
879
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
880
881 val = interpolator.sampleVoxel(-11.0, -11.0, -10.0);
882
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.0, val, TOLERANCE);
883
884 val = interpolator.sampleVoxel(-11.0, -11.0, -11.0);
885
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(3.0, val, TOLERANCE);
886
887 val = interpolator.sampleVoxel(-9.0, -11.0, -9.0);
888
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
889
890 val = interpolator.sampleVoxel(-9.0, -10.0, -9.0);
891
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(4.0, val, TOLERANCE);
892
893 val = interpolator.sampleVoxel(-10.1, -10.0, -10.0);
894
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(1.1, val, TOLERANCE);
895
896 val = interpolator.sampleVoxel(-10.8, -10.8, -10.8);
897
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.792, val, TOLERANCE);
898
899 val = interpolator.sampleVoxel(-10.1, -10.8, -10.5);
900
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
901
902 val = interpolator.sampleVoxel(-10.8, -10.1, -10.5);
903
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.41, val, TOLERANCE);
904
905 val = interpolator.sampleVoxel(-10.5, -10.1, -10.8);
906
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.71, val, TOLERANCE);
907
908 val = interpolator.sampleVoxel(-10.5, -10.8, -10.1);
909
2/16
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
4 EXPECT_NEAR(2.01, val, TOLERANCE);
910 4 }
911
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testNegativeIndicesFloat) { testNegativeIndices<openvdb::FloatGrid>(); }
912
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testNegativeIndicesDouble) { testNegativeIndices<openvdb::DoubleGrid>(); }
913
914
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testNegativeIndicesVec3S)
915 {
916 using namespace openvdb;
917
918 Vec3s fillValue = Vec3s(256.0f, 256.0f, 256.0f);
919
920 2 Vec3SGrid grid(fillValue);
921 Vec3STree& tree = grid.tree();
922
923
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -10, -10), Vec3s(1.0, 1.0, 1.0));
924
925
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -10, -10), Vec3s(2.0, 2.0, 2.0));
926
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -11, -10), Vec3s(2.0, 2.0, 2.0));
927
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -11, -10), Vec3s(2.0, 2.0, 2.0));
928
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -11, -10), Vec3s(2.0, 2.0, 2.0));
929
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -10, -10), Vec3s(2.0, 2.0, 2.0));
930
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -9, -10), Vec3s(2.0, 2.0, 2.0));
931
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -9, -10), Vec3s(2.0, 2.0, 2.0));
932
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -9, -10), Vec3s(2.0, 2.0, 2.0));
933
934
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -10, -11), Vec3s(3.0, 3.0, 3.0));
935
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -10, -11), Vec3s(3.0, 3.0, 3.0));
936
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -11, -11), Vec3s(3.0, 3.0, 3.0));
937
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -11, -11), Vec3s(3.0, 3.0, 3.0));
938
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -11, -11), Vec3s(3.0, 3.0, 3.0));
939
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -10, -11), Vec3s(3.0, 3.0, 3.0));
940
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -9, -11), Vec3s(3.0, 3.0, 3.0));
941
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -9, -11), Vec3s(3.0, 3.0, 3.0));
942
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -9, -11), Vec3s(3.0, 3.0, 3.0));
943
944
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -10, -9), Vec3s(4.0, 4.0, 4.0));
945
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -10, -9), Vec3s(4.0, 4.0, 4.0));
946
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -11, -9), Vec3s(4.0, 4.0, 4.0));
947
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -11, -9), Vec3s(4.0, 4.0, 4.0));
948
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -11, -9), Vec3s(4.0, 4.0, 4.0));
949
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -10, -9), Vec3s(4.0, 4.0, 4.0));
950
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord( -9, -9, -9), Vec3s(4.0, 4.0, 4.0));
951
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-10, -9, -9), Vec3s(4.0, 4.0, 4.0));
952
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tree.setValue(openvdb::Coord(-11, -9, -9), Vec3s(4.0, 4.0, 4.0));
953
954 openvdb::tools::GridSampler<Vec3SGrid, openvdb::tools::BoxSampler> interpolator(grid);
955 //openvdb::tools::LinearInterp<Vec3STree> interpolator(*tree);
956
957
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 Vec3SGrid::ValueType val = interpolator.sampleVoxel(-10.5, -10.5, -10.5);
958
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.375f)));
959
960
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-10.0, -10.0, -10.0);
961
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.0f)));
962
963
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-11.0, -10.0, -10.0);
964
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0f)));
965
966
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-11.0, -11.0, -10.0);
967
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.0f)));
968
969
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-11.0, -11.0, -11.0);
970
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(3.0f)));
971
972
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-9.0, -11.0, -9.0);
973
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.0f)));
974
975
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-9.0, -10.0, -9.0);
976
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(4.0f)));
977
978
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-10.1, -10.0, -10.0);
979
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(1.1f)));
980
981
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-10.8, -10.8, -10.8);
982
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.792f)));
983
984
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-10.1, -10.8, -10.5);
985
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
986
987
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-10.8, -10.1, -10.5);
988
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.41f)));
989
990
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-10.5, -10.1, -10.8);
991
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.71f)));
992
993
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 val = interpolator.sampleVoxel(-10.5, -10.8, -10.1);
994
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(val.eq(Vec3s(2.01f)));
995 1 }
996
997
998 template<typename GridType>
999 void
1000 4 TestLinearInterp::testStencilsMatch()
1001 {
1002 typedef typename GridType::ValueType ValueType;
1003
1004 8 GridType grid;
1005 typename GridType::TreeType& tree = grid.tree();
1006
1007 // using mostly recurring numbers
1008
1009
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(0, 0, 0), ValueType(1.0/3.0));
1010
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(0, 1, 0), ValueType(1.0/11.0));
1011
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(0, 0, 1), ValueType(1.0/81.0));
1012
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(1, 0, 0), ValueType(1.0/97.0));
1013
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(1, 1, 0), ValueType(1.0/61.0));
1014
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(0, 1, 1), ValueType(9.0/7.0));
1015
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 tree.setValue(openvdb::Coord(1, 0, 1), ValueType(9.0/11.0));
1016
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
8 tree.setValue(openvdb::Coord(1, 1, 1), ValueType(22.0/7.0));
1017
1018 const openvdb::Vec3f pos(7.0f/12.0f, 1.0f/3.0f, 2.0f/3.0f);
1019
1020 {//using BoxSampler and BoxStencil
1021
1022 openvdb::tools::GridSampler<GridType, openvdb::tools::BoxSampler>
1023 interpolator(grid);
1024
1025 openvdb::math::BoxStencil<const GridType>
1026 stencil(grid);
1027
1028 4 typename GridType::ValueType val1 = interpolator.sampleVoxel(pos.x(), pos.y(), pos.z());
1029
1030
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
4 stencil.moveTo(pos);
1031
1/2
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
4 typename GridType::ValueType val2 = stencil.interpolation(pos);
1032
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
4 EXPECT_EQ(val1, val2);
1033 }
1034 4 }
1035
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testStencilsMatchFloat) { testStencilsMatch<openvdb::FloatGrid>(); }
1036
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestLinearInterp, testStencilsMatchDouble) { testStencilsMatch<openvdb::DoubleGrid>(); }
1037