From a574fa70c820ef8ece7790002ab4c41ac841deec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 22 May 2020 14:37:04 +0200 Subject: [PATCH] Add a test for which single-boundary stitching creates multiple smaller holes --- .../data_stitching/complex_hole.off | 307 ++++++++++++++++++ .../test_stitching.cpp | 10 +- 2 files changed, 314 insertions(+), 3 deletions(-) create mode 100644 Polygon_mesh_processing/test/Polygon_mesh_processing/data_stitching/complex_hole.off diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data_stitching/complex_hole.off b/Polygon_mesh_processing/test/Polygon_mesh_processing/data_stitching/complex_hole.off new file mode 100644 index 00000000000..c8a63ed1868 --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data_stitching/complex_hole.off @@ -0,0 +1,307 @@ +OFF +124 181 0 +0 0 0 +0.10000000000000001 0 0 +0.20000000000000001 0 0 +0.29999999999999999 0 0 +0.40000000000000002 0 0 +0.5 0 0 +0.59999999999999998 0 0 +0.69999999999999996 0 0 +0.80000000000000004 0 0 +0.90000000000000002 0 0 +1 0 0 +0 0.10000000000000001 0 +0.10000000000000001 0.10000000000000001 0 +0.20000000000000001 0.10000000000000001 0 +0.29999999999999999 0.10000000000000001 0 +0.40000000000000002 0.10000000000000001 0 +0.5 0.10000000000000001 0 +0.59999999999999998 0.10000000000000001 0 +0.69999999999999996 0.10000000000000001 0 +0.80000000000000004 0.10000000000000001 0 +0.90000000000000002 0.10000000000000001 0 +1 0.10000000000000001 0 +0 0.20000000000000001 0 +0.10000000000000001 0.20000000000000001 0 +0.20000000000000001 0.20000000000000001 0 +0.29999999999999999 0.20000000000000001 0 +0.40000000000000002 0.20000000000000001 0 +0.5 0.20000000000000001 0 +0.59999999999999998 0.20000000000000001 0 +0.69999999999999996 0.20000000000000001 0 +0.80000000000000004 0.20000000000000001 0 +0.90000000000000002 0.20000000000000001 0 +1 0.20000000000000001 0 +0 0.29999999999999999 0 +0.10000000000000001 0.29999999999999999 0 +0.20000000000000001 0.29999999999999999 0 +0.29999999999999999 0.29999999999999999 0 +0.40000000000000002 0.29999999999999999 0 +0.5 0.29999999999999999 0 +0.59999999999999998 0.29999999999999999 0 +0.69999999999999996 0.29999999999999999 0 +0.80000000000000004 0.29999999999999999 0 +0.90000000000000002 0.29999999999999999 0 +1 0.29999999999999999 0 +0 0.40000000000000002 0 +0.10000000000000001 0.40000000000000002 0 +0.20000000000000001 0.40000000000000002 0 +0.29999999999999999 0.40000000000000002 0 +1 1 0 +0.5 0.40000000000000002 0 +0.59999999999999998 0.40000000000000002 0 +0.69999999999999996 0.40000000000000002 0 +0.80000000000000004 0.40000000000000002 0 +0.90000000000000002 0.40000000000000002 0 +1 0.40000000000000002 0 +0 0.5 0 +0.10000000000000001 0.5 0 +0.20000000000000001 0.5 0 +0.29999999999999999 0.5 0 +0.40000000000000002 0.5 0 +0.5 0.5 0 +0.59999999999999998 0.5 0 +0.69999999999999996 0.5 0 +0.80000000000000004 0.5 0 +0.90000000000000002 0.5 0 +1 0.5 0 +0 0.59999999999999998 0 +0.10000000000000001 0.59999999999999998 0 +0.20000000000000001 0.59999999999999998 0 +0.29999999999999999 0.59999999999999998 0 +0.40000000000000002 0.59999999999999998 0 +0.5 0.59999999999999998 0 +0.90000000000000002 1 0 +0.69999999999999996 0.59999999999999998 0 +0.80000000000000004 0.59999999999999998 0 +0.90000000000000002 0.59999999999999998 0 +1 0.59999999999999998 0 +0 0.69999999999999996 0 +0.10000000000000001 0.69999999999999996 0 +0.20000000000000001 0.69999999999999996 0 +0.29999999999999999 0.69999999999999996 0 +0.40000000000000002 0.69999999999999996 0 +0.5 0.69999999999999996 0 +0.59999999999999998 0.69999999999999996 0 +0.69999999999999996 0.69999999999999996 0 +0.80000000000000004 0.69999999999999996 0 +0.90000000000000002 0.69999999999999996 0 +1 0.69999999999999996 0 +0 0.80000000000000004 0 +0.10000000000000001 0.80000000000000004 0 +0.20000000000000001 0.80000000000000004 0 +0.29999999999999999 0.80000000000000004 0 +0.40000000000000002 0.80000000000000004 0 +0.5 0.80000000000000004 0 +0.59999999999999998 0.80000000000000004 0 +0.69999999999999996 0.80000000000000004 0 +0.80000000000000004 0.80000000000000004 0 +0.90000000000000002 0.80000000000000004 0 +1 0.80000000000000004 0 +0 0.90000000000000002 0 +0.10000000000000001 0.90000000000000002 0 +0.20000000000000001 0.90000000000000002 0 +0.29999999999999999 0.90000000000000002 0 +0.40000000000000002 0.90000000000000002 0 +0.5 0.90000000000000002 0 +0.59999999999999998 0.90000000000000002 0 +0.69999999999999996 0.90000000000000002 0 +0.80000000000000004 0.90000000000000002 0 +0.90000000000000002 0.90000000000000002 0 +1 0.90000000000000002 0 +0 1 0 +0.10000000000000001 1 0 +0.20000000000000001 1 0 +0.29999999999999999 1 0 +0.40000000000000002 1 0 +0.5 1 0 +0.59999999999999998 1 0 +0.69999999999999996 1 0 +0.80000000000000004 1 0 +0.59999999999999998 0.40000000000000002 0 +0.59999999999999998 0.29999999999999999 0 +0.59999999999999998 0.29999999999999999 0 +0.69999999999999996 0.29999999999999999 0 +0.80000000000000004 0.29999999999999999 0 +3 0 1 11 +3 1 12 11 +3 11 12 22 +3 12 23 22 +3 22 23 33 +3 23 34 33 +3 33 34 44 +3 34 45 44 +3 44 45 55 +3 45 56 55 +3 55 56 66 +3 56 67 66 +3 66 67 77 +3 67 78 77 +3 77 78 88 +3 78 89 88 +3 88 89 99 +3 89 100 99 +3 99 100 110 +3 100 111 110 +3 1 2 12 +3 2 13 12 +3 12 13 23 +3 13 24 23 +3 23 24 34 +3 24 35 34 +3 34 35 45 +3 35 46 45 +3 45 46 56 +3 46 57 56 +3 56 57 67 +3 57 68 67 +3 67 68 78 +3 68 79 78 +3 78 79 89 +3 79 90 89 +3 89 90 100 +3 90 101 100 +3 100 101 111 +3 101 112 111 +3 2 3 13 +3 3 14 13 +3 13 14 24 +3 14 25 24 +3 24 25 35 +3 25 36 35 +3 35 36 46 +3 36 47 46 +3 46 47 57 +3 47 58 57 +3 57 58 68 +3 58 69 68 +3 68 69 79 +3 69 80 79 +3 79 80 90 +3 80 91 90 +3 90 91 101 +3 91 102 101 +3 101 102 112 +3 102 113 112 +3 3 4 14 +3 4 15 14 +3 14 15 25 +3 15 26 25 +3 25 26 36 +3 26 37 36 +3 109 48 72 +3 108 109 72 +3 98 109 108 +3 97 98 108 +3 87 98 97 +3 59 70 69 +3 69 70 80 +3 70 81 80 +3 80 81 91 +3 81 92 91 +3 91 92 102 +3 92 103 102 +3 102 103 113 +3 103 114 113 +3 4 5 15 +3 5 16 15 +3 15 16 26 +3 16 27 26 +3 26 27 37 +3 27 38 37 +3 86 87 97 +3 76 87 86 +3 75 76 86 +3 49 60 59 +3 59 60 70 +3 60 71 70 +3 70 71 81 +3 71 82 81 +3 81 82 92 +3 82 93 92 +3 92 93 103 +3 93 104 103 +3 103 104 114 +3 104 115 114 +3 5 6 16 +3 6 17 16 +3 16 17 27 +3 17 28 27 +3 27 28 38 +3 28 39 38 +3 65 76 75 +3 120 119 49 +3 49 119 60 +3 64 65 75 +3 54 65 64 +3 53 54 64 +3 43 54 53 +3 42 43 53 +3 82 83 93 +3 83 94 93 +3 93 94 104 +3 94 105 104 +3 104 105 115 +3 105 116 115 +3 6 7 17 +3 7 18 17 +3 17 18 28 +3 18 29 28 +3 28 29 39 +3 29 40 39 +3 121 122 50 +3 122 51 50 +3 50 51 61 +3 51 62 61 +3 32 43 42 +3 31 32 42 +3 21 32 31 +3 20 21 31 +3 83 84 94 +3 84 95 94 +3 94 95 105 +3 95 106 105 +3 105 106 116 +3 106 117 116 +3 7 8 18 +3 8 19 18 +3 18 19 29 +3 19 30 29 +3 29 30 40 +3 30 41 40 +3 122 123 51 +3 123 52 51 +3 51 52 62 +3 52 63 62 +3 62 63 73 +3 63 74 73 +3 73 74 84 +3 74 85 84 +3 84 85 95 +3 85 96 95 +3 95 96 106 +3 96 107 106 +3 106 107 117 +3 107 118 117 +3 8 9 19 +3 9 20 19 +3 19 20 30 +3 20 31 30 +3 30 31 41 +3 31 42 41 +3 10 21 20 +3 42 53 52 +3 52 53 63 +3 53 64 63 +3 63 64 74 +3 64 75 74 +3 74 75 85 +3 75 86 85 +3 85 86 96 +3 86 97 96 +3 96 97 107 +3 97 108 107 +3 107 108 118 +3 108 72 118 +3 9 10 20 diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp index 34c3d1be776..239694bfbf6 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_stitching.cpp @@ -75,6 +75,7 @@ void test_stitch_boundary_cycles() { test_stitch_boundary_cycles("data_stitching/boundary_cycle.off", 4); test_stitch_boundary_cycles("data_stitching/boundary_cycle_2.off", 2); + test_stitch_boundary_cycles("data_stitching/complex_hole.off", 3); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -155,16 +156,19 @@ void test_stitch_borders(const char* fname, assert(is_valid_polygon_mesh(mesh)); // Just to test the API - PMP::stitch_borders(std::deque(), Mesh()); // @fix ambiguous calls - PMP::stitch_borders(Mesh(), params::apply_per_connected_component(true)); - PMP::stitch_borders(Mesh()); + Mesh dummy_mesh; + PMP::stitch_borders(std::deque(), dummy_mesh); + PMP::stitch_borders(dummy_mesh, params::apply_per_connected_component(true)); + PMP::stitch_borders(dummy_mesh); } template void test_stitch_borders() { + test_stitch_borders("data_stitching/complex_hole.off", 3, false, {}, {83}); test_stitch_borders("data_stitching/pinched.off", 2, false, {130, 94}); test_stitch_borders("data_stitching/pinched.off", 2, false, {130, 94}, {94}); + test_stitch_borders("data_stitching/pinched.off", 0, false, {}, {140}); // outer border, nothing to stitch test_stitch_borders("data_stitching/full_border.off", 4); test_stitch_borders("data_stitching/full_border_quads.off", 4); test_stitch_borders("data_stitching/half_border.off", 2, false, {23, 15});