From 1f8ccad1e9cc7f3b61bd96f1c09098346c15006e Mon Sep 17 00:00:00 2001 From: Youmu Date: Thu, 16 Jul 2020 16:39:59 -0400 Subject: [PATCH] Add test for cylinder and torus --- .../test/Surface_mesh_topology/CMakeLists.txt | 2 + .../simplicity_cylinder.cpp | 114 ++++++++++++++++++ .../simplicity_double_torus_with_holes.cpp | 20 +-- .../simplicity_homology_group.cpp | 2 +- .../simplicity_torus.cpp | 86 +++++++++++++ 5 files changed, 213 insertions(+), 11 deletions(-) create mode 100644 Surface_mesh_topology/test/Surface_mesh_topology/simplicity_cylinder.cpp create mode 100644 Surface_mesh_topology/test/Surface_mesh_topology/simplicity_torus.cpp diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt index 890e96964d9..4c20a8c48c7 100644 --- a/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt +++ b/Surface_mesh_topology/test/Surface_mesh_topology/CMakeLists.txt @@ -34,9 +34,11 @@ set(SOURCE_FILES path_tests.cpp path_with_rle_deformation_tests.cpp shortest_noncontractible_cycle_tests.cpp + simplicity_cylinder.cpp simplicity_double_torus.cpp simplicity_double_torus_with_holes.cpp simplicity_homology_group.cpp + simplicity_torus.cpp test_homotopy.cpp test_homotopy_with_polygonal_schema.cpp test_shortest_cycle_non_contractible.cpp diff --git a/Surface_mesh_topology/test/Surface_mesh_topology/simplicity_cylinder.cpp b/Surface_mesh_topology/test/Surface_mesh_topology/simplicity_cylinder.cpp new file mode 100644 index 00000000000..0f06e0ec5fa --- /dev/null +++ b/Surface_mesh_topology/test/Surface_mesh_topology/simplicity_cylinder.cpp @@ -0,0 +1,114 @@ +#include +#include +#include + +using namespace CGAL::Surface_mesh_topology; +typedef Polygonal_schema_with_combinatorial_map<> PS; + +/////////////////////////////////////////////////////////////////////////////// +void create_mesh_1(PS& ps) +{ + ps.add_facet("a b c d"); + ps.add_facet("-b e -d f"); + ps.add_facet("-a -e"); + ps.add_facet("-c -f"); + ps.perforate_facet("-a"); + ps.perforate_facet("-c"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_mesh_2(PS& ps) +{ + ps.add_facet("a b c d"); + ps.add_facet("-b e -d f"); + ps.add_facet("-a -e"); + ps.add_facet("-c -f"); + ps.perforate_facet("-a"); + ps.perforate_facet("-c"); + ps.perforate_facet("a"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_mesh_3(PS& ps) +{ + ps.add_facet("a b c d"); + ps.add_facet("-b e -d f"); + ps.add_facet("-a -e"); + ps.add_facet("-c -f"); + ps.perforate_facet("-a"); + ps.perforate_facet("-c"); + ps.perforate_facet("e"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_path_1(Path_on_surface& p) +{ + p.push_back_by_label("a e"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_path_2(Path_on_surface& p) +{ + p.push_back_by_label("a b -f d a e"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_path_3(Path_on_surface& p) +{ + p.push_back_by_label("a b c d"); +} + +/////////////////////////////////////////////////////////////////////////////// +int main() +{ + PS ps[2]; + create_mesh_1(ps[0]); + create_mesh_2(ps[1]); + + std::size_t num_ps = sizeof(ps) / sizeof(PS); + bool res=true; + + for(std::size_t i = 0; i < num_ps; ++i) + { + Curves_on_surface_topology cst(ps[i]); + Path_on_surface p1(ps[i]), p2(ps[i]), p3(ps[i]); + create_path_1(p1); + create_path_2(p2); + create_path_3(p3); + + if(!cst.is_homotopic_to_simple_cycle(p1)) + { + std::cout<<"ERROR simplicity_cylinder surface" + << (i+1) << "/test1: " + <<"Path p1 should be homotopic to a simple cycle" + < PS; /////////////////////////////////////////////////////////////////////////////// -void create_mesh1(PS& ps) +void create_mesh_1(PS& ps) { ps.add_facet("b -a g f e"); ps.add_facet("-b k i -g"); @@ -22,7 +22,7 @@ void create_mesh1(PS& ps) } /////////////////////////////////////////////////////////////////////////////// -void create_mesh2(PS& ps) +void create_mesh_2(PS& ps) { ps.add_facet("a b -a -b o"); ps.add_facet("-o -p"); @@ -31,7 +31,7 @@ void create_mesh2(PS& ps) } /////////////////////////////////////////////////////////////////////////////// -void create_mesh3(PS& ps) +void create_mesh_3(PS& ps) { ps.add_facet("a b -a -b s"); ps.add_facet("c d -c -d -s"); @@ -73,9 +73,9 @@ void create_path_4(Path_on_surface& p) int main() { PS ps[3]; - create_mesh1(ps[0]); - create_mesh2(ps[1]); - create_mesh3(ps[2]); + create_mesh_1(ps[0]); + create_mesh_2(ps[1]); + create_mesh_3(ps[2]); std::size_t num_ps = sizeof(ps) / sizeof(PS); bool res=true; @@ -92,7 +92,7 @@ int main() if(!cst.is_homotopic_to_simple_cycle(p1)) { std::cout<<"ERROR simplicity_double_torus_with_holes surface" - << i << "/test1: " + << (i+1) << "/test1: " <<"Path p1 should be homotopic to a simple cycle" < +#include +#include + +using namespace CGAL::Surface_mesh_topology; +typedef Polygonal_schema_with_combinatorial_map<> PS; + +/////////////////////////////////////////////////////////////////////////////// +void create_path_1(Path_on_surface& p) +{ + p.push_back_by_label("a b a a b"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_path_2(Path_on_surface& p) +{ + p.push_back_by_label("a b"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_path_3(Path_on_surface& p) +{ + p.push_back_by_label("-a b a b b"); +} + +/////////////////////////////////////////////////////////////////////////////// +void create_path_4(Path_on_surface& p) +{ + p.push_back_by_label("-a -b a a -b -b a a -b a -b -b"); +} + +/////////////////////////////////////////////////////////////////////////////// +int main() +{ + PS ps; + ps.add_facet("a b -a -b"); + + Curves_on_surface_topology cst(ps); + Path_on_surface p1(ps), p2(ps), p3(ps), p4(ps); + create_path_1(p1); + create_path_2(p2); + create_path_3(p3); + create_path_4(p4); + + bool res=true; + + if(!cst.is_homotopic_to_simple_cycle(p1)) + { + std::cout<<"ERROR simplicity_torus test1: " + <<"Path p1 should be homotopic to a simple cycle" + <