OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unittests_read_write_PLY.hh
1 #ifndef INCLUDE_UNITTESTS_READ_WRITE_PLY_HH
2 #define INCLUDE_UNITTESTS_READ_WRITE_PLY_HH
3
4 #include <gtest/gtest.h>
5 #include <Unittests/unittests_common.hh>
6
7
8 class OpenMeshReadWritePLY : public OpenMeshBase {
9
10 protected:
11
12 // This function is called before each test is run
13 virtual void SetUp() {
14
15 // Do some initial stuff with the member data here...
16 }
17
18 // This function is called after all tests are through
19 virtual void TearDown() {
20
21 // Do some final stuff with the member data here...
22 }
23
24 // Member already defined in OpenMeshBase
25 //Mesh mesh_;
26 };
27
28 /*
29 * ====================================================================
30 * Define tests below
31 * ====================================================================
32 */
33
34 /*
35 * Just load a point file in ply format and count whether
36 * the right number of entities has been loaded.
37 */
38 TEST_F(OpenMeshReadWritePLY, LoadSimplePointPLYFileWithBadEncoding) {
39
40 mesh_.clear();
41
42 bool ok = OpenMesh::IO::read_mesh(mesh_, "pointCloudBadEncoding.ply");
43
44 EXPECT_TRUE(ok) << "Unable to load pointCloudBadEncoding.ply";
45
46 EXPECT_EQ(10u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
47 EXPECT_EQ(0u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
48 EXPECT_EQ(0u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
49 }
50
51 /*
52 * Just load a point file in ply format and count whether
53 * the right number of entities has been loaded.
54 */
55 TEST_F(OpenMeshReadWritePLY, LoadSimplePointPLYFileWithGoodEncoding) {
56
57 mesh_.clear();
58
59 bool ok = OpenMesh::IO::read_mesh(mesh_, "pointCloudGoodEncoding.ply");
60
61 EXPECT_TRUE(ok) << "Unable to load pointCloudGoodEncoding.ply";
62
63 EXPECT_EQ(10u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
64 EXPECT_EQ(0u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
65 EXPECT_EQ(0u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
66 }
67
68 /*
69 * Just load a ply
70 */
71 TEST_F(OpenMeshReadWritePLY, LoadSimplePLY) {
72
73 mesh_.clear();
74
75 bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal.ply");
76
77 EXPECT_TRUE(ok) << "Unable to load cube-minimal.ply";
78
79 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
80 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
81 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
82
83 }
84
85 /*
86 * Just load a ply file and set vertex color option before loading
87 */
88 TEST_F(OpenMeshReadWritePLY, LoadSimplePLYForceVertexColorsAlthoughNotAvailable) {
89
90 mesh_.clear();
91
92 mesh_.request_vertex_colors();
93
94 std::string file_name = "cube-minimal.ply";
95
96 OpenMesh::IO::Options options;
97 options += OpenMesh::IO::Options::VertexColor;
98
99 bool ok = OpenMesh::IO::read_mesh(mesh_, file_name,options);
100
101 EXPECT_TRUE(ok) << file_name;
102
103 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
104 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
105 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
106 EXPECT_EQ(36u , mesh_.n_halfedges()) << "The number of loaded halfedges is not correct!";
107
108 EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
109 EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
110 EXPECT_FALSE(options.vertex_has_color()) << "Wrong user options are returned!";
111 }
112
113 /*
114 * Just load a ply file of a cube with vertex colors
115 */
116 TEST_F(OpenMeshReadWritePLY, LoadSimplePLYWithVertexColors) {
117
118 mesh_.clear();
119
120 mesh_.request_vertex_colors();
121
122 OpenMesh::IO::Options options;
123 options += OpenMesh::IO::Options::VertexColor;
124
125 bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal-vertexColors.ply",options);
126
127 EXPECT_TRUE(ok) << "Unable to load cube-minimal-vertexColors.ply";
128
129 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
130 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
131 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
132
133 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
134 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
135 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[2] ) << "Wrong vertex color at vertex 0 component 2";
136
137 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[0] ) << "Wrong vertex color at vertex 3 component 0";
138 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) << "Wrong vertex color at vertex 3 component 1";
139 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[2] ) << "Wrong vertex color at vertex 3 component 2";
140
141 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
142 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
143 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) << "Wrong vertex color at vertex 4 component 2";
144
145 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
146 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
147 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) << "Wrong vertex color at vertex 7 component 2";
148
149 EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
150 EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
151 EXPECT_TRUE(options.vertex_has_color()) << "Wrong user options are returned!";
152
153 mesh_.release_vertex_colors();
154 }
155
156 /*
157 * Just load a ply file of a cube with vertex colors
158 */
159 TEST_F(OpenMeshReadWritePLY, LoadPLYFromMeshLabWithVertexColors) {
160
161 mesh_.clear();
162
163 mesh_.request_vertex_colors();
164
165 OpenMesh::IO::Options options;
166 options += OpenMesh::IO::Options::VertexColor;
167
168 bool ok = OpenMesh::IO::read_mesh(mesh_, "meshlab.ply",options);
169
170 EXPECT_TRUE(ok) << "Unable to load meshlab.ply";
171
172 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
173 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
174 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
175
176 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
177 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
178 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[2] ) << "Wrong vertex color at vertex 0 component 2";
179
180 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[0] ) << "Wrong vertex color at vertex 3 component 0";
181 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) << "Wrong vertex color at vertex 3 component 1";
182 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[2] ) << "Wrong vertex color at vertex 3 component 2";
183
184 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
185 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
186 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) << "Wrong vertex color at vertex 4 component 2";
187
188 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
189 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
190 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) << "Wrong vertex color at vertex 7 component 2";
191
192 EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
193 EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
194 EXPECT_TRUE(options.vertex_has_color()) << "Wrong user options are returned!";
195
196 mesh_.release_vertex_colors();
197 }
198
199 /*
200 * Just read and write a binary ply file of a cube with vertex colors
201 */
202 TEST_F(OpenMeshReadWritePLY, WriteAndReadBinaryPLYWithVertexColors) {
203
204 mesh_.clear();
205
206 mesh_.request_vertex_colors();
207
208 OpenMesh::IO::Options options;
209 options += OpenMesh::IO::Options::VertexColor;
210
211 bool ok = OpenMesh::IO::read_mesh(mesh_, "meshlab.ply",options);
212
213 EXPECT_TRUE(ok) << "Unable to load meshlab.ply";
214
215 options += OpenMesh::IO::Options::Binary;
216
217 ok = OpenMesh::IO::write_mesh(mesh_, "meshlab_binary.ply",options);
218 EXPECT_TRUE(ok) << "Unable to write meshlab_binary.ply";
219
220 mesh_.clear();
221 ok = OpenMesh::IO::read_mesh(mesh_, "meshlab_binary.ply",options);
222 EXPECT_TRUE(ok) << "Unable to load meshlab_binary.ply";
223
224 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
225 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
226 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
227
228 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
229 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
230 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[2] ) << "Wrong vertex color at vertex 0 component 2";
231
232 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[0] ) << "Wrong vertex color at vertex 3 component 0";
233 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) << "Wrong vertex color at vertex 3 component 1";
234 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[2] ) << "Wrong vertex color at vertex 3 component 2";
235
236 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
237 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
238 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) << "Wrong vertex color at vertex 4 component 2";
239
240 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
241 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
242 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) << "Wrong vertex color at vertex 7 component 2";
243
244 EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
245 EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
246 EXPECT_TRUE(options.vertex_has_color()) << "Wrong user options are returned!";
247
248 mesh_.release_vertex_colors();
249 }
250
251 /*
252 * Just read and write a ply file of a cube with float vertex colors
253 */
254 TEST_F(OpenMeshReadWritePLY, WriteAndReadPLYWithFloatVertexColors) {
255
256 mesh_.clear();
257
258 mesh_.request_vertex_colors();
259
260 OpenMesh::IO::Options options;
261 options += OpenMesh::IO::Options::VertexColor;
262
263 bool ok = OpenMesh::IO::read_mesh(mesh_, "meshlab.ply",options);
264
265 EXPECT_TRUE(ok) << "Unable to load meshlab.ply";
266
267 options += OpenMesh::IO::Options::ColorFloat;
268
269 ok = OpenMesh::IO::write_mesh(mesh_, "meshlab_float.ply",options);
270 EXPECT_TRUE(ok) << "Unable to write meshlab_float.ply";
271
272 mesh_.clear();
273 ok = OpenMesh::IO::read_mesh(mesh_, "meshlab_float.ply",options);
274 EXPECT_TRUE(ok) << "Unable to load meshlab_float.ply";
275
276 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
277 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
278 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
279
280 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
281 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
282 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[2] ) << "Wrong vertex color at vertex 0 component 2";
283
284 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[0] ) << "Wrong vertex color at vertex 3 component 0";
285 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) << "Wrong vertex color at vertex 3 component 1";
286 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[2] ) << "Wrong vertex color at vertex 3 component 2";
287
288 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
289 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
290 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) << "Wrong vertex color at vertex 4 component 2";
291
292 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
293 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
294 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) << "Wrong vertex color at vertex 7 component 2";
295
296 EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
297 EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
298 EXPECT_TRUE(options.vertex_has_color()) << "Wrong user options are returned!";
299 EXPECT_TRUE(options.color_is_float()) << "Wrong user options are returned!";
300
301 mesh_.release_vertex_colors();
302 }
303
304 /*
305 * Just read and write a binary ply file of a cube with float vertex colors
306 */
307 TEST_F(OpenMeshReadWritePLY, WriteAndReadBinaryPLYWithFloatVertexColors) {
308
309 mesh_.clear();
310
311 mesh_.request_vertex_colors();
312
313 OpenMesh::IO::Options options;
314 options += OpenMesh::IO::Options::VertexColor;
315
316 bool ok = OpenMesh::IO::read_mesh(mesh_, "meshlab.ply",options);
317
318 EXPECT_TRUE(ok) << "Unable to load meshlab.ply";
319
320 options += OpenMesh::IO::Options::ColorFloat;
321 options += OpenMesh::IO::Options::Binary;
322
323 ok = OpenMesh::IO::write_mesh(mesh_, "meshlab_binary_float.ply",options);
324 EXPECT_TRUE(ok) << "Unable to write meshlab_binary_float.ply";
325
326 mesh_.clear();
327 ok = OpenMesh::IO::read_mesh(mesh_, "meshlab_binary_float.ply",options);
328 EXPECT_TRUE(ok) << "Unable to load meshlab_binary_float.ply";
329
330 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
331 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
332 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
333
334 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
335 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
336 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[2] ) << "Wrong vertex color at vertex 0 component 2";
337
338 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[0] ) << "Wrong vertex color at vertex 3 component 0";
339 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) << "Wrong vertex color at vertex 3 component 1";
340 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[2] ) << "Wrong vertex color at vertex 3 component 2";
341
342 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
343 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
344 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) << "Wrong vertex color at vertex 4 component 2";
345
346 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
347 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
348 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) << "Wrong vertex color at vertex 7 component 2";
349
350 EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
351 EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
352 EXPECT_TRUE(options.vertex_has_color()) << "Wrong user options are returned!";
353 EXPECT_TRUE(options.color_is_float()) << "Wrong user options are returned!";
354 EXPECT_TRUE(options.is_binary()) << "Wrong user options are returned!";
355
356 mesh_.release_vertex_colors();
357 }
358
359 /*
360 * Just load a ply file of a cube with vertex texCoords
361 */
362 TEST_F(OpenMeshReadWritePLY, LoadSimplePLYWithTexCoords) {
363
364 mesh_.clear();
365
366 mesh_.request_vertex_texcoords2D();
367
368 OpenMesh::IO::Options options;
369 options += OpenMesh::IO::Options::VertexTexCoord;
370
371 bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal-texCoords.ply",options);
372
373 EXPECT_TRUE(ok) << "Unable to load cube-minimal-texCoords.ply";
374
375 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
376 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
377 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
378
379 EXPECT_EQ(10, mesh_.texcoord2D(mesh_.vertex_handle(0))[0] ) << "Wrong vertex color at vertex 0 component 0";
380 EXPECT_EQ(10, mesh_.texcoord2D(mesh_.vertex_handle(0))[1] ) << "Wrong vertex color at vertex 0 component 1";
381
382 EXPECT_EQ(6, mesh_.texcoord2D(mesh_.vertex_handle(2))[0] ) << "Wrong vertex color at vertex 2 component 0";
383 EXPECT_EQ(6, mesh_.texcoord2D(mesh_.vertex_handle(2))[1] ) << "Wrong vertex color at vertex 2 component 1";
384
385 EXPECT_EQ(9, mesh_.texcoord2D(mesh_.vertex_handle(4))[0] ) << "Wrong vertex color at vertex 4 component 0";
386 EXPECT_EQ(9, mesh_.texcoord2D(mesh_.vertex_handle(4))[1] ) << "Wrong vertex color at vertex 4 component 1";
387
388 EXPECT_EQ(12, mesh_.texcoord2D(mesh_.vertex_handle(7))[0] ) << "Wrong vertex color at vertex 7 component 0";
389 EXPECT_EQ(12, mesh_.texcoord2D(mesh_.vertex_handle(7))[1] ) << "Wrong vertex color at vertex 7 component 1";
390
391
392 EXPECT_FALSE(options.vertex_has_normal()) << "Wrong user options are returned!";
393 EXPECT_TRUE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
394 EXPECT_FALSE(options.vertex_has_color()) << "Wrong user options are returned!";
395
396 mesh_.release_vertex_texcoords2D();
397 }
398
399 /*
400 * Just load a ply with normals, ascii mode
401 */
402 TEST_F(OpenMeshReadWritePLY, LoadSimplePLYWithNormals) {
403
404 mesh_.clear();
405
406 mesh_.request_vertex_normals();
407
408 OpenMesh::IO::Options options;
409 options += OpenMesh::IO::Options::VertexNormal;
410
411 bool ok = OpenMesh::IO::read_mesh(mesh_, "cube-minimal-normals.ply", options);
412
413 EXPECT_TRUE(ok) << "Unable to load cube-minimal-normals.ply";
414
415 EXPECT_EQ(8u , mesh_.n_vertices()) << "The number of loaded vertices is not correct!";
416 EXPECT_EQ(18u , mesh_.n_edges()) << "The number of loaded edges is not correct!";
417 EXPECT_EQ(12u , mesh_.n_faces()) << "The number of loaded faces is not correct!";
418
419 EXPECT_TRUE(options.vertex_has_normal()) << "Wrong user options are returned!";
420 EXPECT_FALSE(options.vertex_has_texcoord()) << "Wrong user options are returned!";
421 EXPECT_FALSE(options.vertex_has_color()) << "Wrong user options are returned!";
422
423
424 EXPECT_EQ(0, mesh_.normal(mesh_.vertex_handle(0))[0] ) << "Wrong normal at vertex 0 component 0";
425 EXPECT_EQ(0, mesh_.normal(mesh_.vertex_handle(0))[1] ) << "Wrong normal at vertex 0 component 1";
426 EXPECT_EQ(1, mesh_.normal(mesh_.vertex_handle(0))[2] ) << "Wrong normal at vertex 0 component 2";
427
428 EXPECT_EQ(1, mesh_.normal(mesh_.vertex_handle(3))[0] ) << "Wrong normal at vertex 3 component 0";
429 EXPECT_EQ(0, mesh_.normal(mesh_.vertex_handle(3))[1] ) << "Wrong normal at vertex 3 component 1";
430 EXPECT_EQ(0, mesh_.normal(mesh_.vertex_handle(3))[2] ) << "Wrong normal at vertex 3 component 2";
431
432 EXPECT_EQ(1, mesh_.normal(mesh_.vertex_handle(4))[0] ) << "Wrong normal at vertex 4 component 0";
433 EXPECT_EQ(0, mesh_.normal(mesh_.vertex_handle(4))[1] ) << "Wrong normal at vertex 4 component 1";
434 EXPECT_EQ(1, mesh_.normal(mesh_.vertex_handle(4))[2] ) << "Wrong normal at vertex 4 component 2";
435
436 EXPECT_EQ(1, mesh_.normal(mesh_.vertex_handle(7))[0] ) << "Wrong normal at vertex 7 component 0";
437 EXPECT_EQ(1, mesh_.normal(mesh_.vertex_handle(7))[1] ) << "Wrong normal at vertex 7 component 1";
438 EXPECT_EQ(2, mesh_.normal(mesh_.vertex_handle(7))[2] ) << "Wrong normal at vertex 7 component 2";
439
440 mesh_.release_vertex_normals();
441
442 }
443
444 #endif // INCLUDE GUARD