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

Function testMesh

test/unit/io/PlyWriterTest.cpp:81–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81void testMesh(const std::string referenceFile, int precision)
82{
83 std::string outfile(Support::temppath("out.ply"));
84 std::string testfile(Support::datapath("ply/mesh.ply"));
85
86 FileUtils::deleteFile(outfile);
87
88 PointTable t;
89
90 t.layout()->registerDim(Dimension::Id::X);
91 t.layout()->registerDim(Dimension::Id::Y);
92 t.layout()->registerDim(Dimension::Id::Z);
93
94 PointViewPtr v(new PointView(t));
95 v->setField(Dimension::Id::X, 0, 1);
96 v->setField(Dimension::Id::Y, 0, 1);
97 v->setField(Dimension::Id::Z, 0, 0);
98
99 v->setField(Dimension::Id::X, 1, 2);
100 v->setField(Dimension::Id::Y, 1, 1);
101 v->setField(Dimension::Id::Z, 1, 0);
102
103 v->setField(Dimension::Id::X, 2, 1);
104 v->setField(Dimension::Id::Y, 2, 2);
105 v->setField(Dimension::Id::Z, 2, 0);
106
107 v->setField(Dimension::Id::X, 3, 2);
108 v->setField(Dimension::Id::Y, 3, 2);
109 v->setField(Dimension::Id::Z, 3, 2);
110
111 TriangularMesh *mesh = v->createMesh("foo");
112 mesh->add(0, 1, 2);
113 mesh->add(1, 2, 3);
114
115 BufferReader r;
116 r.addView(v);
117
118 PlyWriter w;
119 Options wo;
120 wo.add("filename", outfile);
121 wo.add("storage_mode", "ascii");
122 wo.add("faces", true);
123 if (precision >= 0)
124 wo.add("precision", precision);
125 w.setInput(r);
126 w.setOptions(wo);
127
128 w.prepare(t);
129 w.execute(t);
130
131 EXPECT_TRUE(Support::compare_text_files(outfile, referenceFile));
132}
133
134
135TEST(PlyWriter, mesh)

Callers 1

TESTFunction · 0.85

Calls 11

temppathFunction · 0.85
datapathFunction · 0.85
deleteFileFunction · 0.85
compare_text_filesFunction · 0.85
registerDimMethod · 0.80
createMeshMethod · 0.80
setOptionsMethod · 0.80
setFieldMethod · 0.45
addMethod · 0.45
prepareMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected