1 #include <gtest/gtest.h> 2 #include <Unittests/unittests_common.hh> 12 virtual void SetUp() {
18 virtual void TearDown() {
36 TEST_F(OpenMeshReadWriteOM, LoadSimpleOMForceVertexColorsAlthoughNotAvailable) {
40 mesh_.request_vertex_colors();
42 std::string file_name =
"cube-minimal.om";
49 EXPECT_TRUE(ok) << file_name;
51 EXPECT_EQ(8u , mesh_.n_vertices()) <<
"The number of loaded vertices is not correct!";
52 EXPECT_EQ(18u , mesh_.n_edges()) <<
"The number of loaded edges is not correct!";
53 EXPECT_EQ(12u , mesh_.n_faces()) <<
"The number of loaded faces is not correct!";
54 EXPECT_EQ(36u , mesh_.n_halfedges()) <<
"The number of loaded halfedges is not correct!";
56 EXPECT_FALSE(options.vertex_has_normal()) <<
"Wrong user options are returned!";
57 EXPECT_FALSE(options.vertex_has_texcoord()) <<
"Wrong user options are returned!";
58 EXPECT_FALSE(options.vertex_has_color()) <<
"Wrong user options are returned!";
64 TEST_F(OpenMeshReadWriteOM, LoadSimpleOMWithTexCoords) {
68 mesh_.request_vertex_texcoords2D();
75 ASSERT_TRUE(ok) <<
"Unable to load cube-minimal-texCoords.om";
77 EXPECT_EQ(8u , mesh_.n_vertices()) <<
"The number of loaded vertices is not correct!";
78 EXPECT_EQ(18u , mesh_.n_edges()) <<
"The number of loaded edges is not correct!";
79 EXPECT_EQ(12u , mesh_.n_faces()) <<
"The number of loaded faces is not correct!";
81 EXPECT_EQ(10, mesh_.texcoord2D(mesh_.vertex_handle(0))[0] ) <<
"Wrong vertex color at vertex 0 component 0";
82 EXPECT_EQ(10, mesh_.texcoord2D(mesh_.vertex_handle(0))[1] ) <<
"Wrong vertex color at vertex 0 component 1";
84 EXPECT_EQ(6, mesh_.texcoord2D(mesh_.vertex_handle(2))[0] ) <<
"Wrong vertex color at vertex 2 component 0";
85 EXPECT_EQ(6, mesh_.texcoord2D(mesh_.vertex_handle(2))[1] ) <<
"Wrong vertex color at vertex 2 component 1";
87 EXPECT_EQ(9, mesh_.texcoord2D(mesh_.vertex_handle(4))[0] ) <<
"Wrong vertex color at vertex 4 component 0";
88 EXPECT_EQ(9, mesh_.texcoord2D(mesh_.vertex_handle(4))[1] ) <<
"Wrong vertex color at vertex 4 component 1";
90 EXPECT_EQ(12, mesh_.texcoord2D(mesh_.vertex_handle(7))[0] ) <<
"Wrong vertex color at vertex 7 component 0";
91 EXPECT_EQ(12, mesh_.texcoord2D(mesh_.vertex_handle(7))[1] ) <<
"Wrong vertex color at vertex 7 component 1";
94 EXPECT_FALSE(options.vertex_has_normal()) <<
"Wrong user options are returned!";
95 EXPECT_TRUE(options.vertex_has_texcoord()) <<
"Wrong user options are returned!";
96 EXPECT_FALSE(options.vertex_has_color()) <<
"Wrong user options are returned!";
98 mesh_.release_vertex_texcoords2D();
104 TEST_F(OpenMeshReadWriteOM, LoadSimpleOMWithVertexColors) {
108 mesh_.request_vertex_colors();
115 EXPECT_TRUE(ok) <<
"Unable to load cube-minimal-vertexColors.om";
117 EXPECT_EQ(8u , mesh_.n_vertices()) <<
"The number of loaded vertices is not correct!";
118 EXPECT_EQ(18u , mesh_.n_edges()) <<
"The number of loaded edges is not correct!";
119 EXPECT_EQ(12u , mesh_.n_faces()) <<
"The number of loaded faces is not correct!";
121 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(0))[0] ) <<
"Wrong vertex color at vertex 0 component 0";
122 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[1] ) <<
"Wrong vertex color at vertex 0 component 1";
123 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(0))[2] ) <<
"Wrong vertex color at vertex 0 component 2";
125 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(3))[0] ) <<
"Wrong vertex color at vertex 3 component 0";
126 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[1] ) <<
"Wrong vertex color at vertex 3 component 1";
127 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(3))[2] ) <<
"Wrong vertex color at vertex 3 component 2";
129 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[0] ) <<
"Wrong vertex color at vertex 4 component 0";
130 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(4))[1] ) <<
"Wrong vertex color at vertex 4 component 1";
131 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(4))[2] ) <<
"Wrong vertex color at vertex 4 component 2";
133 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[0] ) <<
"Wrong vertex color at vertex 7 component 0";
134 EXPECT_EQ(0, mesh_.color(mesh_.vertex_handle(7))[1] ) <<
"Wrong vertex color at vertex 7 component 1";
135 EXPECT_EQ(255, mesh_.color(mesh_.vertex_handle(7))[2] ) <<
"Wrong vertex color at vertex 7 component 2";
137 EXPECT_FALSE(options.vertex_has_normal()) <<
"Wrong user options are returned!";
138 EXPECT_FALSE(options.vertex_has_texcoord()) <<
"Wrong user options are returned!";
139 EXPECT_TRUE(options.vertex_has_color()) <<
"Wrong user options are returned!";
141 mesh_.release_vertex_colors();
147 TEST_F(OpenMeshReadWriteOM, WriteTriangle) {
152 const std::string filename =
"triangle-minimal.om";
158 mesh.add_face(v1,v2,v3);
162 EXPECT_TRUE(ok) <<
"Unable to write " << filename;
169 EXPECT_TRUE(ok) <<
"Unable to read " << filename;
172 EXPECT_EQ(3u , mesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
173 EXPECT_EQ(3u , mesh.n_edges()) <<
"The number of loaded edges is not correct!";
174 EXPECT_EQ(1u , mesh.n_faces()) <<
"The number of loaded faces is not correct!";
176 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , mesh.point(v1)) <<
"Wrong coordinates at vertex 0";
177 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , mesh.point(v2)) <<
"Wrong coordinates at vertex 1";
178 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , mesh.point(v3)) <<
"Wrong coordinates at vertex 2";
181 remove(filename.c_str());
188 TEST_F(OpenMeshReadWriteOM, WriteTriangleVertexIntegerColor) {
192 mesh.request_vertex_colors();
198 const std::string filename =
"triangle-minimal-ColorsPerVertex.om";
204 mesh.add_face(v1,v2,v3);
210 mesh.set_color(v1,c1);
211 mesh.set_color(v2,c2);
212 mesh.set_color(v3,c3);
216 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
218 mesh.release_vertex_colors();
222 cmpMesh.request_vertex_colors();
224 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
226 EXPECT_TRUE(cmpMesh.has_vertex_colors()) <<
"Loaded mesh has no vertex colors.";
229 EXPECT_EQ(3u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
230 EXPECT_EQ(3u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
231 EXPECT_EQ(1u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
233 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 0";
234 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 1";
235 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 2";
237 EXPECT_EQ(c1 , cmpMesh.color(v1)) <<
"Wrong colors at vertex 0";
238 EXPECT_EQ(c2 , cmpMesh.color(v2)) <<
"Wrong colors at vertex 1";
239 EXPECT_EQ(c3 , cmpMesh.color(v3)) <<
"Wrong colors at vertex 2";
242 cmpMesh.release_vertex_colors();
243 remove(filename.c_str());
250 TEST_F(OpenMeshReadWriteOM, WriteTriangleVertexBoolProperty) {
254 const std::string filename =
"triangle-minimal-VBProp.om";
260 mesh.add_face(v1,v2,v3);
263 mesh.add_property(prop,
"VBProp");
264 mesh.property(prop).set_persistent(
true);
266 mesh.property(prop,v1) =
true;
267 mesh.property(prop,v2) =
false;
268 mesh.property(prop,v3) =
true;
272 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
278 cmpMesh.add_property(prop,
"VBProp");
279 cmpMesh.property(prop).set_persistent(
true);
282 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
285 EXPECT_EQ(3u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
286 EXPECT_EQ(3u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
287 EXPECT_EQ(1u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
289 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 0";
290 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 1";
291 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 2";
293 EXPECT_TRUE(cmpMesh.property(prop,v1)) <<
"Wrong Property value at vertex 0";
294 EXPECT_FALSE(cmpMesh.property(prop,v2)) <<
"Wrong Property value at vertex 1";
295 EXPECT_TRUE(cmpMesh.property(prop,v3)) <<
"Wrong Property value at vertex 2";
298 remove(filename.c_str());
305 TEST_F(OpenMeshReadWriteOM, WriteTriangleVertexBoolPropertySpaceEquivalent) {
309 const std::string filename =
"triangle-minimal-VBProp-pattern-test.om";
315 mesh.add_face(v1,v2,v3);
320 mesh.add_face(v4,v5,v6);
327 mesh.add_property(prop,
"VBProp");
328 mesh.property(prop).set_persistent(
true);
331 mesh.property(prop,v1) =
false;
332 mesh.property(prop,v2) =
false;
333 mesh.property(prop,v3) =
false;
334 mesh.property(prop,v4) =
false;
335 mesh.property(prop,v5) =
false;
336 mesh.property(prop,v6) =
true;
337 mesh.property(prop,v7) =
false;
338 mesh.property(prop,v8) =
false;
339 mesh.property(prop,v9) =
true;
343 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
348 cmpMesh.add_property(prop,
"VBProp");
349 cmpMesh.property(prop).set_persistent(
true);
352 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
355 EXPECT_EQ(9u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
356 EXPECT_EQ(6u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
357 EXPECT_EQ(2u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
359 EXPECT_FALSE(cmpMesh.property(prop,v1)) <<
"Wrong Property value at vertex 0";
360 EXPECT_FALSE(cmpMesh.property(prop,v2)) <<
"Wrong Property value at vertex 1";
361 EXPECT_FALSE(cmpMesh.property(prop,v3)) <<
"Wrong Property value at vertex 2";
362 EXPECT_FALSE(cmpMesh.property(prop,v4)) <<
"Wrong Property value at vertex 3";
363 EXPECT_FALSE(cmpMesh.property(prop,v5)) <<
"Wrong Property value at vertex 4";
364 EXPECT_TRUE(cmpMesh.property(prop,v6)) <<
"Wrong Property value at vertex 5";
365 EXPECT_FALSE(cmpMesh.property(prop,v7)) <<
"Wrong Property value at vertex 6";
366 EXPECT_FALSE(cmpMesh.property(prop,v8)) <<
"Wrong Property value at vertex 7";
367 EXPECT_TRUE(cmpMesh.property(prop,v9)) <<
"Wrong Property value at vertex 8";
370 remove(filename.c_str());
377 TEST_F(OpenMeshReadWriteOM, WriteTriangleTwoVertexBoolProperty) {
381 const std::string filename =
"triangle-minimal-VBProp.om";
387 mesh.add_face(v1,v2,v3);
390 mesh.add_property(prop,
"VBProp");
391 mesh.property(prop).set_persistent(
true);
393 mesh.property(prop,v1) =
true;
394 mesh.property(prop,v2) =
false;
395 mesh.property(prop,v3) =
true;
398 mesh.add_property(prop2,
"VBProp2");
399 mesh.property(prop2).set_persistent(
true);
401 mesh.property(prop2,v1) =
false;
402 mesh.property(prop2,v2) =
false;
403 mesh.property(prop2,v3) =
false;
407 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
412 cmpMesh.add_property(prop,
"VBProp");
413 cmpMesh.property(prop).set_persistent(
true);
415 cmpMesh.add_property(prop2,
"VBProp2");
416 cmpMesh.property(prop2).set_persistent(
true);
419 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
422 EXPECT_EQ(3u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
423 EXPECT_EQ(3u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
424 EXPECT_EQ(1u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
426 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 0";
427 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 1";
428 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 2";
430 EXPECT_TRUE(cmpMesh.property(prop,v1)) <<
"Wrong Property value at vertex 0";
431 EXPECT_FALSE(cmpMesh.property(prop,v2)) <<
"Wrong Property value at vertex 1";
432 EXPECT_TRUE(cmpMesh.property(prop,v3)) <<
"Wrong Property value at vertex 2";
434 EXPECT_FALSE(cmpMesh.property(prop2,v1)) <<
"Wrong second Property value at vertex 0";
435 EXPECT_FALSE(cmpMesh.property(prop2,v2)) <<
"Wrong second Property value at vertex 1";
436 EXPECT_FALSE(cmpMesh.property(prop2,v3)) <<
"Wrong second Property value at vertex 2";
439 remove(filename.c_str());
446 TEST_F(OpenMeshReadWriteOM, WriteTriangleEdgeIntProperty) {
450 const std::string propName =
"EIProp";
451 const std::string filename = std::string(
"triangle-minimal-")+propName+
".om";
457 mesh.add_face(v1,v2,v3);
460 mesh.add_property(prop,propName);
461 mesh.property(prop).set_persistent(
true);
463 Mesh::EdgeHandle e1 = Mesh::EdgeHandle(0);
464 Mesh::EdgeHandle e2 = Mesh::EdgeHandle(1);
465 Mesh::EdgeHandle e3 = Mesh::EdgeHandle(2);
471 mesh.property(prop,e1) = value1;
472 mesh.property(prop,e2) = value2;
473 mesh.property(prop,e3) = value3;
477 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
482 cmpMesh.add_property(prop,propName);
483 cmpMesh.property(prop).set_persistent(
true);
486 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
489 EXPECT_EQ(3u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
490 EXPECT_EQ(3u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
491 EXPECT_EQ(1u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
493 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 0";
494 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 1";
495 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 2";
497 EXPECT_EQ(value1 , cmpMesh.property(prop,e1)) <<
"Wrong property at edge 0";
498 EXPECT_EQ(value2 , cmpMesh.property(prop,e2)) <<
"Wrong property at edge 1";
499 EXPECT_EQ(value3 , cmpMesh.property(prop,e3)) <<
"Wrong property at edge 2";
502 remove(filename.c_str());
509 TEST_F(OpenMeshReadWriteOM, WriteSplitTriangleEdgeIntProperty) {
513 const std::string propName =
"EIProp";
514 const std::string filename = std::string(
"triangle-minimal-")+propName+
".om";
520 auto fh0 = mesh.add_face(v1,v2,v3);
527 mesh.add_property(prop,propName);
528 mesh.property(prop).set_persistent(
true);
530 Mesh::EdgeHandle e1 = Mesh::EdgeHandle(0);
531 Mesh::EdgeHandle e2 = Mesh::EdgeHandle(1);
532 Mesh::EdgeHandle e3 = Mesh::EdgeHandle(2);
533 Mesh::EdgeHandle e4 = Mesh::EdgeHandle(3);
534 Mesh::EdgeHandle e5 = Mesh::EdgeHandle(4);
535 Mesh::EdgeHandle e6 = Mesh::EdgeHandle(5);
544 mesh.property(prop,e1) = value1;
545 mesh.property(prop,e2) = value2;
546 mesh.property(prop,e3) = value3;
547 mesh.property(prop,e4) = value4;
548 mesh.property(prop,e5) = value5;
549 mesh.property(prop,e6) = value6;
554 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
559 cmpMesh.add_property(prop,propName);
560 cmpMesh.property(prop).set_persistent(
true);
563 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
566 EXPECT_EQ(4u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
567 EXPECT_EQ(6u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
568 EXPECT_EQ(3u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
570 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 0";
571 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 1";
572 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 2";
573 EXPECT_EQ(c , cmpMesh.point(v4)) <<
"Wrong coordinates at vertex 3";
575 EXPECT_EQ(value1 , cmpMesh.property(prop,e1)) <<
"Wrong property at edge 0";
576 EXPECT_EQ(value2 , cmpMesh.property(prop,e2)) <<
"Wrong property at edge 1";
577 EXPECT_EQ(value3 , cmpMesh.property(prop,e3)) <<
"Wrong property at edge 2";
578 EXPECT_EQ(value4 , cmpMesh.property(prop,e4)) <<
"Wrong property at edge 3";
579 EXPECT_EQ(value5 , cmpMesh.property(prop,e5)) <<
"Wrong property at edge 4";
580 EXPECT_EQ(value6 , cmpMesh.property(prop,e6)) <<
"Wrong property at edge 5";
584 for (
auto eh : mesh.edges())
586 auto heh = mesh.halfedge_handle(eh, 0);
587 auto from_vh = mesh.from_vertex_handle(heh);
588 auto to_vh = mesh.to_vertex_handle(heh);
591 auto cmpHeh = cmpMesh.find_halfedge(from_vh, to_vh);
592 auto cmpEh = cmpMesh.edge_handle(cmpHeh);
594 EXPECT_EQ(mesh.property(prop, eh), cmpMesh.property(prop, cmpEh)) <<
"Wrong property at input edge " << eh.idx()
595 <<
" corresponding to edge " << cmpEh.idx() <<
" in the loaded Mesh";
601 remove(filename.c_str());
608 TEST_F(OpenMeshReadWriteOM, WriteSplitTriangleStatusProperties) {
612 mesh.request_vertex_status();
613 mesh.request_edge_status();
614 mesh.request_halfedge_status();
615 mesh.request_face_status();
617 const std::string filename = std::string(
"triangle-minimal-status.om");
623 auto fh0 = mesh.add_face(v0,v1,v2);
628 mesh.delete_vertex(v0);
629 mesh.status(v1).set_selected(
true);
630 mesh.status(v2).set_feature(
true);
631 mesh.status(v3).set_tagged(
true);
632 mesh.status(v2).set_tagged2(
true);
634 std::vector<bool> vertex_deleted;
635 std::vector<bool> vertex_selected;
636 std::vector<bool> vertex_feature;
637 std::vector<bool> vertex_tagged;
638 std::vector<bool> vertex_tagged2;
640 for (
auto vh : mesh.all_vertices())
642 vertex_deleted.push_back(mesh.status(vh).deleted());
643 vertex_selected.push_back(mesh.status(vh).selected());
644 vertex_feature.push_back(mesh.status(vh).feature());
645 vertex_tagged.push_back(mesh.status(vh).tagged());
646 vertex_tagged2.push_back(mesh.status(vh).tagged2());
649 Mesh::EdgeHandle e1 = Mesh::EdgeHandle(0);
650 Mesh::EdgeHandle e2 = Mesh::EdgeHandle(1);
651 Mesh::EdgeHandle e3 = Mesh::EdgeHandle(2);
652 Mesh::EdgeHandle e4 = Mesh::EdgeHandle(3);
654 mesh.status(e1).set_selected(
true);
655 mesh.status(e2).set_feature(
true);
656 mesh.status(e3).set_tagged(
true);
657 mesh.status(e4).set_tagged2(
true);
659 std::vector<bool> edge_deleted;
660 std::vector<bool> edge_selected;
661 std::vector<bool> edge_feature;
662 std::vector<bool> edge_tagged;
663 std::vector<bool> edge_tagged2;
665 for (
auto eh : mesh.all_edges())
667 edge_deleted.push_back(mesh.status(eh).deleted());
668 edge_selected.push_back(mesh.status(eh).selected());
669 edge_feature.push_back(mesh.status(eh).feature());
670 edge_tagged.push_back(mesh.status(eh).tagged());
671 edge_tagged2.push_back(mesh.status(eh).tagged2());
675 Mesh::HalfedgeHandle he1 = Mesh::HalfedgeHandle(0);
676 Mesh::HalfedgeHandle he2 = Mesh::HalfedgeHandle(3);
677 Mesh::HalfedgeHandle he3 = Mesh::HalfedgeHandle(5);
678 Mesh::HalfedgeHandle he4 = Mesh::HalfedgeHandle(1);
680 mesh.status(he1).set_selected(
true);
681 mesh.status(he2).set_feature(
true);
682 mesh.status(he3).set_tagged(
true);
683 mesh.status(he4).set_tagged2(
true);
685 std::vector<bool> halfedge_deleted;
686 std::vector<bool> halfedge_selected;
687 std::vector<bool> halfedge_feature;
688 std::vector<bool> halfedge_tagged;
689 std::vector<bool> halfedge_tagged2;
691 for (
auto heh : mesh.all_halfedges())
693 halfedge_deleted.push_back(mesh.status(heh).deleted());
694 halfedge_selected.push_back(mesh.status(heh).selected());
695 halfedge_feature.push_back(mesh.status(heh).feature());
696 halfedge_tagged.push_back(mesh.status(heh).tagged());
697 halfedge_tagged2.push_back(mesh.status(heh).tagged2());
700 Mesh::FaceHandle f1 = Mesh::FaceHandle(0);
701 Mesh::FaceHandle f2 = Mesh::FaceHandle(2);
702 Mesh::FaceHandle f3 = Mesh::FaceHandle(1);
703 Mesh::FaceHandle f4 = Mesh::FaceHandle(2);
705 mesh.status(f1).set_selected(
true);
706 mesh.status(f2).set_feature(
true);
707 mesh.status(f3).set_tagged(
true);
708 mesh.status(f4).set_tagged2(
true);
710 std::vector<bool> face_deleted;
711 std::vector<bool> face_selected;
712 std::vector<bool> face_feature;
713 std::vector<bool> face_tagged;
714 std::vector<bool> face_tagged2;
716 for (
auto fh : mesh.all_faces())
718 face_deleted.push_back(mesh.status(fh).deleted());
719 face_selected.push_back(mesh.status(fh).selected());
720 face_feature.push_back(mesh.status(fh).feature());
721 face_tagged.push_back(mesh.status(fh).tagged());
722 face_tagged2.push_back(mesh.status(fh).tagged2());
728 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
733 cmpMesh.request_vertex_status();
734 cmpMesh.request_edge_status();
735 cmpMesh.request_halfedge_status();
736 cmpMesh.request_face_status();
739 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
742 EXPECT_EQ(4u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
743 EXPECT_EQ(6u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
744 EXPECT_EQ(3u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
746 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v0)) <<
"Wrong coordinates at vertex 0";
747 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 1";
748 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 2";
749 EXPECT_EQ(c , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 3";
751 for (
auto vh : cmpMesh.all_vertices())
753 EXPECT_EQ(cmpMesh.status(vh).deleted(), vertex_deleted [vh.idx()]) <<
"Wrong deleted status at vertex " << vh.idx();
754 EXPECT_EQ(cmpMesh.status(vh).selected(), vertex_selected[vh.idx()]) <<
"Wrong selected status at vertex " << vh.idx();
755 EXPECT_EQ(cmpMesh.status(vh).feature(), vertex_feature [vh.idx()]) <<
"Wrong feature status at vertex " << vh.idx();
756 EXPECT_EQ(cmpMesh.status(vh).tagged(), vertex_tagged [vh.idx()]) <<
"Wrong tagged status at vertex " << vh.idx();
757 EXPECT_EQ(cmpMesh.status(vh).tagged2(), vertex_tagged2 [vh.idx()]) <<
"Wrong tagged2 status at vertex " << vh.idx();
760 for (
auto eh : cmpMesh.all_edges())
762 EXPECT_EQ(cmpMesh.status(eh).deleted(), edge_deleted [eh.idx()]) <<
"Wrong deleted status at edge " << eh.idx();
763 EXPECT_EQ(cmpMesh.status(eh).selected(), edge_selected[eh.idx()]) <<
"Wrong selected status at edge " << eh.idx();
764 EXPECT_EQ(cmpMesh.status(eh).feature(), edge_feature [eh.idx()]) <<
"Wrong feature status at edge " << eh.idx();
765 EXPECT_EQ(cmpMesh.status(eh).tagged(), edge_tagged [eh.idx()]) <<
"Wrong tagged status at edge " << eh.idx();
766 EXPECT_EQ(cmpMesh.status(eh).tagged2(), edge_tagged2 [eh.idx()]) <<
"Wrong tagged2 status at edge " << eh.idx();
769 for (
auto heh : cmpMesh.all_halfedges())
771 EXPECT_EQ(cmpMesh.status(heh).deleted(), halfedge_deleted [heh.idx()]) <<
"Wrong deleted status at halfedge " << heh.idx();
772 EXPECT_EQ(cmpMesh.status(heh).selected(), halfedge_selected[heh.idx()]) <<
"Wrong selected status at halfedge " << heh.idx();
773 EXPECT_EQ(cmpMesh.status(heh).feature(), halfedge_feature [heh.idx()]) <<
"Wrong feature status at halfedge " << heh.idx();
774 EXPECT_EQ(cmpMesh.status(heh).tagged(), halfedge_tagged [heh.idx()]) <<
"Wrong tagged status at halfedge " << heh.idx();
775 EXPECT_EQ(cmpMesh.status(heh).tagged2(), halfedge_tagged2 [heh.idx()]) <<
"Wrong tagged2 status at halfedge " << heh.idx();
778 for (
auto fh : cmpMesh.all_faces())
780 EXPECT_EQ(cmpMesh.status(fh).deleted(), face_deleted [fh.idx()]) <<
"Wrong deleted status at face " << fh.idx();
781 EXPECT_EQ(cmpMesh.status(fh).selected(), face_selected[fh.idx()]) <<
"Wrong selected status at face " << fh.idx();
782 EXPECT_EQ(cmpMesh.status(fh).feature(), face_feature [fh.idx()]) <<
"Wrong feature status at face " << fh.idx();
783 EXPECT_EQ(cmpMesh.status(fh).tagged(), face_tagged [fh.idx()]) <<
"Wrong tagged status at face " << fh.idx();
784 EXPECT_EQ(cmpMesh.status(fh).tagged2(), face_tagged2 [fh.idx()]) <<
"Wrong tagged2 status at face " << fh.idx();
789 remove(filename.c_str());
795 TEST_F(OpenMeshReadWriteOM, WriteTriangleFaceDoubleProperty) {
799 const std::string propName =
"FDProp";
800 const std::string filename = std::string(
"triangle-minimal-")+propName+
".om";
806 mesh.add_face(v1,v2,v3);
809 mesh.add_property(prop,propName);
810 mesh.property(prop).set_persistent(
true);
812 Mesh::FaceHandle f1 = Mesh::FaceHandle(0);
816 mesh.property(prop,f1) = va1ue1;
820 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
825 cmpMesh.add_property(prop,propName);
826 cmpMesh.property(prop).set_persistent(
true);
829 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
832 EXPECT_EQ(3u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
833 EXPECT_EQ(3u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
834 EXPECT_EQ(1u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
836 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 0";
837 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 1";
838 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 2";
840 EXPECT_EQ(va1ue1 , cmpMesh.property(prop,f1)) <<
"Wrong property at edge 0";
843 remove(filename.c_str());
850 TEST_F(OpenMeshReadWriteOM, WriteTriangleFaceFloatProperty) {
852 const std::string propName =
"FFProp";
853 const std::string filename = std::string(
"triangle-minimal-")+propName+
".om";
860 mesh.add_face(v1,v2,v3);
863 mesh.add_property(prop,propName);
864 mesh.property(prop).set_persistent(
true);
866 Mesh::FaceHandle f1 = Mesh::FaceHandle(0);
870 mesh.property(prop,f1) = va1ue1;
874 EXPECT_TRUE(ok) <<
"Unable to write "<<filename;
879 cmpMesh.add_property(prop,propName);
880 cmpMesh.property(prop).set_persistent(
true);
883 EXPECT_TRUE(ok) <<
"Unable to read "<<filename;
886 EXPECT_EQ(3u , cmpMesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
887 EXPECT_EQ(3u , cmpMesh.n_edges()) <<
"The number of loaded edges is not correct!";
888 EXPECT_EQ(1u , cmpMesh.n_faces()) <<
"The number of loaded faces is not correct!";
890 EXPECT_EQ(
Mesh::Point(1.0,0.0,0.0) , cmpMesh.point(v1)) <<
"Wrong coordinates at vertex 0";
891 EXPECT_EQ(
Mesh::Point(0.0,1.0,0.0) , cmpMesh.point(v2)) <<
"Wrong coordinates at vertex 1";
892 EXPECT_EQ(
Mesh::Point(0.0,0.0,1.0) , cmpMesh.point(v3)) <<
"Wrong coordinates at vertex 2";
894 EXPECT_EQ(va1ue1 , cmpMesh.property(prop,f1)) <<
"Wrong property at edge 0";
897 remove(filename.c_str());
904 TEST_F(OpenMeshReadWriteOM, ReadBigMeshWithCustomProperty) {
934 mesh.add_property(faceProp,
"DFProp");
935 mesh.property(faceProp).set_persistent(
true);
937 mesh.add_property(vertexProp,
"IVProp");
938 mesh.property(vertexProp).set_persistent(
true);
941 EXPECT_TRUE(ok) <<
"Unable to read cube1_customProps.om";
944 EXPECT_EQ(7526u , mesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
945 EXPECT_EQ(22572u, mesh.n_edges()) <<
"The number of loaded edges is not correct!";
946 EXPECT_EQ(15048u, mesh.n_faces()) <<
"The number of loaded faces is not correct!";
949 for (Mesh::FaceIter fIter = mesh.faces_begin(); fIter != mesh.faces_end() && !wrong; ++fIter)
950 wrong = (0.3 != mesh.property(faceProp,*fIter));
951 EXPECT_FALSE(wrong) <<
"min one face has wrong face property";
954 for (Mesh::VertexIter vIter = mesh.vertices_begin(); vIter != mesh.vertices_end() && !wrong; ++vIter)
955 wrong = (vIter->idx() != mesh.property(vertexProp,*vIter));
956 EXPECT_FALSE(wrong) <<
"min one vertex has worng vertex property";
963 TEST_F(OpenMeshReadWriteOM, WriteReadStatusPropertyVertexOnly) {
970 mesh.add_face(vh0, vh1, vh2);
972 mesh.request_vertex_status();
974 mesh.status(vh0).set_selected(
true);
975 mesh.status(vh1).set_feature(
true);
976 mesh.status(vh2).set_tagged(
true);
977 mesh.status(vh0).set_locked(
true);
978 mesh.status(vh1).set_deleted(
true);
979 mesh.status(vh2).set_hidden(
true);
980 mesh.status(vh0).set_fixed_nonmanifold(
true);
983 std::string filename_without_status =
"no_vertex_status_test.om";
984 std::string filename_with_status =
"vertex_status_test.om";
995 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though they should not have been loaded";
996 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
997 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
998 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1006 EXPECT_TRUE (loaded_mesh.has_vertex_status()) <<
"Mesh has no vertex status even though they should have been loaded";
1007 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1008 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1009 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1011 if (loaded_mesh.has_vertex_status())
1013 for (
auto vh : mesh.vertices())
1015 EXPECT_EQ(mesh.status(vh).bits(), loaded_mesh.status(vh).bits());
1023 loaded_mesh.request_vertex_status();
1026 EXPECT_TRUE (loaded_mesh.has_vertex_status()) <<
"Mesh vertex status was removed by reading";
1027 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1028 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1029 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1031 for (
auto vh : loaded_mesh.vertices())
1033 EXPECT_EQ(loaded_mesh.status(vh).bits(), 0u) <<
"Vertex status was modified even though it should not have been loaded";
1042 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though file should not have a stored status";
1043 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1044 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though they file should not have a stored status";
1045 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though they file should not have a stored status";
1053 TEST_F(OpenMeshReadWriteOM, WriteReadStatusPropertyHalfedgeOnly) {
1060 mesh.add_face(vh0, vh1, vh2);
1062 mesh.request_halfedge_status();
1071 mesh.status(heh0).set_selected(
true);
1072 mesh.status(heh1).set_feature(
true);
1073 mesh.status(heh2).set_tagged(
true);
1074 mesh.status(heh3).set_locked(
true);
1075 mesh.status(heh4).set_deleted(
true);
1076 mesh.status(heh5).set_hidden(
true);
1077 mesh.status(heh0).set_fixed_nonmanifold(
true);
1079 std::string filename_without_status =
"no_halfedge_status_test.om";
1080 std::string filename_with_status =
"edge_halfstatus_test.om";
1091 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though they should not have been loaded";
1092 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1093 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1094 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1102 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though they should have been loaded";
1103 EXPECT_TRUE(loaded_mesh.has_halfedge_status()) <<
"Mesh has no halfedge status even though file should not have a stored status";
1104 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1105 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1107 if (loaded_mesh.has_halfedge_status())
1109 for (
auto heh : mesh.halfedges())
1111 EXPECT_EQ(mesh.status(heh).bits(), loaded_mesh.status(heh).bits());
1119 loaded_mesh.request_halfedge_status();
1122 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though file should not have a stored status";
1123 EXPECT_TRUE (loaded_mesh.has_halfedge_status()) <<
"Mesh halfedge status was removed by reading";
1124 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1125 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1127 for (
auto heh : loaded_mesh.halfedges())
1129 EXPECT_EQ(loaded_mesh.status(heh).bits(), 0u) <<
"Edge status was modified even though it should not have been loaded";
1138 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though file should not have a stored status";
1139 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1140 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though they file should not have a stored status";
1141 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though they file should not have a stored status";
1149 TEST_F(OpenMeshReadWriteOM, WriteReadStatusPropertyEdgeOnly) {
1156 mesh.add_face(vh0, vh1, vh2);
1158 mesh.request_edge_status();
1164 mesh.status(eh0).set_selected(
true);
1165 mesh.status(eh1).set_feature(
true);
1166 mesh.status(eh2).set_tagged(
true);
1167 mesh.status(eh0).set_locked(
true);
1168 mesh.status(eh1).set_deleted(
true);
1169 mesh.status(eh2).set_hidden(
true);
1170 mesh.status(eh0).set_fixed_nonmanifold(
true);
1172 std::string filename_without_status =
"no_edge_status_test.om";
1173 std::string filename_with_status =
"edge_status_test.om";
1184 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though they should not have been loaded";
1185 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1186 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1187 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1195 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though they should have been loaded";
1196 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1197 EXPECT_TRUE(loaded_mesh.has_edge_status()) <<
"Mesh has no edge status even though file should not have a stored status";
1198 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1200 if (loaded_mesh.has_edge_status())
1202 for (
auto eh : mesh.edges())
1204 EXPECT_EQ(mesh.status(eh).bits(), loaded_mesh.status(eh).bits());
1212 loaded_mesh.request_edge_status();
1215 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though file should not have a stored status";
1216 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1217 EXPECT_TRUE (loaded_mesh.has_edge_status()) <<
"Mesh edge status was removed by reading";
1218 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1220 for (
auto eh : loaded_mesh.edges())
1222 EXPECT_EQ(loaded_mesh.status(eh).bits(), 0u) <<
"Edge status was modified even though it should not have been loaded";
1231 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though file should not have a stored status";
1232 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1233 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though they file should not have a stored status";
1234 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though they file should not have a stored status";
1242 TEST_F(OpenMeshReadWriteOM, WriteReadStatusPropertyFaceOnly) {
1250 auto fh0 = mesh.add_face(vh0, vh1, vh2);
1251 auto fh1 = mesh.add_face(vh2, vh1, vh3);
1253 mesh.request_face_status();
1255 mesh.status(fh0).set_selected(
true);
1256 mesh.status(fh1).set_feature(
true);
1257 mesh.status(fh0).set_tagged(
true);
1258 mesh.status(fh1).set_locked(
true);
1259 mesh.status(fh0).set_deleted(
true);
1260 mesh.status(fh1).set_hidden(
true);
1261 mesh.status(fh0).set_fixed_nonmanifold(
true);
1263 std::string filename_without_status =
"no_face_status_test.om";
1264 std::string filename_with_status =
"face_status_test.om";
1275 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though they should not have been loaded";
1276 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1277 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1278 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though file should not have a stored status";
1286 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though they should have been loaded";
1287 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1288 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though file should not have a stored status";
1289 EXPECT_TRUE(loaded_mesh.has_face_status()) <<
"Mesh has no face status even though file should not have a stored status";
1291 if (loaded_mesh.has_face_status())
1293 for (
auto fh : mesh.faces())
1295 EXPECT_EQ(mesh.status(fh).bits(), loaded_mesh.status(fh).bits());
1303 loaded_mesh.request_face_status();
1306 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though file should not have a stored status";
1307 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1308 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edgestatus even though file should not have a stored status";
1309 EXPECT_TRUE (loaded_mesh.has_face_status()) <<
"Mesh face status was removed by reading";
1311 for (
auto fh : loaded_mesh.faces())
1313 EXPECT_EQ(loaded_mesh.status(fh).bits(), 0u) <<
"Edge status was modified even though it should not have been loaded";
1322 EXPECT_FALSE(loaded_mesh.has_vertex_status()) <<
"Mesh has vertex status even though file should not have a stored status";
1323 EXPECT_FALSE(loaded_mesh.has_halfedge_status()) <<
"Mesh has halfedge status even though file should not have a stored status";
1324 EXPECT_FALSE(loaded_mesh.has_edge_status()) <<
"Mesh has edge status even though they file should not have a stored status";
1325 EXPECT_FALSE(loaded_mesh.has_face_status()) <<
"Mesh has face status even though they file should not have a stored status";
1333 TEST_F(OpenMeshReadWriteOM, LoadTriangleMeshVersion_1_2) {
1337 std::string file_name =
"cube_tri_version_1_2.om";
1341 EXPECT_TRUE(ok) << file_name;
1343 EXPECT_EQ(8u , mesh_.n_vertices()) <<
"The number of loaded vertices is not correct!";
1344 EXPECT_EQ(18u , mesh_.n_edges()) <<
"The number of loaded edges is not correct!";
1345 EXPECT_EQ(12u , mesh_.n_faces()) <<
"The number of loaded faces is not correct!";
1346 EXPECT_EQ(36u , mesh_.n_halfedges()) <<
"The number of loaded halfedges is not correct!";
1353 TEST_F(OpenMeshReadWriteOM, LoadPolyMeshVersion_1_2) {
1357 std::string file_name =
"cube_poly_version_1_2.om";
1361 EXPECT_TRUE(ok) << file_name;
1363 EXPECT_EQ(8u , mesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
1364 EXPECT_EQ(12u , mesh.n_edges()) <<
"The number of loaded edges is not correct!";
1365 EXPECT_EQ(6u , mesh.n_faces()) <<
"The number of loaded faces is not correct!";
1366 EXPECT_EQ(24u , mesh.n_halfedges()) <<
"The number of loaded halfedges is not correct!";
1373 TEST_F(OpenMeshReadWriteOM, LoadTriangleMeshVersion_2_0) {
1377 std::string file_name =
"cube_tri_version_2_0.om";
1381 EXPECT_TRUE(ok) << file_name;
1383 EXPECT_EQ(8u , mesh_.n_vertices()) <<
"The number of loaded vertices is not correct!";
1384 EXPECT_EQ(18u , mesh_.n_edges()) <<
"The number of loaded edges is not correct!";
1385 EXPECT_EQ(12u , mesh_.n_faces()) <<
"The number of loaded faces is not correct!";
1386 EXPECT_EQ(36u , mesh_.n_halfedges()) <<
"The number of loaded halfedges is not correct!";
1393 TEST_F(OpenMeshReadWriteOM, LoadPolyMeshVersion_2_0) {
1397 std::string file_name =
"cube_poly_version_2_0.om";
1401 EXPECT_TRUE(ok) << file_name;
1403 EXPECT_EQ(8u , mesh.n_vertices()) <<
"The number of loaded vertices is not correct!";
1404 EXPECT_EQ(12u , mesh.n_edges()) <<
"The number of loaded edges is not correct!";
1405 EXPECT_EQ(6u , mesh.n_faces()) <<
"The number of loaded faces is not correct!";
1406 EXPECT_EQ(24u , mesh.n_halfedges()) <<
"The number of loaded halfedges is not correct!";
1413 TEST_F(OpenMeshReadWriteOM, LoadTriMeshVersion_7_5) {
1417 std::string file_name =
"cube_tri_version_7_5.om";
1421 EXPECT_FALSE(ok) << file_name;
Has (r) / store (w) vertex colors.
Kernel::Point Point
Coordinate type.
Kernel::Color Color
Color type.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Has (r) / store (w) float values for colors (currently only implemented for PLY and OFF files) ...
void calc_face_centroid(FaceHandle _fh, Point &_pt) const
calculates the average of the vertices defining _fh
bool write_mesh(const Mesh &_mesh, const std::string &_filename, Options _opt=Options::Default, std::streamsize _precision=6)
Write a mesh to the file _filename.
Handle for a halfedge entity.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Has (r) / store (w) texture coordinates.
Has (r) / store (w) status properties.
Set options for reader/writer modules.
Handle for a edge entity.
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
VertexHandle split(EdgeHandle _eh, const Point &_p)
Edge split (= 2-to-4 split)