MCPcopy Create free account
hub / github.com/PDAL/PDAL / TEST

Function TEST

test/unit/filters/DelaunayFilterTest.cpp:49–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47using namespace pdal;
48
49TEST(DelaunayFilterTest, test1)
50{
51 // The triangles we expect from the Delaunay triangulation of the
52 // input file. For each of these triangles, we will check for all
53 // index permutations, as long as the vertices appear in
54 // counterclockwise order.
55 std::vector<Triangle> expectedTriangles =
56 {
57 {5, 2, 0},
58 {2, 5, 4},
59 {3, 2, 4},
60 {2, 1, 0},
61 {3, 1, 2}
62 };
63
64 // Number of detected occurrences of each of the expected triangles.
65 // Initialize to zeros.
66 std::vector<int> expectedTrianglesOccurrences(expectedTriangles.size(), 0);
67
68 Options readerOps;
69 readerOps.add("filename",
70 Support::datapath("filters/delaunaytest.txt"));
71
72 TextReader reader;
73 reader.setOptions(readerOps);
74
75 DelaunayFilter filter;
76 filter.setInput(reader);
77
78 PointTable table;
79
80 filter.prepare(table);
81 PointViewSet viewSet = filter.execute(table);
82 EXPECT_EQ(viewSet.size(), 1u);
83 PointViewPtr view = *viewSet.begin();
84 EXPECT_EQ(view->size(), 6u);
85 TriangularMesh *mesh = view->mesh("delaunay2d");
86 EXPECT_EQ(mesh->size(), expectedTriangles.size());
87
88 // Loop through the triangles of the generated mesh...
89 for (size_t i = 0; i < mesh->size(); i++)
90 {
91 Triangle triangle = (*mesh)[i];
92
93 auto it = std::find(expectedTriangles.begin(), expectedTriangles.end(),
94 triangle);
95 bool found = (it != expectedTriangles.end());
96 EXPECT_TRUE(found);
97 expectedTriangles.erase(it);
98 }
99 EXPECT_EQ(expectedTriangles.size(), (size_t)0);
100}
101

Callers

nothing calls this directly

Calls 11

datapathFunction · 0.85
findFunction · 0.85
setOptionsMethod · 0.80
meshMethod · 0.80
sizeMethod · 0.45
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected