GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestPointRasterizeFrustum.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 1149 1160 99.1%
Functions: 17 17 100.0%
Branches: 1803 9172 19.7%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include <openvdb/openvdb.h>
5
6 #include <openvdb/tools/LevelSetSphere.h>
7 #include <openvdb/tools/Mask.h>
8 #include <openvdb/points/PointScatter.h>
9 #include <openvdb/points/PointConversion.h>
10 #include <openvdb/points/PointRasterizeFrustum.h>
11
12 // enable this flag to reduce compilation time by only unit testing float rasterization
13 // #define ONLY_RASTER_FLOAT
14
15 // enable this flag to perform some simple benchmarking using CpuTimer
16 // #define PROFILE
17
18 #ifdef PROFILE
19 #include <openvdb/util/CpuTimer.h>
20 #endif
21
22 #include "gtest/gtest.h"
23
24 using namespace openvdb;
25 using namespace openvdb::points;
26
27 12 class TestPointRasterizeFrustum: public ::testing::Test
28 {
29 public:
30 12 void SetUp() override { openvdb::initialize(); }
31 12 void TearDown() override { openvdb::uninitialize(); }
32 }; // class TestPointRasterizeFrustum
33
34
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testScaleByVoxelVolume)
35 {
36 const double tolerance = 1.0e-6;
37
38 // four our of five positions live in (0,0,0) voxels
39
40 std::vector<Vec3s> positions = {
41 {0.0f, -0.2f, 0.0f},
42 {0.0f, 0.0f, 0.0f},
43 {0.12f, 0.12f, 0.12f},
44 {100.5f, 98.6f, 103.0f}, /*not in (0,0,0)*/
45 {-0.24f, 0.15f, 0.24f},
46
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 };
47
48 const PointAttributeVector<Vec3s> pointList(positions);
49
50 // leaf containing (0,0,0) voxel lives at (-0.25 => 3.75) in each axis world space for 0.5 voxel size
51
52 const double voxelSize = 0.5;
53 math::Transform::Ptr transform(
54
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
55 1 const double voxelVolume = transform->voxelSize(Vec3d(0,0,0)).product();
56
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(voxelVolume, (voxelSize * voxelSize * voxelSize));
57
58 tools::PointIndexGrid::Ptr pointIndexGrid =
59
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
60
61 PointDataGrid::Ptr points =
62
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
63 auto& tree = points->tree();
64
65 using Rasterizer = FrustumRasterizer<PointDataGrid>;
66 using Settings = FrustumRasterizerSettings;
67 using Mask = FrustumRasterizerMask;
68
69
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
70
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityAttribute = "velocityAttr";
71 1 settings.scaleByVoxelVolume = true;
72 1 settings.threaded = false;
73 1 settings.threshold = 1e-6f;
74
75
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
76
77 // add points to rasterizer
78
79
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
80
81 // accumulate density
82
83
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE);
84
85
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(density);
86
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
87
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
88
89
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
90 1 auto iter = density->tree().cbeginLeaf()->cbeginValueOn();
91
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
92
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/4.0f / static_cast<float>(voxelVolume), *iter);
93
94
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE);
95
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
96
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/4.0f / static_cast<float>(voxelVolume), *iter);
97
98 // accumulate scaled density
99
100 float scale = 13.9f;
101
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE, false, scale);
102
103
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(density);
104
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
105 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
106
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
107
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/(4.0f * scale) / static_cast<float>(voxelVolume), *iter);
108
109 // average density
110
111
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::AVERAGE);
112
113
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
114 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
115
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
116
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/8.0f, *iter);
117
118 // maximum density
119
120
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::MAXIMUM);
121
122
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
123 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
124
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
125
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/1.0f / static_cast<float>(voxelVolume), *iter);
126
127 // add density attribute
128
129
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<float>(tree, "densityAttr");
130
131
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 std::vector<float> densities{2.0f, 3.1f, 8.9f, 6.7f, 4.2f};
132 PointAttributeVector<float> densityWrapper(densities);
133
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(tree, pointIndexGrid->tree(), "densityAttr", densityWrapper);
134
135 // accumulate density
136
137 1 float sum = densities[0] + densities[1] + densities[2] + densities[4];
138
139
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE);
140
141
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(density);
142
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
143
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
144
145
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
146 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
147
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
148
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/sum / static_cast<float>(voxelVolume), *iter);
149
150 // accumulate scaled density
151
152
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE, false, scale);
153
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(density);
154
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
155 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
156
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
157 1 float scaledSum = scale * densities[0] + scale * densities[1] +
158
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 scale * densities[2] + scale * densities[4];
159
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSum / static_cast<float>(voxelVolume), *iter, tolerance);
160
161 // add temperature attribute (an arbitrary float attribute)
162
163
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<float>(tree, "temperatureAttr");
164
165
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 std::vector<float> temperatures{4.2f, 6.7f, 8.9f, 3.1f, 2.0f};
166 PointAttributeVector<float> temperatureWrapper(temperatures);
167
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(tree, pointIndexGrid->tree(), "temperatureAttr", temperatureWrapper);
168
169 // accumulate temperature
170
171 1 sum = temperatures[0] + temperatures[1] + temperatures[2] + temperatures[4];
172
173
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto temperatureBase = rasterizer.rasterizeAttribute("temperatureAttr", RasterMode::ACCUMULATE);
174
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(temperatureBase);
175
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto temperature = GridBase::grid<FloatGrid>(temperatureBase);
176
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(temperature);
177
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("temperatureAttr"), temperature->getName());
178
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(temperature->transform(), *transform);
179
180
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), temperature->tree().activeVoxelCount());
181 1 iter = temperature->tree().cbeginLeaf()->cbeginValueOn();
182
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
183
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_EQ(/*value=*/sum / static_cast<float>(voxelVolume), *iter);
184
185 #ifndef ONLY_RASTER_FLOAT
186 // add velocity attribute (an arbitrary vec3s attribute)
187
188
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendAttribute<Vec3s>(tree, "velocityAttr");
189
190 std::vector<Vec3s> velocities = {
191 {0.0f, 10.0f, 0.0f},
192 {1.0f, 2.0f, 3.0f},
193 {-3.0f, -2.0f, -1.0f},
194 {4.0f, 5.0f, 6.0f},
195 {4.2f, 6.7f, 8.9f},
196
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 };
197 PointAttributeVector<Vec3s> velocityWrapper(velocities);
198
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(tree, pointIndexGrid->tree(), "velocityAttr", velocityWrapper);
199
200 // accumulate velocity
201
202 auto sumV = velocities[0] + velocities[1] + velocities[2] + velocities[4];
203
204
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto velocityBase = rasterizer.rasterizeAttribute("velocityAttr", RasterMode::ACCUMULATE);
205
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(velocityBase);
206
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto velocity = GridBase::grid<Vec3fGrid>(velocityBase);
207
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("velocityAttr"), velocity->getName());
208
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(velocity->transform(), *transform);
209
210
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocity->tree().activeVoxelCount());
211 1 auto iterV = velocity->tree().cbeginLeaf()->cbeginValueOn();
212
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iterV.getCoord());
213
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/sumV / static_cast<float>(voxelVolume), *iterV);
214
215 // accumulate scaled velocity
216
217
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 velocityBase = rasterizer.rasterizeAttribute("velocityAttr", RasterMode::ACCUMULATE, false, scale);
218
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(velocityBase);
219
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 velocity = GridBase::grid<Vec3fGrid>(velocityBase);
220
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocity->tree().activeVoxelCount());
221 1 iterV = velocity->tree().cbeginLeaf()->cbeginValueOn();
222
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iterV.getCoord());
223 auto scaledSumV = (scale * velocities[0] + scale * velocities[1] +
224
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 scale * velocities[2] + scale * velocities[4]) / voxelVolume;
225
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[0], (*iterV)[0], tolerance);
226
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[1], (*iterV)[1], tolerance);
227
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[2], (*iterV)[2], tolerance);
228 #endif
229
230 ////////////////////////////
231
232 // manually build frustum transform using camera API
233
234 math::NonlinearFrustumMap frustumMap(
235 /*position*/Vec3d(0, 0, -10), /*direction*/Vec3d(0, 0, 1), /*up*/Vec3d(0, 1, 0),
236
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 /*aspect*/1.5, /*znear*/0.05, /*depth*/20, /*xcount*/50, /*zcount*/50);
237
238
5/14
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
3 math::Transform::Ptr frustum = math::Transform(frustumMap.copy()).copy();
239
240
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 Mask mask(*frustum, nullptr, BBoxd(), false);
241
242
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.transform = frustum->copy();
243
244
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer frustumRasterizer(settings, mask);
245
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 frustumRasterizer.addPoints(points, /*stream=*/false);
246
247 // accumulate density into frustum grid
248
249 // point 0 is rasterized into (25, 16, 25)
250 // points 1, 2, 4 are all rasterized into (25, 17, 25)
251 // point 3 is rasterized into (26, 17, 282)
252
253
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
2 density = frustumRasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE);
254
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
255
256
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(density);
257
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
258
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *frustum);
259
260
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(3), density->activeVoxelCount());
261
262 { // point 0
263 Coord xyz(25, 16, 25);
264
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float sum = densities[0];
265
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float voxelVolume = static_cast<float>(frustum->voxelSize(xyz.asVec3d()).product());
266
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(sum / voxelVolume, density->tree().getValue(xyz), 1e-6);
267 }
268
269 { // point 1, 2, 4
270 Coord xyz(25, 17, 25);
271
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float sum = densities[1] + densities[2] + densities[4];
272
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float voxelVolume = static_cast<float>(frustum->voxelSize(xyz.asVec3d()).product());
273
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(sum / voxelVolume, density->tree().getValue(xyz), 1e-6);
274 }
275
276 { // point 3
277 Coord xyz(26, 17, 282);
278
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float sum = densities[3];
279
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float voxelVolume = static_cast<float>(frustum->voxelSize(xyz.asVec3d()).product());
280
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(sum / voxelVolume, density->tree().getValue(xyz), 1e-6);
281 }
282
283 // use a clipped frustum grid (point 3 is clipped)
284
285
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask clippedMask(*frustum);
286
287
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer clippedFrustumRasterizer(settings, clippedMask);
288
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 clippedFrustumRasterizer.addPoints(points, /*stream=*/false);
289
290
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 auto clippedDensity = clippedFrustumRasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE);
291
292
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(2), clippedDensity->tree().activeVoxelCount());
293
294 { // point 0
295 Coord xyz(25, 16, 25);
296
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_NEAR(density->tree().getValue(xyz),
297 clippedDensity->tree().getValue(xyz), 1e-6);
298 }
299
300 { // point 1, 2, 4
301 Coord xyz(25, 17, 25);
302
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_NEAR(density->tree().getValue(xyz),
303 clippedDensity->tree().getValue(xyz), 1e-6);
304 }
305
306 { // point 3 (outside of frustum)
307 Coord xyz(26, 17, 282);
308
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.0, clippedDensity->tree().getValue(xyz), 1e-6);
309 }
310 1 }
311
312
313
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testPointRasterization)
314 {
315 const double tolerance = 1.0e-5;
316
317 // four our of five positions live in (0,0,0) voxels
318
319 std::vector<Vec3s> positions = {
320 {0.0f, -0.2f, 0.0f},
321 {0.0f, 0.0f, 0.0f},
322 {0.12f, 0.12f, 0.12f},
323 {100.5f, 98.6f, 103.0f}, /*not in (0,0,0)*/
324 {-0.24f, 0.15f, 0.24f},
325
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
326
327 const PointAttributeVector<Vec3s> pointList(positions);
328
329 // leaf containing (0,0,0) voxel lives at (-0.25 => 3.75) in each axis world space for 0.5 voxel size
330
331 const double voxelSize = 0.5;
332 math::Transform::Ptr transform(
333
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
334
335 tools::PointIndexGrid::Ptr pointIndexGrid =
336
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
337
338 PointDataGrid::Ptr points =
339
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
340 auto& tree = points->tree();
341
342 using Rasterizer = FrustumRasterizer<PointDataGrid>;
343 using Settings = FrustumRasterizerSettings;
344 using Mask = FrustumRasterizerMask;
345
346
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
347
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityAttribute = "velocityAttr";
348 1 settings.velocityMotionBlur = false;
349
350
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
351
352 // add points to rasterizer
353
354
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
355
356 // accumulate density
357
358
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE);
359
360
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(density);
361
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
362
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
363
364
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
365 1 auto iter = density->tree().cbeginLeaf()->cbeginValueOn();
366
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
367
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/4.0f, *iter);
368
369
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE);
370
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
371
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/4.0f, *iter);
372
373 // accumulate scaled density
374
375 float scale = 13.9f;
376
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE, false, scale);
377
378
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(density);
379
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
380 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
381
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
382
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/(4.0f * scale), *iter);
383
384 // average density
385
386
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::AVERAGE);
387
388
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
389 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
390
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
391
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/1.0f, *iter);
392
393 // maximum density
394
395
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::MAXIMUM);
396
397
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
398 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
399
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
400
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/1.0f, *iter);
401
402 // add density attribute
403
404
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<float>(tree, "densityAttr");
405
406
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 std::vector<float> densities{2.0f, 3.1f, 8.9f, 6.7f, 4.2f};
407 PointAttributeVector<float> densityWrapper(densities);
408
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(tree, pointIndexGrid->tree(), "densityAttr", densityWrapper);
409
410 // accumulate density
411
412 1 float sum = densities[0] + densities[1] + densities[2] + densities[4];
413
414
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE);
415
416
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(density);
417
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
418
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
419
420
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
421 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
422
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
423
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(/*value=*/sum, *iter);
424
425 // accumulate scaled density
426
427
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE, false, scale);
428
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(density);
429
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
430 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
431
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
432 1 float scaledSum = scale * densities[0] + scale * densities[1] +
433
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 scale * densities[2] + scale * densities[4];
434
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSum, *iter, tolerance);
435
436 // average density
437
438
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::AVERAGE);
439
440
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(density);
441
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
442
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
443
444
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
445 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
446
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
447
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/sum / /*weight=*/4, *iter);
448
449 // maximum density
450
451
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::MAXIMUM);
452
453
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(density);
454
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
455
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
456
457
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
458 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
459
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
460
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(/*value=*/(densities[2]), *iter);
461
462 // add temperature attribute (an arbitrary float attribute)
463
464
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<float>(tree, "temperatureAttr");
465
466
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 std::vector<float> temperatures{4.2f, 6.7f, 8.9f, 3.1f, 2.0f};
467 PointAttributeVector<float> temperatureWrapper(temperatures);
468
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(tree, pointIndexGrid->tree(), "temperatureAttr", temperatureWrapper);
469
470 // accumulate temperature
471
472 1 sum = temperatures[0] + temperatures[1] + temperatures[2] + temperatures[4];
473
474
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto temperatureBase = rasterizer.rasterizeAttribute("temperatureAttr", RasterMode::ACCUMULATE);
475
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(temperatureBase);
476
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto temperature = GridBase::grid<FloatGrid>(temperatureBase);
477
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(temperature);
478
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("temperatureAttr"), temperature->getName());
479
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(temperature->transform(), *transform);
480
481
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), temperature->tree().activeVoxelCount());
482 1 iter = temperature->tree().cbeginLeaf()->cbeginValueOn();
483
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
484
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(/*value=*/sum, *iter);
485
486 // explicitly specify types in rasterization
487
488
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto temperatureF = rasterizer.rasterizeAttribute<FloatGrid, float>("temperatureAttr", RasterMode::ACCUMULATE);
489
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(temperatureF);
490
491
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), temperatureF->tree().activeVoxelCount());
492 1 iter = temperatureF->tree().cbeginLeaf()->cbeginValueOn();
493
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
494
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(/*value=*/sum, *iter);
495
496 // rasterize float attribute into double grid
497
498
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto temperatureD = rasterizer.rasterizeAttribute<DoubleGrid, float>("temperatureAttr", RasterMode::ACCUMULATE);
499
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(temperatureD);
500
501
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), temperatureD->tree().activeVoxelCount());
502 1 auto iterD = temperatureD->tree().cbeginLeaf()->cbeginValueOn();
503
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iterD.getCoord());
504
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/double(sum), *iterD);
505
506 // rasterize float attribute into bool grid
507
508
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto boolGrid = rasterizer.rasterizeAttribute<BoolGrid, float>("temperatureAttr", RasterMode::ACCUMULATE);
509
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(boolGrid);
510
511
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), boolGrid->tree().activeVoxelCount());
512
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(boolGrid->tree().getValue(Coord(0,0,0)));
513
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(boolGrid->tree().isValueOn(Coord(0,0,0)));
514
515 // average temperature
516
517
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 temperatureBase = rasterizer.rasterizeAttribute("temperatureAttr", RasterMode::AVERAGE);
518
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(temperatureBase);
519
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 temperature = GridBase::grid<FloatGrid>(temperatureBase);
520
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(temperature);
521
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("temperatureAttr"), temperature->getName());
522
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(temperature->transform(), *transform);
523
524
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), temperature->tree().activeVoxelCount());
525 1 iter = temperature->tree().cbeginLeaf()->cbeginValueOn();
526
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
527
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/sum / /*weight=*/4, *iter);
528
529 // maximum temperature
530
531
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 temperatureBase = rasterizer.rasterizeAttribute("temperatureAttr", RasterMode::MAXIMUM);
532
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(temperatureBase);
533
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 temperature = GridBase::grid<FloatGrid>(temperatureBase);
534
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(temperature);
535
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("temperatureAttr"), temperature->getName());
536
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(temperature->transform(), *transform);
537
538
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), temperature->tree().activeVoxelCount());
539 1 iter = temperature->tree().cbeginLeaf()->cbeginValueOn();
540
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
541
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(/*value=*/(temperatures[2]), *iter);
542
543 #ifndef ONLY_RASTER_FLOAT
544 // add arbitrary float[3] attribute and verify it rasterizes all components
545 // into a vec3s grid
546
547
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<float>(tree, "stridedAttr", /*uniformValue=*/0.0f, /*stride=*/3);
548
549 std::vector<float> stridedValues = {
550 1.0f, 2.0f, 3.0f,
551 1.0f, 2.0f, 3.0f,
552 1.0f, 2.0f, 3.0f,
553 1.0f, 2.0f, 3.0f,
554 1.0f, 2.0f, 3.0f
555
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 };
556 PointAttributeVector<float> stridedWrapper(stridedValues, /*stride=*/3);
557
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 populateAttribute(tree, pointIndexGrid->tree(), "stridedAttr", stridedWrapper, /*stride=*/3);
558
559
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto stridedBase = rasterizer.rasterizeAttribute("stridedAttr", RasterMode::ACCUMULATE);
560
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(stridedBase);
561
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto strided = GridBase::grid<Vec3fGrid>(stridedBase);
562
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(strided);
563
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto iterS = strided->tree().cbeginLeaf()->cbeginValueOn();
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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
1 EXPECT_EQ(Vec3s(4.0f, 8.0f, 12.0f), *iterS);
565
566 // add velocity attribute (an arbitrary vec3s attribute)
567
568
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendAttribute<Vec3s>(tree, "velocityAttr");
569
570 std::vector<Vec3s> velocities = {
571 {0.0f, 10.0f, 0.0f},
572 {1.0f, 2.0f, 3.0f},
573 {-3.0f, -2.0f, -1.0f},
574 {4.0f, 5.0f, 6.0f},
575 {4.2f, 6.7f, 8.9f},
576
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 };
577 PointAttributeVector<Vec3s> velocityWrapper(velocities);
578
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(tree, pointIndexGrid->tree(), "velocityAttr", velocityWrapper);
579
580 // accumulate velocity
581
582 1 auto sumV = velocities[0] + velocities[1] + velocities[2] + velocities[4];
583
584
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto velocityBase = rasterizer.rasterizeAttribute("velocityAttr", RasterMode::ACCUMULATE);
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(velocityBase);
586
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto velocity = GridBase::grid<Vec3fGrid>(velocityBase);
587
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("velocityAttr"), velocity->getName());
588
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(velocity->transform(), *transform);
589
590
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocity->tree().activeVoxelCount());
591 1 auto iterV = velocity->tree().cbeginLeaf()->cbeginValueOn();
592
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iterV.getCoord());
593
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(/*value=*/sumV, *iterV);
594
595 // accumulate scaled velocity
596
597
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 velocityBase = rasterizer.rasterizeAttribute("velocityAttr", RasterMode::ACCUMULATE, false, scale);
598
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(velocityBase);
599
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 velocity = GridBase::grid<Vec3fGrid>(velocityBase);
600
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocity->tree().activeVoxelCount());
601 1 iterV = velocity->tree().cbeginLeaf()->cbeginValueOn();
602
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iterV.getCoord());
603 auto scaledSumV = (scale * velocities[0] + scale * velocities[1] +
604 scale * velocities[2] + scale * velocities[4]);
605
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[0], (*iterV)[0], tolerance);
606
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[1], (*iterV)[1], tolerance);
607
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[2], (*iterV)[2], tolerance);
608
609 // explicitly specify Vec3f grid
610
611
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 velocity = rasterizer.rasterizeAttribute<Vec3fGrid, Vec3f>("velocityAttr", RasterMode::ACCUMULATE);
612
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(velocity);
613
614
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocity->tree().activeVoxelCount());
615 1 iterV = velocity->tree().cbeginLeaf()->cbeginValueOn();
616
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
617
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR((sumV)[0], (*iterV)[0], tolerance);
618
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR((sumV)[1], (*iterV)[1], tolerance);
619
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR((sumV)[2], (*iterV)[2], tolerance);
620
621 // explicitly specify Vec3f grid and scale
622
623
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 velocity = rasterizer.rasterizeAttribute<Vec3fGrid, Vec3f>("velocityAttr", RasterMode::ACCUMULATE, false, scale);
624
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(velocity);
625
626
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocity->tree().activeVoxelCount());
627 1 iterV = velocity->tree().cbeginLeaf()->cbeginValueOn();
628
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
629
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[0], (*iterV)[0], tolerance);
630
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[1], (*iterV)[1], tolerance);
631
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumV[2], (*iterV)[2], tolerance);
632
633 // rasterize float attribute into double grid
634
635
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 auto velocityD = rasterizer.rasterizeAttribute<Vec3dGrid, Vec3f>("velocityAttr", RasterMode::ACCUMULATE, false, scale);
636
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(velocityD);
637
638
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocityD->tree().activeVoxelCount());
639 1 auto iterVD = velocityD->tree().cbeginLeaf()->cbeginValueOn();
640
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iterVD.getCoord());
641 // note that the order of operations and the precision being used for each one is important
642 // to result in the exact same value within a tolerance of 1e-6
643 auto scaledSumVD = Vec3d(scale * velocities[0]) + Vec3d(scale * velocities[1]) +
644 Vec3d(scale * velocities[2]) + Vec3d(scale * velocities[4]);
645
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumVD[0], (*iterVD)[0], tolerance);
646
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumVD[1], (*iterVD)[1], tolerance);
647
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(scaledSumVD[2], (*iterVD)[2], tolerance);
648
649 // average velocity
650
651
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 velocityBase = rasterizer.rasterizeAttribute("velocityAttr", RasterMode::AVERAGE);
652
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(velocityBase);
653
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 velocity = GridBase::grid<Vec3fGrid>(velocityBase);
654
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(velocity);
655
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("velocityAttr"), velocity->getName());
656
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(velocity->transform(), *transform);
657
658
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), velocity->tree().activeVoxelCount());
659 1 iterV = velocity->tree().cbeginLeaf()->cbeginValueOn();
660
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iterV.getCoord());
661 // note that the order of operations and the precision being used for each one is important
662 // to result in the exact same value within a tolerance of 1e-6
663 auto sumVD = velocities[0] + velocities[1] + velocities[2] + velocities[4];
664
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(/*value=*/(sumVD / 4.0f), *iterV);
665
666 // maximum velocity (not supported for vector attributes)
667
668
6/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
2 EXPECT_THROW(rasterizer.rasterizeAttribute("velocityAttr", RasterMode::MAXIMUM),
669 ValueError);
670 #endif
671
672 ////////////////////////////
673
674 // point filtering (select one point only)
675
676
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test");
677
678
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership{0, 1, 0, 0, 0};
679
680
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership, "test");
681
682
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
3 std::vector<Name> includeGroups{"test"};
683 1 std::vector<Name> excludeGroups;
684
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, tree.cbeginLeaf()->attributeSet());
685
686
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE, false, 1.0f, filter);
687
688
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(density);
689
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(1), density->activeVoxelCount());
690 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
691
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
692
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(densities[1], *iter);
693
694 // use RasterGroups object that is resolved per-grid
695
696 RasterGroups rasterGroups;
697
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterGroups.includeNames.push_back("test");
698
699
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
2 density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE, false, 1.0f, rasterGroups);
700
701
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(density);
702
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(1), density->activeVoxelCount());
703 1 iter = density->tree().cbeginLeaf()->cbeginValueOn();
704
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
2 EXPECT_EQ(Coord(0,0,0), iter.getCoord());
705
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(densities[1], *iter);
706
707 ////////////////////////////
708
709 // manually build frustum transform using camera API
710
711 math::NonlinearFrustumMap frustumMap(
712 /*position*/Vec3d(0, 0, -10), /*direction*/Vec3d(0, 0, 1), /*up*/Vec3d(0, 1, 0),
713
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 /*aspect*/1.5, /*znear*/0.05, /*depth*/20, /*xcount*/50, /*zcount*/50);
714
715
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
3 math::Transform::Ptr frustum = math::Transform(frustumMap.copy()).copy();
716
717
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 Mask mask(*frustum, nullptr, BBoxd(), false);
718
719
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.transform = frustum->copy();
720
721
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer frustumRasterizer(settings, mask);
722
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 frustumRasterizer.addPoints(points, /*stream=*/false);
723
724 // accumulate density into frustum grid
725
726 // point 0 is rasterized into (25, 16, 25)
727 // points 1, 2, 4 are all rasterized into (25, 17, 25)
728 // point 3 is rasterized into (26, 17, 282)
729
730
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
2 density = frustumRasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE);
731
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
732
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(density);
734
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
735
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *frustum);
736
737
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(3), density->activeVoxelCount());
738
739 { // point 0
740 Coord xyz(25, 16, 25);
741
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float sum = densities[0];
742
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(sum, density->tree().getValue(xyz), 1e-6);
743 }
744
745 { // point 1, 2, 4
746 Coord xyz(25, 17, 25);
747
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float sum = densities[1] + densities[2] + densities[4];
748
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(sum, density->tree().getValue(xyz), 1e-6);
749 }
750
751 { // point 3
752 Coord xyz(26, 17, 282);
753
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const float sum = densities[3];
754
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(sum, density->tree().getValue(xyz), 1e-6);
755 }
756
757 // use a clipped frustum grid (point 3 is clipped)
758
759
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask clipMask(*frustum, nullptr, BBoxd(), true);
760
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer clippedFrustumRasterizer(settings, clipMask);
761
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 clippedFrustumRasterizer.addPoints(points, /*stream=*/false);
762
763
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 auto clippedDensity = clippedFrustumRasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE);
764
765
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(2), clippedDensity->tree().activeVoxelCount());
766
767 { // point 0
768 Coord xyz(25, 16, 25);
769
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_NEAR(density->tree().getValue(xyz),
770 clippedDensity->tree().getValue(xyz), 1e-6);
771 }
772
773 { // point 1, 2, 4
774 Coord xyz(25, 17, 25);
775
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_NEAR(density->tree().getValue(xyz),
776 clippedDensity->tree().getValue(xyz), 1e-6);
777 }
778
779 { // point 3 (outside of frustum)
780 Coord xyz(26, 17, 282);
781
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.0, clippedDensity->tree().getValue(xyz), 1e-6);
782 }
783 1 }
784
785
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testSphereRasterization)
786 {
787 using Rasterizer = FrustumRasterizer<PointDataGrid>;
788 using Settings = FrustumRasterizerSettings;
789
790 { // single point that lives at (0,0.2,0)
791
792 Vec3s center(0.0f, 0.2f, 0.0f);
793
794 std::vector<Vec3s> positions = {
795 center
796
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
797
798 const PointAttributeVector<Vec3s> pointList(positions);
799
800 const double voxelSize = 0.5;
801 math::Transform::Ptr transform(
802
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
803
804 tools::PointIndexGrid::Ptr pointIndexGrid =
805
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
806
807 PointDataGrid::Ptr points =
808
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
809 auto& tree = points->tree();
810
811 { // no radius
812
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
813
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
814
815 // add points to rasterizer
816
817
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
818
819 // accumulate density
820
821
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
822
823
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(1), density->tree().activeVoxelCount());
824 }
825
826 { // use radius (no pscale so default to radius of 1.0)
827
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
828 1 settings.useRadius = true;
829
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
830
831 // add points to rasterizer
832
833
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
834
835 // accumulate density
836
837
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
838
839
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(32), density->tree().activeVoxelCount());
840
841
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
9 for (auto leaf = density->tree().cbeginLeaf(); leaf; ++leaf) {
842
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 8 times.
40 for (auto iter = leaf->cbeginValueOn(); iter; ++iter) {
843 // other values should be less than one
844
2/18
✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 32 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
32 EXPECT_TRUE(iter.getValue() < 1.0f);
845 }
846 }
847 }
848
849 { // verify falloff is monotonically decreasing in one axis (with radius scaling)
850
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
851 1 settings.useRadius = true;
852 1 settings.radiusScale = 10.0f;
853
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
854
855 // add points to rasterizer
856
857
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
858
859 // accumulate density
860
861
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
862
863
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(33484), density->tree().activeVoxelCount());
864
865 1 float value = density->tree().getValue(Coord(0,0,0));
866
867
1/2
✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
21 for (int j = 1; j < 100; j++) {
868 Coord ijk(0, j, 0);
869
2/2
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1 times.
21 if (!density->tree().isValueOn(ijk)) break;
870 float previousValue = value;
871 value = density->tree().getValue(Coord(0, j, 0));
872
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 20 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.
20 EXPECT_TRUE(value < previousValue);
873 }
874
875 // last falloff value is almost zero
876
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(value < 0.05f);
877 }
878
879 { // add "radius" attribute, but leave radius set to expect "pscale" attribute
880
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendAttribute<float>(tree, "radius");
881
882 // set radius to 2.0f
883
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
1 auto handle = AttributeWriteHandle<float>(tree.beginLeaf()->attributeArray("radius"));
884
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 handle.set(0, 2.0f);
885
886
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
887 1 settings.useRadius = true;
888
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
889
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
890
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
891
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(32), density->tree().activeVoxelCount());
892 }
893
894 { // change radius attribute to "radius"
895
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
896 1 settings.useRadius = true;
897
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.radiusAttribute = "radius";
898
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
899
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
900
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
901
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(268), density->tree().activeVoxelCount());
902 }
903
904 { // use a higher threshold
905
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
906 1 settings.useRadius = true;
907
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.radiusAttribute = "radius";
908 1 settings.threshold = 0.1f;
909
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
910
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
911
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
912
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(196), density->tree().activeVoxelCount());
913
914
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 1 times.
9 for (auto leaf = density->tree().cbeginLeaf(); leaf; ++leaf) {
915
2/2
✓ Branch 0 taken 196 times.
✓ Branch 1 taken 8 times.
204 for (auto iter = leaf->cbeginValueOn(); iter; ++iter) {
916
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 196 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.
196 EXPECT_TRUE(*iter >= settings.threshold);
917 }
918 }
919 }
920 }
921
922 { // frustum sphere rasterization
923 Vec3s center(0.25, 0.25, 1.5);
924
925 std::vector<Vec3s> positions = {
926 center
927
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
928
929 const PointAttributeVector<Vec3s> pointList(positions);
930
931 const double voxelSize = 0.5;
932 math::Transform::Ptr transform(
933
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
934
935 tools::PointIndexGrid::Ptr pointIndexGrid =
936
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
937
938 PointDataGrid::Ptr points =
939
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
940
941 Mat4d mat4( 0.5, 0.0, 0.0, 0.0,
942 0.0, 0.5, 0.0, 0.0,
943 0.0, 0.0, 1.0, 0.0,
944 0.0, 0.0, 1.0, 1.0);
945
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::AffineMap affineMap(mat4);
946
947 math::NonlinearFrustumMap frustumMap(
948
1/4
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
1 BBoxd(Vec3d(-0.5, -0.5, -0.5), Vec3d(99.5, 99.5, 99.5)),
949
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 /*taper=*/0.5, /*depth=*/1.0, /*affineMap=*/affineMap.copy());
950
951
5/14
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
3 math::Transform::Ptr frustum = math::Transform(frustumMap.copy()).copy();
952
953 { // accurate method
954
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustum);
955 1 settings.useRadius = true;
956 1 settings.accurateFrustumRadius = true;
957 1 settings.radiusScale = 0.1f;
958
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
959
960 // add points to rasterizer
961
962
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
963
964 // accumulate density
965
966
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
967
968
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Index64 voxelCount = density->tree().activeVoxelCount();
969
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(voxelCount > Index64(7000) && voxelCount < Index64(8000));
970 }
971
972 { // approximate method
973
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustum);
974 1 settings.useRadius = true;
975 1 settings.accurateFrustumRadius = false;
976 1 settings.radiusScale = 0.1f;
977
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
978
979 // add points to rasterizer
980
981
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
982
983 // accumulate density
984
985
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
986
987
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Index64 voxelCount = density->tree().activeVoxelCount();
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(voxelCount > Index64(7000) && voxelCount < Index64(8000));
989 }
990 }
991
992 { // two overlapping spheres
993 std::vector<Vec3s> positions = {
994 {-1.1f, 0.0, 0},
995 {1.1f, 0.0, 0}
996
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
997
998 const PointAttributeVector<Vec3s> pointList(positions);
999
1000 const double voxelSize = 1.0;
1001 math::Transform::Ptr transform(
1002
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
1003
1004 tools::PointIndexGrid::Ptr pointIndexGrid =
1005
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1006
1007 PointDataGrid::Ptr points =
1008
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1009
1010
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1011 1 settings.useRadius = true;
1012 1 settings.radiusScale = std::sqrt(3.0f)+0.001f;
1013
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1014
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1015
1016 { // uniform density with default mode (maximum)
1017
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
1018
1019
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto value1 = density->tree().getValue(Coord(-1, 0, 0));
1020 1 auto value2 = density->tree().getValue(Coord(1, 0, 0));
1021
1022
3/20
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
1 EXPECT_TRUE(value1 > 0.9f && value1 < 1.0f);
1023
3/20
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
1 EXPECT_TRUE(value2 > 0.9f && value2 < 1.0f);
1024
1025 auto center = density->tree().getValue(Coord(0, 0, 0));
1026
1027
3/20
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
1 EXPECT_TRUE(center > 0.3f && center < 0.4f);
1028 }
1029
1030 { // accumulate uniform density
1031
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE);
1032
1033
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto value1 = density->tree().getValue(Coord(-1, 0, 0));
1034 1 auto value2 = density->tree().getValue(Coord(1, 0, 0));
1035
1036
3/20
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
1 EXPECT_TRUE(value1 > 0.9f && value1 < 1.0f);
1037
3/20
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
1 EXPECT_TRUE(value2 > 0.9f && value2 < 1.0f);
1038
1039 auto center = density->tree().getValue(Coord(0, 0, 0));
1040
1041
3/20
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
1 EXPECT_TRUE(center > 0.7f && center < 0.8f);
1042 }
1043 }
1044 1 }
1045
1046
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testVelocityMotionBlur)
1047 {
1048 // particle 0 and particle 2 rasterize into two of the same voxels
1049
1050 std::vector<Vec3s> positions = {
1051 {0.0f, 1.2f, 0.0f},
1052 {100.0f, 100.0f, 50.0f},
1053 {0.0f, 1.55f, 0.0f},
1054
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
1055
1056 const PointAttributeVector<Vec3s> pointList(positions);
1057
1058 // leaf containing (0,1,0) voxel lives at (-0.25 => 3.75) in each axis world space for 0.5 voxel size
1059
1060 const double voxelSize = 0.5;
1061 math::Transform::Ptr transform(
1062
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
1063
1064 tools::PointIndexGrid::Ptr pointIndexGrid =
1065
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1066
1067 PointDataGrid::Ptr points =
1068
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1069 auto& pointsTree = points->tree();
1070
1071 // add velocity attribute
1072
1073 const float fps = 24.0f;
1074
1075
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendAttribute<Vec3s>(pointsTree, "v");
1076
1077 std::vector<Vec3s> velocities = {
1078 {0, fps, 0},
1079 {0, fps/2.5f, 0},
1080 {0, fps*4, 0}
1081
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 };
1082
1083 PointAttributeVector<Vec3s> velocityWrapper(velocities);
1084
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(pointsTree, pointIndexGrid->tree(), "v", velocityWrapper);
1085
1086 // particle 0: (0, 0.95, 0) => (0, 1.45, 0)
1087 // particle 1: (100, 99.9, 50) => (100, 100.1, 50)
1088 // particle 2: (0, 0.55, 0) => (0, 2.55, 0)
1089
1090 // voxels 0: (0, 2, 0) (0, 3, 0)
1091 // voxels 1: (100, 100, 50)
1092 // voxels 2: (0, 1, 0) (0, 2, 0) (0, 3, 0) (0, 4, 0) (0, 5, 0)
1093
1094 // per-voxel contribution 0: 0.5
1095 // per-voxel contribution 1: 1.0
1096 // per-voxel contribution 2: 0.2
1097
1098 using Rasterizer = FrustumRasterizer<PointDataGrid>;
1099 using Settings = FrustumRasterizerSettings;
1100
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1101 1 settings.velocityMotionBlur = true;
1102 1 settings.threaded = false;
1103
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1104
1105 // add points to rasterizer
1106
1107
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1108
1109 { // accumulate uniform density
1110
1111
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE);
1112
1113
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(density);
1114
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1115
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1116
1117 const auto& tree = density->constTree();
1118
1119
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(6), tree.activeVoxelCount());
1120 }
1121
1122 { // average uniform density
1123
1124
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity(RasterMode::AVERAGE);
1125
1126
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(density);
1127
1128 const auto& tree = density->constTree();
1129
1130
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(6), tree.activeVoxelCount());
1131 }
1132
1133 { // maximum uniform density
1134
1135
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity(RasterMode::MAXIMUM);
1136
1137
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(density);
1138
1139 const auto& tree = density->constTree();
1140
1141
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(6), tree.activeVoxelCount());
1142 }
1143
1144 // add density attribute
1145
1146
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<float>(pointsTree, "densityAttr");
1147
1148
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 std::vector<float> densities{2.0f, 3.1f, 8.9f};
1149 PointAttributeVector<float> densityWrapper(densities);
1150
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 populateAttribute(pointsTree, pointIndexGrid->tree(), "densityAttr", densityWrapper);
1151
1152 // float w0 = densities[0] / 2.0f;
1153 // float w1 = densities[1];
1154 // float w2 = densities[2] / 5.0f;
1155
1156 { // accumulate density
1157
1158
3/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 taken 1 times.
2 auto density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE);
1159
1160
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(density);
1161
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1162
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1163
1164 const auto& tree = density->constTree();
1165
1166
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(6), tree.activeVoxelCount());
1167 }
1168
1169 { // average density
1170
1171
3/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 taken 1 times.
2 auto density = rasterizer.rasterizeDensity("densityAttr", RasterMode::AVERAGE);
1172
1173
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(density);
1174
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1175
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1176
1177 const auto& tree = density->constTree();
1178
1179
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(6), tree.activeVoxelCount());
1180 }
1181
1182 { // maximum density
1183
1184
3/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 taken 1 times.
2 auto density = rasterizer.rasterizeDensity("densityAttr", RasterMode::MAXIMUM);
1185
1186
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(density);
1187
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1188
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1189
1190 const auto& tree = density->constTree();
1191
1192
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(6), tree.activeVoxelCount());
1193 }
1194
1195 ////////////////////////////
1196
1197 // point filtering (select one point only which rasterizes to two voxels)
1198
1199
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(pointsTree, "test");
1200
1201
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership{1, 0, 0};
1202
1203
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(pointsTree, pointIndexGrid->tree(), membership, "test");
1204
1205
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
3 std::vector<Name> includeGroups{"test"};
1206 1 std::vector<Name> excludeGroups;
1207
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, pointsTree.cbeginLeaf()->attributeSet());
1208
1209
3/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 taken 1 times.
2 auto density = rasterizer.rasterizeDensity("densityAttr", RasterMode::ACCUMULATE, false, 1.0f, filter);
1210
1211
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(density);
1212
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->activeVoxelCount());
1213
1214 ////////////////////////////
1215
1216 // scale contribution by voxel volume
1217
1218
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.transform = transform->copy();
1219 1 settings.scaleByVoxelVolume = true;
1220
2/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
3 Rasterizer scaleRasterizer(settings);
1221
1222 1 const double voxelVolume = transform->voxelSize(Vec3d(0,0,0)).product();
1223
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(voxelVolume, (voxelSize * voxelSize * voxelSize));
1224
1225 // add points to rasterizer
1226
1227
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 scaleRasterizer.addPoints(points, /*stream=*/false);
1228
1229 { // accumulate uniform density
1230
1231
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = scaleRasterizer.rasterizeUniformDensity();
1232
1233
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(density);
1234
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1235
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1236
1237 const auto& tree = density->constTree();
1238
1239
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(6), tree.activeVoxelCount());
1240 }
1241 1 }
1242
1243
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestPointRasterizeFrustum, testCameraMotionBlur)
1244 {
1245 using Rasterizer = FrustumRasterizer<PointDataGrid>;
1246 using Settings = FrustumRasterizerSettings;
1247
1248 { // test RasterCamera API
1249 math::Transform::Ptr transform1a(
1250 1 math::Transform::createLinearTransform(0.5));
1251 math::Transform::Ptr transform1b(
1252
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(0.5));
1253 math::Transform::Ptr transform2(
1254
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(0.75));
1255
1256 // manually build frustum transform using camera API
1257
1258 math::NonlinearFrustumMap frustumMap(
1259 /*position*/Vec3d(0, 0, -10), /*direction*/Vec3d(0, 0, 1), /*up*/Vec3d(0, 1, 0),
1260
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 /*aspect*/1.5, /*znear*/0.001, /*depth*/20, /*xcount*/1000, /*zcount*/1000);
1261
1262
5/14
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
3 math::Transform::Ptr transform3 = math::Transform(frustumMap.copy()).copy();
1263
1264
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 RasterCamera camera(*transform1a);
1265
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(camera.isStatic());
1266
1267
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(-0.25, camera.shutterStart(), 1e-6);
1268
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.25, camera.shutterEnd(), 1e-6);
1269
1270 1 camera.setShutter(-0.3f, 0.8f);
1271
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(-0.3, camera.shutterStart(), 1e-6);
1272
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.8, camera.shutterEnd(), 1e-6);
1273
1274
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), camera.size());
1275
1276
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(*transform1a, camera.firstTransform());
1277
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(*transform1a, camera.lastTransform());
1278
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(*transform1a, camera.transform(0));
1279
1280 1 camera.clear();
1281
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(camera.isStatic());
1282
1283
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(0), camera.size());
1284
1285
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(*transform1a);
1286
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(*transform2);
1287
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(*transform1b);
1288
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(*transform3);
1289
1290
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(!camera.isStatic());
1291
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(4), camera.size());
1292
1293
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(*transform1a, camera.firstTransform());
1294
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(*transform3, camera.lastTransform());
1295
1/14
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
2 EXPECT_EQ(*transform2, camera.transform(1));
1296
1297 // simplify does nothing as the stored transforms do not match
1298
1299
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.simplify();
1300
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(4), camera.size());
1301
1302 1 camera.clear();
1303
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(*transform1a);
1304
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(*transform1b);
1305
1306
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(!camera.isStatic());
1307
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), camera.size());
1308
1309 // as the two transforms are identical, only keep one for efficiency
1310
1311
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.simplify();
1312
1313
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(camera.isStatic());
1314
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), camera.size());
1315 }
1316
1317 { // rasterize points with zero velocity to test multiple voxel contribution
1318 // that derives solely from moving the camera
1319
1320 std::vector<Vec3s> positions = {
1321 {0.0f, 1.2f, 0.0f},
1322 {100.0f, 100.0f, 50.0f},
1323 {1.1f, 1.23f, 0.0f},
1324
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
1325
1326 const PointAttributeVector<Vec3s> pointList(positions);
1327
1328 // leaf containing (0,1,0) voxel lives at (-0.25 => 3.75) in each axis world space for 0.5 voxel size
1329
1330 const double voxelSize = 0.5;
1331 math::Transform::Ptr transform(
1332
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
1333
1334 tools::PointIndexGrid::Ptr pointIndexGrid =
1335
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1336
1337 PointDataGrid::Ptr points =
1338
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1339
1340
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1341
1342 { // accumulate uniform density, static linear camera transform
1343
1344
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1345
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1346
1347
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
1348
1349
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(density);
1350
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1351
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1352
1353 const auto& tree = density->constTree();
1354
1355
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.0, tree.background(), 1e-6);
1356
1357
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(3), tree.activeVoxelCount());
1358
1359
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(1, tree.getValue(Coord(0, 2, 0)), 1e-6);
1360
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(1, tree.getValue(Coord(2, 2, 0)), 1e-6);
1361
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(1, tree.getValue(Coord(200, 200, 100)), 1e-6);
1362 }
1363
1364 { // accumulate uniform density, linear camera transform with X translation
1365
1366
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform startTransform(*transform);
1367
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 startTransform.preTranslate(openvdb::Vec3d(-1, 0, 0));
1368
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform endTransform(*transform);
1369
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 endTransform.preTranslate(openvdb::Vec3d(1, 0, 0));
1370
1371 auto& camera = settings.camera;
1372
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(1), camera.size());
1373 1 camera.clear();
1374
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(startTransform);
1375
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(endTransform);
1376
1377
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 Rasterizer rasterizer(settings);
1378
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1379
1380
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
1381
1382
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(density);
1383
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1384
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1385
1386 const auto& tree = density->constTree();
1387
1388
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.0, tree.background(), 1e-6);
1389
1390
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(8), tree.activeVoxelCount());
1391
1392 // point 0 - the rasterization is from the center of (-1, 2, 0) to the
1393 // center of (1, 2, 0), this means the contribution of these two end
1394 // voxels is half the contribution of (0, 2, 0) which the rasterization
1395 // ray passes entirely though. As the total contribution must add up to 1.0,
1396 // this means the values across these three voxels is 0.25, 0.5, 0.25
1397
1398 // point 1 - the rasterization is from the center of (199, 200, 100) to the
1399 // center of (201, 200, 100), this means the contribution of these two end
1400 // voxels is half the contribution of (200, 200, 100) which the rasterization
1401 // ray passes entirely though. As the total contribution must add up to 1.0,
1402 // this means the values across these three voxels is 0.25, 0.5, 0.25
1403
1404 // point 2 - the rasterization is between (1,2,0) and (3,2,0) but the ray
1405 // spends more time in the former than the latter with the rasterization
1406 // values for each voxel being 0.15, 0.5, 0.35
1407
1408 // note that voxel (1,2,0) receives contributions from point 0 and point 2
1409
1410 // point 0 contribution
1411
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.25, tree.getValue(Coord(-1, 2, 0)), 1e-6);
1412
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.5, tree.getValue(Coord(0, 2, 0)), 1e-6);
1413
1414 // point 0 and point 1 contribution (max of 0.25 and 0.15)
1415
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.25, tree.getValue(Coord(1, 2, 0)), 1e-6);
1416
1417 // point 1 contribution
1418
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.5, tree.getValue(Coord(2, 2, 0)), 1e-6);
1419
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.35, tree.getValue(Coord(3, 2, 0)), 1e-6);
1420
1421 // point 2 contribution
1422
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.25, tree.getValue(Coord(199, 200, 100)), 1e-6);
1423
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.5, tree.getValue(Coord(200, 200, 100)), 1e-6);
1424
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.25, tree.getValue(Coord(201, 200, 100)), 1e-6);
1425
1426 // re-rasterize using accumulate mode and verify voxel value that receives
1427 // contribution from two points
1428
1429
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 auto density2 = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE);
1430
1431
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.25 + 0.15, density2->tree().getValue(Coord(1, 2, 0)), 1e-6);
1432 }
1433 }
1434
1435 { // rasterize a single point with three camera transforms
1436 std::vector<Vec3s> positions = {
1437 {0.0f, 1.2f, 0.0f},
1438
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
1439
1440 const PointAttributeVector<Vec3s> pointList(positions);
1441
1442 const double voxelSize = 0.5;
1443 math::Transform::Ptr transform(
1444
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
1445
1446 tools::PointIndexGrid::Ptr pointIndexGrid =
1447
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1448
1449 PointDataGrid::Ptr points =
1450
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1451
1452
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1453
1454
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform startTransform(*transform);
1455
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 startTransform.preTranslate(openvdb::Vec3d(0, 0, 0));
1456
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform middleTransform(*transform);
1457
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 middleTransform.preTranslate(openvdb::Vec3d(2, 0, 0));
1458
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform endTransform(*transform);
1459
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 endTransform.preTranslate(openvdb::Vec3d(2, 2, 0));
1460
1461 auto& camera = settings.camera;
1462 1 camera.clear();
1463
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(startTransform);
1464
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(middleTransform);
1465
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.appendTransform(endTransform);
1466
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 camera.simplify();
1467
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(3), camera.size());
1468
1469 { // point rasterize with two motion samples
1470
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1471
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1472
1473
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
1474
1475
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(density);
1476
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1477
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1478
1479 const auto& tree = density->constTree();
1480
1481
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.0, tree.background(), 1e-6);
1482
1483 float total = 0.0f;
1484
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (auto leaf = tree.cbeginLeaf(); leaf; ++leaf) {
1485
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
5 for (auto iter = leaf->cbeginValueOn(); iter; ++iter) {
1486
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 total += iter.getValue();
1487 }
1488 }
1489
1490
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(1.0, total, 1e-6);
1491 }
1492
1493 { // point rasterize with three motion samples
1494 // this value must be set explicitly and must be less than or equal to the
1495 // number of camera transforms, if motion samples is left at the default value of 2
1496 // this simply ignores the middle transform (as above)
1497 1 settings.motionSamples = 3;
1498
1499
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 Rasterizer rasterizer(settings);
1500
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1501
1502
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
1503
1504
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(density);
1505
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_EQ(openvdb::Name("density"), density->getName());
1506
1/14
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
1 EXPECT_EQ(density->transform(), *transform);
1507
1508 const auto& tree = density->constTree();
1509
1510
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(0.0, tree.background(), 1e-6);
1511
1512 float total = 0.0f;
1513
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (auto leaf = tree.cbeginLeaf(); leaf; ++leaf) {
1514
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
7 for (auto iter = leaf->cbeginValueOn(); iter; ++iter) {
1515
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 total += iter.getValue();
1516 }
1517 }
1518
1519
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(1.0, total, 1e-6);
1520 }
1521 }
1522 1 }
1523
1524 #ifndef ONLY_RASTER_FLOAT
1525
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testBool)
1526 {
1527 std::vector<Vec3s> positions = {
1528 {0.0f, 1.2f, 0.0f},
1529 {100.0f, 100.0f, 50.0f},
1530 {1.1f, 1.23f, 0.0f},
1531
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
1532
1533 const PointAttributeVector<Vec3s> pointList(positions);
1534
1535 // leaf containing (0,1,0) voxel lives at (-0.25 => 3.75) in each axis world space for 0.5 voxel size
1536
1537 const double voxelSize = 0.5;
1538 math::Transform::Ptr transform(
1539
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
1540
1541 tools::PointIndexGrid::Ptr pointIndexGrid =
1542
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1543
1544 PointDataGrid::Ptr points =
1545
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1546 auto& pointsTree = points->tree();
1547
1548 using Rasterizer = FrustumRasterizer<PointDataGrid>;
1549 using Settings = FrustumRasterizerSettings;
1550
1551 {
1552
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1553 1 settings.velocityMotionBlur = false;
1554
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1555
1556 // add points to rasterizer
1557
1558
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1559
1560 // verify ability to rasterize bool or mask grids
1561
1562
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto boolGrid = rasterizer.rasterizeMask<BoolGrid>();
1563
1564
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(boolGrid->isType<BoolGrid>());
1565
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(Name("mask"), boolGrid->getName());
1566
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(3), boolGrid->activeVoxelCount());
1567
1568
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 auto maskGrid = rasterizer.rasterizeMask<MaskGrid>();
1569
1570
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(maskGrid->isType<MaskGrid>());
1571
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(Name("mask"), maskGrid->getName());
1572
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(3), maskGrid->activeVoxelCount());
1573
1574 // throw if attempting to use average mode when rasterizing a mask
1575
6/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
2 EXPECT_THROW((rasterizer.rasterizeAttribute<BoolGrid, bool>("", RasterMode::AVERAGE)),
1576 ValueError);
1577
1578 // throw if attempting to use maximum mode when rasterizing a mask
1579
6/26
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
2 EXPECT_THROW((rasterizer.rasterizeAttribute<BoolGrid, bool>("", RasterMode::MAXIMUM)),
1580 ValueError);
1581 }
1582
1583 // append velocity attribute
1584
1585
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendAttribute<Vec3s>(pointsTree, "v");
1586
1587 std::vector<Vec3s> velocities = {
1588 {0.0f, 10.0f, 0.0f},
1589 {1.0f, 2.0f, 3.0f},
1590 {-3.0f, -2.0f, -1.0f},
1591
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 };
1592 PointAttributeVector<Vec3s> velocityWrapper(velocities);
1593
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(pointsTree, pointIndexGrid->tree(), "v", velocityWrapper);
1594
1595 // use velocity motion blur
1596
1597 {
1598
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1599 1 settings.velocityMotionBlur = true;
1600
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1601
1602 // add points to rasterizer
1603
1604
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1605
1606 // verify ability to rasterize bool or mask grids
1607
1608
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto boolGrid = rasterizer.rasterizeMask<BoolGrid>();
1609
1610
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(boolGrid->isType<BoolGrid>());
1611
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(Name("mask"), boolGrid->getName());
1612
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(5), boolGrid->activeVoxelCount());
1613
1614
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 auto maskGrid = rasterizer.rasterizeMask<MaskGrid>();
1615
1616
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(maskGrid->isType<MaskGrid>());
1617
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(Name("mask"), maskGrid->getName());
1618
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(5), maskGrid->activeVoxelCount());
1619 }
1620 1 }
1621
1622
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testInt)
1623 {
1624 std::vector<Vec3s> positions = {
1625 {0.0f, 1.2f, 0.0f},
1626 {0.0f, 0.6f, 0.1f},
1627 {1.1f, 1.23f, 0.0f},
1628
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
1629
1630 const PointAttributeVector<Vec3s> pointList(positions);
1631
1632 // leaf containing (0,1,0) voxel lives at (-0.25 => 3.75) in each axis world space for 0.5 voxel size
1633
1634 const double voxelSize = 0.5;
1635 math::Transform::Ptr transform(
1636
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
1637
1638 tools::PointIndexGrid::Ptr pointIndexGrid =
1639
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1640
1641 PointDataGrid::Ptr points =
1642
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1643 auto& pointsTree = points->tree();
1644
1645 // append id attribute
1646
1647
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<int>(pointsTree, "id");
1648
1649
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 std::vector<int> ids = { 1, 2, 3 };
1650 PointAttributeVector<int> idWrapper(ids);
1651
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(pointsTree, pointIndexGrid->tree(), "id", idWrapper);
1652
1653 // append velocity attribute
1654
1655
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendAttribute<Vec3s>(pointsTree, "v");
1656
1657 std::vector<Vec3s> velocities = {
1658 {0.0f, 10.0f, 0.0f},
1659 {0.0f, 24.0f, 0.0f},
1660 {0.0f, -2.0f, 0.0f},
1661
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 };
1662 PointAttributeVector<Vec3s> velocityWrapper(velocities);
1663
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(pointsTree, pointIndexGrid->tree(), "v", velocityWrapper);
1664
1665 using Rasterizer = FrustumRasterizer<PointDataGrid>;
1666 using Settings = FrustumRasterizerSettings;
1667
1668 {
1669
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1670 1 settings.velocityMotionBlur = true;
1671
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1672
1673 // add points to rasterizer
1674
1675
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1676
1677 { // rasterize int grid with accumulate mode
1678
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 auto intGrid = rasterizer.rasterizeAttribute("id", RasterMode::ACCUMULATE);
1679
1680
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(intGrid->isType<Int32Grid>());
1681
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
2 EXPECT_EQ(Name("id"), intGrid->getName());
1682
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(5), intGrid->activeVoxelCount());
1683
1684
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto intGridTyped = GridBase::grid<Int32Grid>(intGrid);
1685
1686
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2, intGridTyped->tree().getValue(Coord(0,1,0)));
1687
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(3, intGridTyped->tree().getValue(Coord(0,2,0)));
1688 }
1689
1690 { // rasterize int grid with maximum mode
1691
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 auto intGrid = rasterizer.rasterizeAttribute("id", RasterMode::MAXIMUM);
1692
1693
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(5), intGrid->activeVoxelCount());
1694
1695
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto intGridTyped = GridBase::grid<Int32Grid>(intGrid);
1696
1697
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2, intGridTyped->tree().getValue(Coord(0,1,0)));
1698
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(2, intGridTyped->tree().getValue(Coord(0,2,0)));
1699 }
1700 }
1701 1 }
1702 #endif
1703
1704
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestPointRasterizeFrustum, testInputs)
1705 {
1706 using Rasterizer = FrustumRasterizer<PointDataGrid>;
1707 using Settings = FrustumRasterizerSettings;
1708
1709 1 auto empty = PointDataGrid::create();
1710
1711 const double voxelSize = 0.5;
1712 math::Transform::Ptr transform(
1713
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(voxelSize));
1714
1715 // attempt to create a rasterizer with velocity motion blur enabled,
1716 // but no velocity attribute name throws
1717
1718
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*transform);
1719
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityAttribute = "";
1720
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityMotionBlur = true;
1721
1722
5/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
2 EXPECT_THROW(Rasterizer{settings}, ValueError);
1723
1724 // reset velocity attribute
1725
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityAttribute = "v";
1726
1727 // adding an empty points grid still produces an empty grid
1728
1729
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1730
5/22
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
1 EXPECT_NO_THROW(rasterizer.addPoints(empty));
1731
1732
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
1733
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(0), density->activeVoxelCount());
1734
1735 #ifndef ONLY_RASTER_FLOAT
1736 // attempting to rasterize position is not allowed
1737
1738
6/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
2 EXPECT_THROW((rasterizer.rasterizeAttribute<Vec3SGrid, Vec3s>("P")), ValueError);
1739 #endif
1740
1741 // add a points grid that contains points
1742
1743 std::vector<Vec3s> positions = {
1744 {0.0f, 1.2f, 0.0f},
1745 {100.0f, 100.0f, 50.0f},
1746 {1.1f, 1.23f, 0.0f},
1747
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 };
1748
1749 const PointAttributeVector<Vec3s> pointList(positions);
1750
1751 tools::PointIndexGrid::Ptr pointIndexGrid =
1752
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1753
1754 PointDataGrid::Ptr points =
1755
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1756
1757
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points);
1758
1759 // attempting to rasterize an attribute that doesn't exist simply ignores that grid
1760
1761 1 FloatGrid::Ptr invalidAttributeGrid;
1762
6/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 34 not taken.
✗ Branch 35 not taken.
1 EXPECT_NO_THROW((invalidAttributeGrid =
1763 rasterizer.rasterizeAttribute<FloatGrid, float>("invalidAttribute")));
1764
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(invalidAttributeGrid);
1765
1766 #ifndef ONLY_RASTER_FLOAT
1767 // add density attribute
1768
1769
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendAttribute<float>(points->tree(), "density");
1770
1771
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 std::vector<float> densities{2.0f, 3.1f, 8.9f};
1772 PointAttributeVector<float> densityWrapper(densities);
1773
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 populateAttribute(points->tree(), pointIndexGrid->tree(), "density", densityWrapper);
1774
1775 // attempting to rasterize an attribute with the wrong value type should error
1776
1777
6/26
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
✗ Branch 38 not taken.
2 EXPECT_THROW((rasterizer.rasterizeAttribute<DoubleGrid, double>("density")),
1778 TypeError);
1779 #endif
1780 1 }
1781
1782
1783 namespace
1784 {
1785
1786 // Test thread-safe Interrupter that halts on the second interrupt check
1787 struct HaltOnSecondInterrupt : public util::NullInterrupter
1788 {
1789 /// Default constructor
1790 HaltOnSecondInterrupt() = default;
1791 4 void start(const char* name = NULL) override { (void)name; }
1792 4 void end() override {}
1793 /// Check if an interruptible operation should be aborted.
1794
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1062 times.
1067 inline bool wasInterrupted(int percent = -1) override
1795 {
1796 (void)percent;
1797
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1062 times.
1067 if (mInterrupt) return true;
1798 mInterrupt = true;
1799 5 return false;
1800 }
1801 std::atomic<bool> mInterrupt{false};
1802 };
1803
1804 } // namespace
1805
1806
1807
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testInterrupter)
1808 {
1809 using Rasterizer = FrustumRasterizer<PointDataGrid>;
1810 using Settings = FrustumRasterizerSettings;
1811 using Mask = FrustumRasterizerMask;
1812 using InterruptRasterizer = FrustumRasterizer<PointDataGrid>;
1813
1814 // manually build frustum transform using camera API
1815
1816 Vec3d position(9.5, 7.8, 21.7);
1817
1818 math::NonlinearFrustumMap frustumMap(
1819 /*position*/position, /*direction*/-position.unit(), /*up*/-position.unit().cross(Vec3d(0,1,0)) * 10,
1820
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 /*aspect*/0.75, /*znear*/10, /*depth*/100, /*xcount*/100, /*zcount*/400);
1821
1822
4/10
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
3 math::Transform::Ptr frustum = math::Transform(frustumMap.copy()).copy();
1823
1824 // build a level set sphere
1825
1826 Vec3s center(0, 0, 0);
1827 // float radius = 1;
1828 float radius = 10;
1829 float voxelSize = 0.2f;
1830
1831
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto surface = tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize);
1832
1833 // scatter points inside the sphere
1834
1835
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = points::denseUniformPointScatter(*surface, /*pointsPerVoxel=*/8);
1836
1837 // rasterize without an interrupter
1838
1839
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustum);
1840
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityAttribute = "";
1841 1 settings.velocityMotionBlur = false;
1842 Mask mask;
1843 { // rasterize as points
1844
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1845
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points);
1846
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
1847
1848 { // verify this test interrupter interrupts the second time
1849 1 HaltOnSecondInterrupt interrupter;
1850
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(!interrupter.wasInterrupted());
1851
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(interrupter.wasInterrupted());
1852
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(interrupter.wasInterrupted());
1853 }
1854
1855 { // rasterize with the interrupter with threading enabled (relies on TBB's cancel_group_execution())
1856 1 HaltOnSecondInterrupt interrupter;
1857
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 InterruptRasterizer interruptRasterizer(settings, mask, &interrupter);
1858
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 interruptRasterizer.addPoints(points);
1859
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto interruptDensity = interruptRasterizer.rasterizeUniformDensity();
1860
1861
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(interrupter.wasInterrupted());
1862
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(interruptDensity->activeVoxelCount() > Index64(0));
1863
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
1 EXPECT_TRUE(interruptDensity->activeVoxelCount() < Index64(density->activeVoxelCount()));
1864 }
1865
1866 { // rasterize with the interrupter with threading disabled
1867 1 HaltOnSecondInterrupt interrupter;
1868 1 settings.threaded = false;
1869
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 InterruptRasterizer interruptRasterizer(settings, mask, &interrupter);
1870
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 interruptRasterizer.addPoints(points);
1871
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto interruptDensity = interruptRasterizer.rasterizeUniformDensity();
1872
1873
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(interrupter.wasInterrupted());
1874
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(interruptDensity->activeVoxelCount() > Index64(0));
1875
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
1 EXPECT_TRUE(interruptDensity->activeVoxelCount() < Index64(density->activeVoxelCount()));
1876 }
1877 }
1878
1879 { // rasterize as spheres
1880 std::vector<Vec3s> positions = {
1881 {0, 0, 0},
1882 {10, 10, 10}
1883
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 };
1884
1885 const PointAttributeVector<Vec3s> pointList(positions);
1886
1887 math::Transform::Ptr transform(
1888
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(/*voxelSize=*/1.0f));
1889
1890 tools::PointIndexGrid::Ptr pointIndexGrid =
1891
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1892
1893 PointDataGrid::Ptr points =
1894
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1895
1896
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustum);
1897 1 settings.useRadius = true;
1898 1 settings.radiusScale = 2.0f;
1899
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
1900
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points);
1901
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
1902
1903 { // rasterize with the interrupter with threading enabled (relies on TBB's cancel_group_execution())
1904 1 HaltOnSecondInterrupt interrupter;
1905
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 InterruptRasterizer interruptRasterizer(settings, mask, &interrupter);
1906
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 interruptRasterizer.addPoints(points);
1907
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto interruptDensity = interruptRasterizer.rasterizeUniformDensity();
1908
1909
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(interrupter.wasInterrupted());
1910
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(interruptDensity->activeVoxelCount() > Index64(0));
1911
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
1 EXPECT_TRUE(interruptDensity->activeVoxelCount() < Index64(density->activeVoxelCount()));
1912 }
1913
1914 { // rasterize with a very large radius to ensure interrupt is triggered early
1915 1 settings.radiusScale = 100.0f;
1916
1917 1 HaltOnSecondInterrupt interrupter;
1918
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 InterruptRasterizer interruptRasterizer(settings, mask, &interrupter);
1919
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 interruptRasterizer.addPoints(points);
1920
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto interruptDensity = interruptRasterizer.rasterizeUniformDensity();
1921
1922
1/16
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_TRUE(interrupter.wasInterrupted());
1923
1924 // when a large sphere is used, interrupt is done per XY slice,
1925 // which results in an empty density grid
1926
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(0), interruptDensity->activeVoxelCount());
1927 }
1928 }
1929 1 }
1930
1931
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testClipping)
1932 {
1933 std::vector<Vec3s> positions = {
1934 {0, 0, 0},
1935 {0, 2, -2},
1936 {3, 4, 0},
1937 {1, 4, 1},
1938 {2, 5, 2},
1939
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 };
1940
1941 const PointAttributeVector<Vec3s> pointList(positions);
1942
1943 math::Transform::Ptr transform(
1944
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(/*voxelSize=*/0.5f));
1945
1946 math::Transform::Ptr outputTransform(
1947
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::createLinearTransform(/*voxelSize=*/1.0f));
1948
1949 tools::PointIndexGrid::Ptr pointIndexGrid =
1950
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 tools::createPointIndexGrid<tools::PointIndexGrid>(pointList, *transform);
1951
1952 PointDataGrid::Ptr points =
1953
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList, *transform);
1954 auto& tree = points->tree();
1955
1956 using Rasterizer = FrustumRasterizer<PointDataGrid>;
1957 using Settings = FrustumRasterizerSettings;
1958 using Mask = FrustumRasterizerMask;
1959
1960 { // default settings (except no motion-blur), no clip bbox or clip mask
1961
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*outputTransform);
1962 1 settings.velocityMotionBlur = false;
1963
1964 Mask mask;
1965
1966
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings, mask);
1967
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1968
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
1969
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(5), density->tree().activeVoxelCount());
1970 }
1971
1972 { // clip bbox that eliminates fifth point
1973
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*outputTransform);
1974
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityMotionBlur = false;
1975
1976
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask mask(*outputTransform, nullptr, BBoxd(Vec3d(-0.5,-0.5,-2.5), Vec3d(4.0,4.0,3)));
1977
1978
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings, mask);
1979
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1980
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
1981
1982
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(4), density->tree().activeVoxelCount());
1983 }
1984
1985 { // clip bbox that only keeps first two points
1986
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*outputTransform);
1987
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityMotionBlur = false;
1988
1989
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask mask(*outputTransform, nullptr, BBoxd(Vec3d(-0.5,-0.5,-2.5), Vec3d(1,3,0.5)));
1990
1991
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings, mask);
1992
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
1993
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
1994
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(2), density->tree().activeVoxelCount());
1995 }
1996
1997 { // clip mask that keeps all but the fifth point
1998
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto sphere = tools::createLevelSetSphere<FloatGrid>(5.5f, openvdb::Vec3f(0), 1.0f);
1999
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto sphereBool = tools::interiorMask(*sphere);
2000
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto sphereMask = MaskGrid::Ptr(new MaskGrid(*sphereBool));
2001
2002
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*outputTransform);
2003
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityMotionBlur = false;
2004
2005
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask mask(*outputTransform, sphereMask.get());
2006
2007
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings, mask);
2008
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2009
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
2010
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(4), density->tree().activeVoxelCount());
2011 }
2012
2013 { // clip mask that keeps all but the first two points
2014
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto sphere = tools::createLevelSetSphere<FloatGrid>(5.0f, openvdb::Vec3f(0), 1.0f);
2015
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto sphereBool = tools::interiorMask(*sphere);
2016
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto sphereMask = MaskGrid::Ptr(new MaskGrid(*sphereBool));
2017
2018
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*outputTransform);
2019
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityMotionBlur = false;
2020
2021
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask mask(*outputTransform, sphereMask.get());
2022
2023
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings, mask);
2024
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2025
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
2026
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(3), density->tree().activeVoxelCount());
2027 }
2028
2029 { // clip mask that only keeps first two points
2030
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 auto sphere = tools::createLevelSetSphere<FloatGrid>(5.0f, openvdb::Vec3f(0), 1.0f);
2031
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto sphereBool = tools::interiorMask(*sphere);
2032
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto sphereMask = MaskGrid::Ptr(new MaskGrid(*sphereBool));
2033
2034 // third point coord for lookup
2035 Coord coord(1, 4, 1);
2036
2037 sphereMask->tree().setValueOff(coord);
2038
2039
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*outputTransform);
2040
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.velocityMotionBlur = false;
2041
2042
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask mask(*outputTransform, sphereMask.get());
2043
2044 1 settings.threaded = false;
2045
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings, mask);
2046
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2047
2048
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
2049
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->tree().activeVoxelCount());
2050
2051 // introduce group where third point is disabled
2052
2053
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test");
2054
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership{1, 1, 0, 1, 1};
2055
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership, "test");
2056
2057
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
3 std::vector<Name> includeGroups{"test"};
2058 1 std::vector<Name> excludeGroups;
2059
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 MultiGroupFilter filter(includeGroups, excludeGroups, tree.cbeginLeaf()->attributeSet());
2060
2061 // re-enable mask voxel for third point
2062
2063 sphereMask->tree().setValueOn(coord);
2064
2065 // filter with group filtering and mask clipping
2066
2067
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE, false, 1.0f, filter);
2068
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(2), density->tree().activeVoxelCount());
2069
2070 sphereMask->tree().setValueOff(coord);
2071
2072 // invert the mask
2073
2074 Mask invertMask(*outputTransform, sphereMask.get(), BBoxd(),
2075
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 /*clipToFrustum=*/false, /*invert=*/true);
2076
2077
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer2(settings, invertMask);
2078
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer2.addPoints(points, /*stream=*/false);
2079
2080
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer2.rasterizeUniformDensity(RasterMode::ACCUMULATE, false, 1.0f);
2081
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(3), density->tree().activeVoxelCount());
2082 }
2083 1 }
2084
2085
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestPointRasterizeFrustum, testStreaming)
2086 {
2087
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 Name filename("rasterpoints.vdb");
2088
2089 // manually build frustum transform using camera API
2090
2091 Vec3d position(9.5, 7.8, 21.7);
2092
2093 math::NonlinearFrustumMap frustumMap(
2094 /*position*/position, /*direction*/-position.unit(), /*up*/-position.unit().cross(Vec3d(0,1,0)) * 10,
2095
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 /*aspect*/0.75, /*znear*/10, /*depth*/100, /*xcount*/100, /*zcount*/400);
2096
2097
5/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
3 math::Transform::Ptr frustum = math::Transform(frustumMap.copy()).copy();
2098
2099 // build the level set sphere
2100
2101 Vec3s center(0, 0, 0);
2102 float radius = 10;
2103 float voxelSize = 0.2f;
2104
2105
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto surface = tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize);
2106
2107 // scatter points inside the sphere
2108
2109
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = points::denseUniformPointScatter(*surface, /*pointsPerVoxel=*/8);
2110
2111 // append and expand attributes, as they're uniform when created
2112
2113
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<float>(points->tree(), "density");
2114
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 points::appendAttribute<Vec3f>(points->tree(), "v");
2115
2116
2/2
✓ Branch 0 taken 1043 times.
✓ Branch 1 taken 1 times.
1044 for (auto leaf = points->tree().beginLeaf(); leaf; ++leaf) {
2117
3/6
✓ Branch 1 taken 1043 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1043 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1043 times.
✗ Branch 8 not taken.
1043 AttributeWriteHandle<float> densityHandle(leaf->attributeArray("density"));
2118
1/2
✓ Branch 1 taken 1043 times.
✗ Branch 2 not taken.
1043 densityHandle.collapse(1.0f);
2119
1/2
✓ Branch 1 taken 1043 times.
✗ Branch 2 not taken.
1043 densityHandle.expand();
2120
2121
3/6
✓ Branch 1 taken 1043 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1043 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1043 times.
✗ Branch 8 not taken.
1043 AttributeWriteHandle<Vec3s> velocityHandle(leaf->attributeArray("v"));
2122
1/2
✓ Branch 1 taken 1043 times.
✗ Branch 2 not taken.
1043 velocityHandle.expand();
2123 }
2124
2125 // set name and transform
2126
2127
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const math::Transform::Ptr xform = math::Transform::createLinearTransform(voxelSize);
2128
2129
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 points->setName("points");
2130
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 points->setTransform(xform);
2131
2132 // write points to file
2133
2134 1 GridCPtrVec grids;
2135 grids.push_back(points);
2136
2137 {
2138
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2139 file.write(grids);
2140
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2141 }
2142
2143 // read points from file (using delayed loading)
2144
2145 {
2146
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2147
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.open();
2148
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 openvdb::GridBase::Ptr baseGrid = file.readGrid("points");
2149
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2150
2151
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 points = openvdb::gridPtrCast<PointDataGrid>(baseGrid);
2152 }
2153
2154 auto leaf = points->tree().cbeginLeaf();
2155
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(leaf);
2156
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(leaf->buffer().isOutOfCore());
2157
2158 using Rasterizer = FrustumRasterizer<PointDataGrid>;
2159 using Settings = FrustumRasterizerSettings;
2160 using Mask = FrustumRasterizerMask;
2161
2162
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustum);
2163 1 settings.velocityMotionBlur = true;
2164
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings.threshold = 0.0f; // disable threshold when testing streaming
2165
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask mask(*frustum);
2166
2167
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings, mask);
2168
2169 // add points to rasterizer
2170
2171
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2172
2173
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isStreaming());
2174
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isStreaming());
2175
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isStreaming());
2176
2177
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isUniform());
2178
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isUniform());
2179
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isUniform());
2180
2181
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 auto density = rasterizer.rasterizeUniformDensity();
2182
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(74242), density->activeVoxelCount());
2183
2184 // streaming is disabled, so all attributes should still be non-uniform
2185
2186
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isStreaming());
2187
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isStreaming());
2188
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isStreaming());
2189
2190
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isUniform());
2191
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isUniform());
2192
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isUniform());
2193
2194 1 rasterizer.clear();
2195
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/true);
2196
2197
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE, /*reduceMemory=*/false);
2198
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(74242), density->activeVoxelCount());
2199
2200 // streaming is enabled, but reduce memory is false,
2201 // so all attributes should still be non-uniform
2202
2203
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isStreaming());
2204
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isStreaming());
2205
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isStreaming());
2206
2207
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isUniform());
2208
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isUniform());
2209
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isUniform());
2210
2211 // reopen file
2212 {
2213
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2214
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.open();
2215
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 openvdb::GridBase::Ptr baseGrid = file.readGrid("points");
2216
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2217
2218
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 points = openvdb::gridPtrCast<PointDataGrid>(baseGrid);
2219 }
2220 1 leaf = points->tree().cbeginLeaf();
2221
2222 1 rasterizer.clear();
2223
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/true);
2224
2225
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 density = rasterizer.rasterizeUniformDensity(RasterMode::ACCUMULATE, /*reduceMemory=*/true);
2226
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(74242), density->activeVoxelCount());
2227
2228 // with streaming and reduce memory both true, position and velocity should be uniform
2229
2230
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
2 EXPECT_TRUE(leaf->constAttributeArray("P").isStreaming());
2231
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isStreaming());
2232
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
2 EXPECT_TRUE(leaf->constAttributeArray("v").isStreaming());
2233
2234
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
3 EXPECT_TRUE(leaf->constAttributeArray("P").isUniform());
2235
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isUniform());
2236
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
3 EXPECT_TRUE(leaf->constAttributeArray("v").isUniform());
2237
2238 // reopen file
2239 {
2240
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2241
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.open();
2242
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 openvdb::GridBase::Ptr baseGrid = file.readGrid("points");
2243
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2244
2245
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 points = openvdb::gridPtrCast<PointDataGrid>(baseGrid);
2246 }
2247 1 leaf = points->tree().cbeginLeaf();
2248
2249 1 rasterizer.clear();
2250
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/true);
2251
2252 // when rasterizing density, all attributes now become uniform
2253
2254
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
2 density = rasterizer.rasterizeDensity("density", RasterMode::ACCUMULATE, /*reduceMemory=*/true);
2255
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(74242), density->activeVoxelCount());
2256
2257
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
2 EXPECT_TRUE(leaf->constAttributeArray("P").isStreaming());
2258
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
2 EXPECT_TRUE(leaf->constAttributeArray("density").isStreaming());
2259
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
2 EXPECT_TRUE(leaf->constAttributeArray("v").isStreaming());
2260
2261
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
3 EXPECT_TRUE(leaf->constAttributeArray("P").isUniform());
2262
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
3 EXPECT_TRUE(leaf->constAttributeArray("density").isUniform());
2263
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
3 EXPECT_TRUE(leaf->constAttributeArray("v").isUniform());
2264
2265 #ifndef ONLY_RASTER_FLOAT
2266 // reopen file
2267 {
2268
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2269
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.open();
2270
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 openvdb::GridBase::Ptr baseGrid = file.readGrid("points");
2271
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2272
2273
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 points = openvdb::gridPtrCast<PointDataGrid>(baseGrid);
2274 }
2275 1 leaf = points->tree().cbeginLeaf();
2276
2277 1 rasterizer.clear();
2278
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/true);
2279
2280 // now verify that rasterizing velocity then density with streaming
2281 // enabled completes successfully
2282
2283
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 auto velocity = rasterizer.rasterizeAttribute("v", RasterMode::ACCUMULATE, /*reduceMemory=*/false);
2284
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(74242), velocity->activeVoxelCount());
2285
2286
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isStreaming());
2287
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isStreaming());
2288
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isStreaming());
2289
2290
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("P").isUniform());
2291
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isUniform());
2292
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("v").isUniform());
2293
2294
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
2 velocity = rasterizer.rasterizeAttribute("v", RasterMode::ACCUMULATE, /*reduceMemory=*/true);
2295
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(Index64(74242), velocity->activeVoxelCount());
2296
2297
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
2 EXPECT_TRUE(leaf->constAttributeArray("P").isStreaming());
2298
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isStreaming());
2299
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
2 EXPECT_TRUE(leaf->constAttributeArray("v").isStreaming());
2300
2301
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
3 EXPECT_TRUE(leaf->constAttributeArray("P").isUniform());
2302
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
2 EXPECT_TRUE(!leaf->constAttributeArray("density").isUniform());
2303
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
3 EXPECT_TRUE(leaf->constAttributeArray("v").isUniform());
2304 #endif
2305
2306 // reopen file
2307 {
2308
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2309
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.open();
2310
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 openvdb::GridBase::Ptr baseGrid = file.readGrid("points");
2311
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2312
2313
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 points = openvdb::gridPtrCast<PointDataGrid>(baseGrid);
2314 }
2315
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 leaf = points->tree().cbeginLeaf();
2316
2317 // copy and translate the transform
2318
2319
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto transform = points->transform().copy();
2320
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 transform->preTranslate(Vec3d(0, 100, 0));
2321
2322 // deep-copy the points grid and apply the new transform
2323
2324
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points2 = points->deepCopy();
2325
2/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
2 points2->setTransform(transform);
2326
2327 // verify both grids are out-of-core
2328
2329
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(points->tree().cbeginLeaf()->buffer().isOutOfCore());
2330
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(points2->tree().cbeginLeaf()->buffer().isOutOfCore());
2331
2332 #ifndef ONLY_RASTER_FLOAT
2333 // memory tests
2334
2335
4/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
1 if (io::Archive::isDelayedLoadingEnabled() && io::Archive::hasBloscCompression()) {
2336
2337 1 FloatGrid::Ptr density1, density2, density3;
2338 1 Vec3SGrid::Ptr velocity1, velocity2, velocity3;
2339
2340 const size_t mb = 1024*1024;
2341 const size_t tinyMemory = static_cast<size_t>(0.1*mb);
2342
2343 size_t initialMemory;
2344
2345 { // memory test 1 - retain caches and streaming disabled
2346
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2347
2348
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2349
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points2, /*stream=*/false);
2350
2351
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 initialMemory = rasterizer.memUsage();
2352
2353
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(initialMemory > size_t(4*mb) && initialMemory < size_t(16*mb));
2354
2355
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), rasterizer.size());
2356
2357
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 velocity1 = rasterizer.rasterizeAttribute<Vec3SGrid, Vec3s>("v");
2358
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(219780), velocity1->activeVoxelCount());
2359
2360
5/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
1 EXPECT_TRUE(rasterizer.memUsage() > size_t(71*mb) &&
2361 rasterizer.memUsage() < size_t(91*mb));
2362
2363
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 density1 = rasterizer.rasterizeDensity("density");
2364
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(219780), density1->activeVoxelCount());
2365
2366 // no data is discarded so expect a fairly high memory footprint
2367
2368
5/24
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
✗ Branch 33 not taken.
1 EXPECT_TRUE(rasterizer.memUsage() > size_t(80*mb) &&
2369 rasterizer.memUsage() < size_t(100*mb));
2370 }
2371
2372 { // memory test 2 - retain caches and streaming enabled
2373
2374 { // reopen file and deep copy while setting transform
2375
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2376
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.open();
2377
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 openvdb::GridBase::Ptr baseGrid = file.readGrid("points");
2378
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2379
2380
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 points = openvdb::gridPtrCast<PointDataGrid>(baseGrid);
2381
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 points2 = points->deepCopy();
2382
2/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 points2->setTransform(transform);
2383 }
2384
2385
1/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
2 Rasterizer rasterizer(settings);
2386
2387
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/true);
2388
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points2, /*stream=*/true);
2389
2390
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(initialMemory, rasterizer.memUsage());
2391
2392
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), rasterizer.size());
2393
2394
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 velocity2 = rasterizer.rasterizeAttribute<Vec3SGrid, Vec3s>("v");
2395
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(219780), velocity2->activeVoxelCount());
2396
2397
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 size_t postRasterMemory = rasterizer.memUsage();
2398
2399
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(postRasterMemory > size_t(70*mb) && postRasterMemory < size_t(85*mb));
2400
2401
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 density2 = rasterizer.rasterizeDensity("density");
2402
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(219780), density2->activeVoxelCount());
2403
2404 // as data is being streamed, second attribute shouldn't change memory usage very much
2405
2406
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(rasterizer.memUsage() < (postRasterMemory + tinyMemory));
2407 }
2408
2409 { // memory test 3 - release caches and streaming enabled
2410
2411 { // reopen file and deep copy while setting transform
2412
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 io::File file(filename);
2413
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.open();
2414
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 openvdb::GridBase::Ptr baseGrid = file.readGrid("points");
2415
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 file.close();
2416
2417
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 points = openvdb::gridPtrCast<PointDataGrid>(baseGrid);
2418
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 points2 = points->deepCopy();
2419
2/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 points2->setTransform(transform);
2420 }
2421
2422
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points3 = points->deepCopy();
2423
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points4 = points2->deepCopy();
2424
2425
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings2(*frustum);
2426
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 settings2.threshold = 0.0f;
2427
2428
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Mask mask2(*frustum, nullptr, BBoxd(), /*clipToFrustum=*/false);
2429
2430
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Rasterizer rasterizer(settings2, mask2);
2431
2432
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/true);
2433
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points2, /*stream=*/true);
2434
2435
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(initialMemory, rasterizer.memUsage());
2436
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), rasterizer.size());
2437
2438
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 density3 = rasterizer.rasterizeDensity("density", RasterMode::ACCUMULATE, true);
2439
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(219780), density3->activeVoxelCount());
2440
2441 // all voxel data, attribute data and caches are being discarded,
2442 // so memory after rasterizing shouldn't change very much
2443
2444
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(rasterizer.memUsage() < (initialMemory + tinyMemory));
2445
2446 // deep-copies of delay-loaded point grids need to be used for repeat rasterization
2447
2448 1 rasterizer.clear();
2449
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points3, /*stream=*/true);
2450
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points4, /*stream=*/true);
2451
2452
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(size_t(2), rasterizer.size());
2453
2454
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_TRUE(rasterizer.memUsage() < (initialMemory + tinyMemory));
2455
2456
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 velocity3 = rasterizer.rasterizeAttribute<Vec3SGrid, Vec3s>("v", RasterMode::ACCUMULATE, true);
2457
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(Index64(219780), velocity3->activeVoxelCount());
2458 }
2459 }
2460 #endif
2461
2462 // clean up file
2463 1 remove(filename.c_str());
2464 1 }
2465
2466
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 TEST_F(TestPointRasterizeFrustum, testProfile)
2467 {
2468 using Rasterizer = FrustumRasterizer<PointDataGrid>;
2469 using Settings = FrustumRasterizerSettings;
2470
2471 // fill a sphere with points to use for rasterization
2472
2473 Vec3s center(0.0f, 0.0f, 25.0f);
2474 #ifdef PROFILE
2475 float radius = 40;
2476 #else
2477 float radius = 3;
2478 #endif
2479 float voxelSize = 0.1f;
2480
2481 1 auto surface = tools::createLevelSetSphere<FloatGrid>(radius, center, voxelSize);
2482
2483 // scatter points inside the sphere
2484
2485
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto referencePoints = points::denseUniformPointScatter(*surface, /*pointsPerVoxel=*/8);
2486
2487 #ifdef PROFILE
2488 std::cerr << std::endl;
2489 std::cerr << "---- Profiling Rasterization ----" << std::endl;
2490 std::cerr << "Points To Rasterize: " << points::pointCount(referencePoints->constTree()) << std::endl;
2491 #endif
2492
2493
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::Transform::Ptr linearTransform = math::Transform::createLinearTransform(voxelSize);
2494
2495 Mat4d mat4( 100.0, 0.0, 0.0, 0.0,
2496 0.0, 100.0, 0.0, 0.0,
2497 0.0, 0.0, 100.0, 0.0,
2498 0.0, 0.0, -0.5, 1.0);
2499
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 math::AffineMap affineMap(mat4);
2500
2501 1 BBoxd frustumBBox(Vec3d(-0.5,-0.5,-0.5), Vec3d(999.5, 999.5, 999.5));
2502
2503 math::NonlinearFrustumMap nonLinearFrustumMap(
2504
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 frustumBBox, /*taper=*/0.5, /*depth=*/1.0, /*affineMap=*/affineMap.copy());
2505
2506
5/14
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
3 math::Transform::Ptr frustumTransform(math::Transform(nonLinearFrustumMap.copy()).copy());
2507
2508 { // point rasterize, linear transform
2509
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2510
2511
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*linearTransform);
2512
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2513
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2514
2515 #ifdef PROFILE
2516 openvdb::util::CpuTimer timer("Point Rasterize, Linear Transform");
2517 #endif
2518
2519
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2520
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(density);
2521
2522 #ifdef PROFILE
2523 timer.stop();
2524
2525 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2526 #endif
2527 }
2528
2529 { // point rasterize, frustum transform
2530
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2531
2532
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustumTransform);
2533
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2534
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2535
2536 #ifdef PROFILE
2537 openvdb::util::CpuTimer timer("Point Rasterize, Frustum Transform");
2538 #endif
2539
2540
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2541
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(density);
2542
2543 #ifdef PROFILE
2544 timer.stop();
2545
2546 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2547 #endif
2548 }
2549
2550 { // point rasterize, linear transform, low velocity
2551
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2552
2553
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<Vec3s>(points->tree(), "v", Vec3s(0.0f, 0.0001f, 0.0f));
2554
2555
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*linearTransform);
2556 1 settings.velocityMotionBlur = true;
2557
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2558
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2559
2560 #ifdef PROFILE
2561 openvdb::util::CpuTimer timer("Point Rasterize, Linear Transform, Low Velocity");
2562 #endif
2563
2564
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2565
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(density);
2566
2567 #ifdef PROFILE
2568 timer.stop();
2569
2570 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2571 #endif
2572 }
2573
2574 { // point rasterize, linear transform, high velocity
2575
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2576
2577
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<Vec3s>(points->tree(), "v", Vec3s(0.0f, 1.0f, 0.0f));
2578
2579
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*linearTransform);
2580 1 settings.velocityMotionBlur = true;
2581
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2582
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2583
2584
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::this_thread::sleep_for(std::chrono::milliseconds(500));
2585
2586 #ifdef PROFILE
2587 openvdb::util::CpuTimer timer("Point Rasterize, Linear Transform, High Velocity");
2588 #endif
2589
2590
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2591
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(density);
2592
2593 #ifdef PROFILE
2594 timer.stop();
2595
2596 std::this_thread::sleep_for(std::chrono::milliseconds(500));
2597
2598 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2599 #endif
2600 }
2601
2602 { // point rasterize, frustum transform
2603
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2604
2605
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<Vec3s>(points->tree(), "v", Vec3s(0.0f, 1.0f, 0.0f));
2606
2607
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustumTransform);
2608 1 settings.velocityMotionBlur = true;
2609
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2610
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2611
2612 #ifdef PROFILE
2613 openvdb::util::CpuTimer timer("Point Rasterize, Frustum Transform, High Velocity");
2614 #endif
2615
2616
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2617
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(density);
2618
2619 #ifdef PROFILE
2620 timer.stop();
2621
2622 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2623 #endif
2624 }
2625
2626 { // sphere rasterize, frustum transform, approximate algorithm
2627
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2628
2629
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<float>(points->tree(), "pscale", 0.25f);
2630
2631
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*linearTransform);
2632 1 settings.useRadius = true;
2633
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2634
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2635
2636 #ifdef PROFILE
2637 openvdb::util::CpuTimer timer("Sphere Rasterize, Linear Transform");
2638 #endif
2639
2640
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2641
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(density);
2642
2643 #ifdef PROFILE
2644 timer.stop();
2645
2646 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2647 #endif
2648 }
2649
2650 { // sphere rasterize, frustum transform, approximate algorithm
2651
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2652
2653
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<float>(points->tree(), "pscale", 0.25f);
2654
2655
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustumTransform);
2656 1 settings.useRadius = true;
2657
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2658
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2659
2660 #ifdef PROFILE
2661 openvdb::util::CpuTimer timer("Sphere Rasterize, Frustum Transform, Approximate");
2662 #endif
2663
2664
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2665
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(density);
2666
2667 #ifdef PROFILE
2668 timer.stop();
2669
2670 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2671 #endif
2672 }
2673
2674 { // sphere rasterize, frustum transform, high velocity, approximate algorithm
2675
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2676
2677
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 points::appendAttribute<Vec3s>(points->tree(), "v", Vec3s(0.0f, 1.0f, 0.0f));
2678
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<float>(points->tree(), "pscale", 0.25f);
2679
2680
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustumTransform);
2681 1 settings.velocityMotionBlur = true;
2682 1 settings.useRadius = true;
2683
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2684
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2685
2686
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::this_thread::sleep_for(std::chrono::milliseconds(500));
2687
2688 #ifdef PROFILE
2689 openvdb::util::CpuTimer timer("Sphere Rasterize, Frustum Transform, High Velocity, Approximate");
2690 #endif
2691
2692
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2693
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(density);
2694
2695 #ifdef PROFILE
2696 timer.stop();
2697
2698 std::this_thread::sleep_for(std::chrono::milliseconds(500));
2699
2700 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2701 #endif
2702 }
2703
2704 { // sphere rasterize, frustum transform, high velocity, accurate algorithm with motion samples
2705
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto points = referencePoints->deepCopy();
2706
2707
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 points::appendAttribute<Vec3s>(points->tree(), "v", Vec3s(0.0f, 1.0f, 0.0f));
2708
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
2 points::appendAttribute<float>(points->tree(), "pscale", 0.25f);
2709
2710
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Settings settings(*frustumTransform);
2711 1 settings.velocityMotionBlur = true;
2712 1 settings.useRadius = true;
2713 1 settings.accurateFrustumRadius = true;
2714 1 settings.motionSamples = 10;
2715
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 Rasterizer rasterizer(settings);
2716
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 rasterizer.addPoints(points, /*stream=*/false);
2717
2718 #ifdef PROFILE
2719 openvdb::util::CpuTimer timer("Sphere Rasterize, Frustum Transform, High Velocity, Accurate");
2720 #endif
2721
2722
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 auto density = rasterizer.rasterizeUniformDensity();
2723
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(density);
2724
2725 #ifdef PROFILE
2726 timer.stop();
2727
2728 std::cerr << "Voxel Count: " << density->tree().activeVoxelCount() << std::endl;
2729 #endif
2730 }
2731
2732 #ifdef PROFILE
2733 std::cerr << "----------------------------------" << std::endl;
2734 std::cerr << std::endl;
2735 #endif
2736 1 }
2737