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

Function TEST

test/unit/filters/NormalFilterTest.cpp:47–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45{
46
47TEST(NormalFilterTest, XYPlane)
48{
49 using namespace Dimension;
50
51 PointTable table;
52 table.layout()->registerDims({Id::X, Id::Y, Id::Z});
53
54 FauxReader reader;
55 Options readerOps;
56 readerOps.add("mode", "grid");
57 readerOps.add("bounds", "([0, 2], [0, 2], [0, 0])");
58 readerOps.add("count", 4);
59 reader.setOptions(readerOps);
60 NormalFilter filter;
61 Options filterOps;
62 filterOps.add("knn", 3);
63 filter.setInput(reader);
64 filter.setOptions(filterOps);
65 filter.prepare(table);
66
67 PointViewSet viewSet = filter.execute(table);
68 PointViewPtr outView = *viewSet.begin();
69
70 Dimension::Id nx = table.layout()->findDim("NormalX");
71 Dimension::Id ny = table.layout()->findDim("NormalY");
72 Dimension::Id nz = table.layout()->findDim("NormalZ");
73 Dimension::Id c = table.layout()->findDim("Curvature");
74
75 for (const PointRef& p : *outView)
76 {
77 ASSERT_FLOAT_EQ(p.getFieldAs<float>(nx), 0.0);
78 ASSERT_FLOAT_EQ(p.getFieldAs<float>(ny), 0.0);
79 ASSERT_FLOAT_EQ(p.getFieldAs<float>(nz), 1.0);
80 ASSERT_FLOAT_EQ(p.getFieldAs<float>(c), 0.0);
81 }
82}
83
84TEST(NormalFilterTest, XZPlane)
85{

Callers

nothing calls this directly

Calls 8

registerDimsMethod · 0.80
setOptionsMethod · 0.80
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45
beginMethod · 0.45
findDimMethod · 0.45
setFieldMethod · 0.45

Tested by

no test coverage detected