Add tests for contraction<2>

This commit is contained in:
Guillaume Damiand 2013-02-08 11:25:54 +01:00
parent c9a783a74a
commit 1db1ddb8c5
2 changed files with 97 additions and 0 deletions

View File

@ -20,6 +20,8 @@
#ifndef CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H
#define CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H 1
#include <CGAL/Combinatorial_map_basic_operations.h>
namespace CGAL {
/** @file Combinatorial_map_constructors.h

View File

@ -1293,6 +1293,16 @@ template<class Map>
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,2>(map,d1);
if ( !check_number_of_cells_3(map, 2, 2, 1, 1, 1) )
return false;
CGAL::contract_cell<Map,2>(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<class Map>
return false;
map.clear();
d1 = map.create_dart();
map.template sew<3>(d1, map.create_dart());
CGAL::contract_cell<Map,2>(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,2>(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,2>(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,2>(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,2>(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,2>(map,d1);
if ( !check_number_of_cells_3(map, 2, 2, 1, 2, 1) )
return false;
CGAL::contract_cell<Map,2>(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,2>(map,d1);
if ( !check_number_of_cells_3(map, 2, 2, 1, 2, 1) )
return false;
CGAL::contract_cell<Map,2>(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,1>(map,d2->beta(0));
if ( !check_number_of_cells_3(map, 4, 6, 3, 2, 1) )
return false;
CGAL::contract_cell<Map,2>(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,2>(map,d1);