From 1db1ddb8c571749f6a38d4a3d2670f0594aff2f2 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Fri, 8 Feb 2013 11:25:54 +0100 Subject: [PATCH] Add tests for contraction<2> --- .../CGAL/Combinatorial_map_constructors.h | 2 + .../Combinatorial_map_3_test.h | 95 +++++++++++++++++++ 2 files changed, 97 insertions(+) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h b/Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h index fcd9a97836e..00ac2030102 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h @@ -20,6 +20,8 @@ #ifndef CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H #define CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H 1 +#include + namespace CGAL { /** @file Combinatorial_map_constructors.h diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h index aea19385421..1488b641776 100644 --- a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h @@ -1293,6 +1293,16 @@ template return false; map.clear(); + d1 = CGAL::make_combinatorial_polygon(map, 2); + d2 = CGAL::make_combinatorial_polygon(map, 2); + map.template sew<2>(d1, d2); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 2, 2, 1, 1, 1) ) + return false; + CGAL::contract_cell(map,d2); + if ( !check_number_of_cells_3(map, 0, 0, 0, 0, 0) ) + return false; + d1 = CGAL::make_combinatorial_polygon(map, 3); d2 = CGAL::make_combinatorial_polygon(map, 3); d3 = CGAL::make_combinatorial_polygon(map, 3); @@ -1307,6 +1317,91 @@ template return false; map.clear(); + d1 = map.create_dart(); + map.template sew<3>(d1, map.create_dart()); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 0, 0, 0, 0, 0) ) + return false; + + d1 = CGAL::make_combinatorial_polygon(map, 1); + map.template sew<3>(d1, CGAL::make_combinatorial_polygon(map, 1)); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 0, 0, 0, 0, 0) ) + return false; + + d1 = make_edge(map); + map.template sew<3>(d1, make_edge(map)); + map.template sew<3>(d1->beta(2),d1->beta(3)->beta(2)); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 2, 1, 1, 2, 1) ) + return false; + map.clear(); + + d1 = make_edge(map); + map.template sew<1>(d1, d1); + d2 = make_edge(map); + map.template sew<1>(d2, d2); + map.template sew<3>(d1, d2); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 2, 2, 2, 2, 2) ) + return false; + map.clear(); + + d1 = make_edge(map); + map.template sew<1>(d1, d1); map.template sew<1>(d1->beta(2), d1->beta(2)); + d2 = make_edge(map); + map.template sew<1>(d2, d2); map.template sew<1>(d2->beta(2), d2->beta(2)); + map.template sew<3>(d1, d2); + map.template sew<3>(d1->beta(2), d2->beta(2)); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 1, 1, 1, 2, 1) ) + return false; + map.clear(); + + d1 = CGAL::make_combinatorial_polygon(map, 2); + d2 = CGAL::make_combinatorial_polygon(map, 2); + map.template sew<2>(d1, d2); + map.template sew<3>(d1, CGAL::make_combinatorial_polygon(map, 2)); + map.template sew<3>(d2, CGAL::make_combinatorial_polygon(map, 2)); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 2, 2, 1, 2, 1) ) + return false; + CGAL::contract_cell(map,d2); + if ( !check_number_of_cells_3(map, 0, 0, 0, 0, 0) ) + return false; + + d1 = CGAL::make_combinatorial_polygon(map, 2); + d2 = CGAL::make_combinatorial_polygon(map, 2); + map.template sew<2>(d1, d2); + map.template sew<3>(d1, CGAL::make_combinatorial_polygon(map, 2)); + map.template sew<3>(d2, CGAL::make_combinatorial_polygon(map, 2)); + map.template sew<2>(d1->beta(3), d2->beta(3)); + CGAL::contract_cell(map,d1); + if ( !check_number_of_cells_3(map, 2, 2, 1, 2, 1) ) + return false; + CGAL::contract_cell(map,d2); + if ( !check_number_of_cells_3(map, 0, 0, 0, 0, 0) ) + return false; + + d1 = CGAL::make_combinatorial_polygon(map, 3); + d2 = CGAL::make_combinatorial_polygon(map, 3); + d3 = CGAL::make_combinatorial_polygon(map, 3); + map.template sew<2>(d1, d2); + map.template sew<2>(d2->beta(1), d3); + map.template sew<3>(d1, CGAL::make_combinatorial_polygon(map, 3)); + map.template sew<3>(d2, CGAL::make_combinatorial_polygon(map, 3)); + map.template sew<3>(d3, CGAL::make_combinatorial_polygon(map, 3)); + map.template sew<2>(d1->beta(3), d2->beta(3)); + map.template sew<2>(d2->beta(1)->beta(3), d3->beta(3)); + CGAL::contract_cell(map,d2->beta(0)); + if ( !check_number_of_cells_3(map, 4, 6, 3, 2, 1) ) + return false; + CGAL::contract_cell(map,d2); + if ( !check_number_of_cells_3(map, 4, 5, 2, 2, 1) ) + return false; + map.clear(); + + /* TODO more tests contact 2D and 3D map.display_characteristics(cout) << ", valid=" << map.is_valid() << endl; cout << "contract facet1: " << flush; CGAL::contract_cell(map,d1);