mirror of https://github.com/CGAL/cgal
Create all attributes for LCC tests; add draw to debug (todo: remove later)
This commit is contained in:
parent
7803086c66
commit
79ac67c8ff
|
|
@ -4,7 +4,7 @@
|
|||
cmake_minimum_required(VERSION 3.1...3.23)
|
||||
project(Linear_cell_complex_Tests)
|
||||
|
||||
find_package(CGAL REQUIRED)
|
||||
find_package(CGAL REQUIRED OPTIONAL_COMPONENTS Qt5)
|
||||
|
||||
set(hfiles Linear_cell_complex_2_test.h
|
||||
Linear_cell_complex_3_test.h Linear_cell_complex_3_test.h)
|
||||
|
|
@ -26,6 +26,11 @@ target_compile_definitions(Linear_cell_complex_3_test_index PUBLIC USE_COMPACT_C
|
|||
target_link_libraries(Linear_cell_complex_3_test_index PUBLIC CGAL CGAL::Data)
|
||||
cgal_add_compilation_test(Linear_cell_complex_3_test_index)
|
||||
|
||||
if(CGAL_Qt5_FOUND)
|
||||
target_link_libraries(Linear_cell_complex_3_test PUBLIC CGAL::CGAL_Basic_viewer)
|
||||
target_link_libraries(Linear_cell_complex_3_test_index PUBLIC CGAL::CGAL_Basic_viewer)
|
||||
endif()
|
||||
|
||||
add_executable(Linear_cell_complex_4_test_index Linear_cell_complex_4_test.cpp ${hfiles})
|
||||
target_compile_definitions(Linear_cell_complex_4_test_index PUBLIC USE_COMPACT_CONTAINER_WITH_INDEX)
|
||||
target_link_libraries(Linear_cell_complex_4_test_index PUBLIC CGAL CGAL::Data)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "Linear_cell_complex_2_test.h"
|
||||
#include <fstream>
|
||||
#include <typeinfo>
|
||||
|
||||
#include<CGAL/draw_linear_cell_complex.h>
|
||||
template<typename LCC>
|
||||
bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe,
|
||||
unsigned int nbf, unsigned int nbvol,
|
||||
|
|
@ -63,6 +63,13 @@ bool check_number_of_cells_3(LCC& lcc, unsigned int nbv, unsigned int nbe,
|
|||
return true;
|
||||
}
|
||||
|
||||
template<typename Map>
|
||||
void create_attributes_3(Map& map)
|
||||
{
|
||||
create_attributes_2(map);
|
||||
CreateAttributes<Map, 3>::run(map);
|
||||
}
|
||||
|
||||
template<typename LCC>
|
||||
typename LCC::Dart_descriptor make_loop(LCC& lcc, const typename LCC::Point& p1)
|
||||
{
|
||||
|
|
@ -96,6 +103,7 @@ bool test_LCC_3()
|
|||
Dart_descriptor dh1=lcc.make_segment(Point(0,0,0),Point(1,0,0), true);
|
||||
Dart_descriptor dh2=lcc.make_segment(Point(2,0,0),Point(2,1,0), true);
|
||||
Dart_descriptor dh3=lcc.make_segment(Point(2,2,0),Point(3,1,0), true);
|
||||
create_attributes_3(lcc);
|
||||
if ( !check_number_of_cells_3(lcc, 6, 3, 6, 3, 3) )
|
||||
return false;
|
||||
|
||||
|
|
@ -210,6 +218,7 @@ bool test_LCC_3()
|
|||
if ( !check_number_of_cells_3(lcc, 11, 13, 8, 2, 2) )
|
||||
return false;
|
||||
|
||||
// CGAL::draw(lcc);
|
||||
trace_test_begin();
|
||||
lcc.template remove_cell<0>(dh9);
|
||||
if ( !check_number_of_cells_3(lcc, 10, 12, 8, 2, 2) )
|
||||
|
|
@ -320,6 +329,7 @@ bool test_LCC_3()
|
|||
dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3));
|
||||
dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3));
|
||||
lcc.template sew<3>(dh1, dh2);
|
||||
create_attributes_3(lcc);
|
||||
dh2 = lcc.previous(dh1); dh3 = lcc.next(dh1);
|
||||
|
||||
lcc.template contract_cell<1>(dh1);
|
||||
|
|
@ -341,6 +351,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3));
|
||||
dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
|
||||
dh2 = lcc.next(dh2);
|
||||
|
|
@ -373,6 +384,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3));
|
||||
dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
|
||||
dh2 = lcc.next(dh2);
|
||||
|
|
@ -405,6 +417,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3));
|
||||
dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
|
||||
dh3 = lcc.make_triangle(Point(5,5,4),Point(7,5,4),Point(6,6,4));
|
||||
|
|
@ -445,6 +458,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3));
|
||||
dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
|
||||
dh3 = lcc.make_triangle(Point(5,5,4),Point(7,5,4),Point(6,6,4));
|
||||
|
|
@ -483,6 +497,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = lcc.make_tetrahedron(Point(9, 9, 0),Point(9, 0, 9),
|
||||
Point(0, 9, 9),Point(0, 0, 0));
|
||||
create_attributes_3(lcc);
|
||||
typename LCC::Vector v=CGAL::compute_normal_of_cell_0(lcc, dh1);
|
||||
if (v!=typename LCC::Vector(-9,-9,9))
|
||||
{
|
||||
|
|
@ -496,7 +511,7 @@ bool test_LCC_3()
|
|||
dh1 = lcc.
|
||||
make_hexahedron(Point(0,0,0),Point(1,0,0),Point(1,2,0),Point(0,2,0),
|
||||
Point(0,3,4),Point(0,0,4),Point(6,0,4),Point(6,3,4));
|
||||
|
||||
create_attributes_3(lcc);
|
||||
v=CGAL::compute_normal_of_cell_2(lcc, lcc.template
|
||||
opposite<2>(lcc.previous(dh1)));
|
||||
if (v!=typename LCC::Vector(0,0,1))
|
||||
|
|
@ -529,6 +544,7 @@ bool test_LCC_3()
|
|||
make_hexahedron(Point(0,3,0),Point(1,3,0),Point(1,4,0),Point(0,4,0),
|
||||
Point(0,4,1),Point(0,3,1),Point(1,3,1),Point(1,4,1));
|
||||
dh2 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2))));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<3>(dh1,dh2);
|
||||
|
||||
lcc.template contract_cell<1>(lcc.previous(dh1));
|
||||
|
|
@ -560,12 +576,14 @@ bool test_LCC_3()
|
|||
|
||||
trace_test_begin();
|
||||
dh1 = make_loop<LCC>(lcc, Point(0,0,0));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template contract_cell<2>(dh1);
|
||||
if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<1>(lcc.template opposite<2>(dh1),
|
||||
lcc.other_orientation(lcc.template opposite<2>(dh1)));
|
||||
lcc.template contract_cell<2>(dh1);
|
||||
|
|
@ -575,6 +593,7 @@ bool test_LCC_3()
|
|||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0),true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<1>(dh1, lcc.other_orientation(dh1));
|
||||
lcc.template sew<1>(lcc.template opposite<2>(dh1),
|
||||
lcc.other_orientation(lcc.template opposite<2>(dh1)));
|
||||
|
|
@ -586,6 +605,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = make_face_two_edges(lcc, Point(0,0,0), Point(1,0,0));
|
||||
dh2 = make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
lcc.template contract_cell<2>(dh1);
|
||||
if ( !check_number_of_cells_3(lcc, 2, 2, 1, 1, 1) )
|
||||
|
|
@ -600,6 +620,7 @@ bool test_LCC_3()
|
|||
dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3));
|
||||
dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3));
|
||||
dh3 = lcc.make_triangle(Point(5,3,3),Point(7,3,3),Point(6,0,3));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
lcc.template sew<2>(lcc.next(dh2), dh3);
|
||||
|
||||
|
|
@ -615,6 +636,7 @@ bool test_LCC_3()
|
|||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.create_dart(Point(0,0,0));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<3>(dh1, lcc.create_dart(Point(1,0,0)));
|
||||
lcc.template contract_cell<2>(dh1);
|
||||
if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) )
|
||||
|
|
@ -623,6 +645,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = make_loop(lcc, Point(0,0,0));
|
||||
dh2 = make_loop(lcc, Point(0,0,1));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<3>(dh1, dh2);
|
||||
lcc.template contract_cell<2>(dh1);
|
||||
if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) )
|
||||
|
|
@ -630,6 +653,7 @@ bool test_LCC_3()
|
|||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<3>(dh1, lcc.make_segment(Point(0,0,1),Point(1,0,1), true));
|
||||
lcc.template sew<3>(lcc.template opposite<2>(dh1),
|
||||
lcc.template opposite<2>(lcc.template opposite<3>(dh1)));
|
||||
|
|
@ -640,8 +664,10 @@ bool test_LCC_3()
|
|||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<1>(dh1, lcc.other_orientation(dh1));
|
||||
dh2 = lcc.make_segment(Point(0,0,1),Point(1,0,1), true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<1>(dh2, lcc.other_orientation(dh2));
|
||||
lcc.template sew<3>(dh1, dh2);
|
||||
lcc.template contract_cell<2>(dh1);
|
||||
|
|
@ -651,10 +677,12 @@ bool test_LCC_3()
|
|||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<1>(dh1, lcc.other_orientation(dh1));
|
||||
lcc.template sew<1>(lcc.template opposite<2>(dh1),
|
||||
lcc.other_orientation(lcc.template opposite<2>(dh1)));
|
||||
dh2 = lcc.make_segment(Point(0,0,1),Point(1,0,1), true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<1>(dh2, lcc.other_orientation(dh2));
|
||||
lcc.template sew<1>(lcc.template opposite<2>(dh2),
|
||||
lcc.other_orientation(lcc.template opposite<2>(dh2)));
|
||||
|
|
@ -669,6 +697,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = make_face_two_edges(lcc, Point(0,0,0), Point(1,0,0));
|
||||
dh2 = make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
lcc.template sew<3>(dh1,
|
||||
make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1)));
|
||||
|
|
@ -686,6 +715,7 @@ bool test_LCC_3()
|
|||
trace_test_begin();
|
||||
dh1 = make_face_two_edges(lcc, Point(0,0,0), Point(1,0,0));
|
||||
dh2 = make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
lcc.template sew<3>(dh1,
|
||||
make_face_two_edges(lcc, Point(0,0,1), Point(1,0,1)));
|
||||
|
|
@ -706,6 +736,7 @@ bool test_LCC_3()
|
|||
dh1 = lcc.make_triangle(Point(5,5,3),Point(7,5,3),Point(6,6,3));
|
||||
dh2 = lcc.make_triangle(Point(5,4,3),Point(7,4,3),Point(6,3,3));
|
||||
dh3 = lcc.make_triangle(Point(5,3,3),Point(7,3,3),Point(6,0,3));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<2>(dh1, dh2);
|
||||
lcc.template sew<2>(lcc.next(dh2), dh3);
|
||||
lcc.template sew<3>(dh1, lcc.make_triangle(Point(5,5,4),Point(7,5,4),
|
||||
|
|
@ -737,18 +768,21 @@ bool test_LCC_3()
|
|||
|
||||
trace_test_begin();
|
||||
dh1 = make_loop<LCC>(lcc, Point(0,0,0));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template contract_cell<3>(dh1);
|
||||
if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template contract_cell<3>(dh1);
|
||||
if ( !check_number_of_cells_3(lcc, 0, 0, 0, 0, 0) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
dh1 = lcc.make_segment(Point(0,0,0),Point(1,0,0), true);
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<1>(dh1, lcc.other_orientation(dh1));
|
||||
lcc.template sew<1>(lcc.template opposite<2>(dh1),
|
||||
lcc.other_orientation(lcc.template opposite<2>(dh1)));
|
||||
|
|
@ -764,6 +798,7 @@ bool test_LCC_3()
|
|||
dh2 = lcc.
|
||||
make_hexahedron(Point(0,3,0),Point(1,3,0),Point(1,4,0),Point(0,4,0),
|
||||
Point(0,4,1),Point(0,3,1),Point(1,3,1),Point(1,4,1));
|
||||
create_attributes_3(lcc);
|
||||
dh2 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2))));
|
||||
lcc.template sew<3>(dh1,dh2);
|
||||
|
||||
|
|
@ -813,6 +848,7 @@ bool test_LCC_3()
|
|||
dh3 = lcc.
|
||||
make_hexahedron(Point(0,6,0),Point(1,6,0),Point(1,7,0),Point(0,7,0),
|
||||
Point(0,7,1),Point(0,6,1),Point(1,6,1),Point(1,7,1));
|
||||
create_attributes_3(lcc);
|
||||
dh3 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh3))));
|
||||
lcc.template sew<3>(dh2,dh3);
|
||||
dh2 = lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2))));
|
||||
|
|
@ -861,6 +897,12 @@ bool test_LCC_3()
|
|||
Point(1,2,0),Point(0,2,0),
|
||||
Point(0,3,4),Point(0,0,4),
|
||||
Point(6,0,4),Point(6,3,4));
|
||||
|
||||
dh2=lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.previous(dh1));
|
||||
if ( !check_number_of_cells_3(lcc, 8, 13, 7, 1, 1) )
|
||||
return false;
|
||||
lcc.template remove_cell<1>(dh2);
|
||||
|
||||
dh2 = lcc.
|
||||
make_hexahedron(Point(0,0,4),Point(1,0,4),
|
||||
Point(1,2,4),Point(0,2,4),
|
||||
|
|
@ -871,16 +913,24 @@ bool test_LCC_3()
|
|||
Point(6,2,4),Point(5,2,4),
|
||||
Point(5,3,8),Point(5,0,8),
|
||||
Point(11,0,8),Point(11,3,8));
|
||||
lcc.template sew<3>(dh1,lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2)))));
|
||||
lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)), lcc.template opposite<2>(lcc.previous(dh3)));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<3>(dh1,lcc.template opposite<2>
|
||||
(lcc.next(lcc.next(lcc.template opposite<2>(dh2)))));
|
||||
lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)),
|
||||
lcc.template opposite<2>(lcc.previous(dh3)));
|
||||
|
||||
lcc.template close<3>();
|
||||
if ( !check_number_of_cells_3(lcc, 16, 28, 16, 4, 1) )
|
||||
return false;
|
||||
|
||||
lcc.insert_cell_1_in_cell_2(lcc.next(dh1), Alpha1<LCC>::run(lcc, lcc.previous(dh1)));
|
||||
lcc.insert_cell_1_in_cell_2(lcc.next(dh1), lcc.previous(dh1));
|
||||
if ( !check_number_of_cells_3(lcc, 16, 29, 17, 4, 1) )
|
||||
return false;
|
||||
|
||||
dh2=lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh1))));
|
||||
lcc.insert_cell_1_in_cell_2(dh2, Alpha1<LCC>::run(lcc, lcc.next(lcc.next(dh2))));
|
||||
lcc.insert_cell_1_in_cell_2(dh2, lcc.next(lcc.next(dh2)));
|
||||
if ( !check_number_of_cells_3(lcc, 16, 30, 18, 4, 1) )
|
||||
return false;
|
||||
|
||||
std::vector<Dart_descriptor> path;
|
||||
path.push_back(lcc.next(dh1));
|
||||
|
|
@ -891,6 +941,52 @@ bool test_LCC_3()
|
|||
if ( !check_number_of_cells_3(lcc, 16, 30, 19, 5, 1) )
|
||||
return false;
|
||||
|
||||
// Test insertion between two different 2-cells
|
||||
trace_test_begin();
|
||||
lcc.clear();
|
||||
dh1 = lcc.
|
||||
make_hexahedron(Point(0,0,0),Point(1,0,0),
|
||||
Point(1,2,0),Point(0,2,0),
|
||||
Point(0,3,4),Point(0,0,4),
|
||||
Point(6,0,4),Point(6,3,4));
|
||||
dh2 = lcc.
|
||||
make_hexahedron(Point(0,0,4),Point(1,0,4),
|
||||
Point(1,2,4),Point(0,2,4),
|
||||
Point(0,3,8),Point(0,0,8),
|
||||
Point(6,0,8),Point(6,3,8));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<3>(dh1,lcc.template opposite<2>(lcc.next(lcc.next(lcc.template opposite<2>(dh2)))));
|
||||
|
||||
lcc.insert_cell_1_between_two_cells_2(lcc.template opposite<2>(dh1),
|
||||
lcc.template opposite<2>(lcc.next(dh1)));
|
||||
if ( !check_number_of_cells_3(lcc, 12, 21, 10, 2, 1) )
|
||||
return false;
|
||||
|
||||
trace_test_begin();
|
||||
lcc.clear();
|
||||
dh1=lcc.make_hexahedron(Point(0,0,0), Point(5,0,0),
|
||||
Point(5,5,0), Point(0,5,0),
|
||||
Point(0,5,4), Point(0,0,4),
|
||||
Point(5,0,4), Point(5,5,4));
|
||||
dh2=lcc.make_hexahedron(Point(5,0,0), Point(10,0,0),
|
||||
Point(10,5,0), Point(5,5,0),
|
||||
Point(5,5,4), Point(5,0,4),
|
||||
Point(10,0,4), Point(10,5,4));
|
||||
dh3=lcc.make_quadrangle(Point(5,2,2), Point(5,1,2),
|
||||
Point(5,1,1), Point(5,2,1));
|
||||
create_attributes_3(lcc);
|
||||
lcc.template sew<3>(lcc.template opposite<2>(lcc.next(lcc.next(dh1))),
|
||||
lcc.other_orientation(lcc.template opposite<2>(dh2)));
|
||||
lcc.template sew<3>(dh3, lcc.make_combinatorial_polygon(4));
|
||||
|
||||
// Create an hole in the face between the two cubes
|
||||
lcc.insert_cell_1_between_two_cells_2(lcc.template opposite<2>(lcc.next(lcc.next(dh1))),
|
||||
lcc.next(lcc.next(dh3)));
|
||||
|
||||
CGAL::draw(lcc); // TODO remove
|
||||
if (!check_number_of_cells_3(lcc, 16, 25, 11, 2, 1) )
|
||||
return false;
|
||||
|
||||
// Construction from Polyhedron_3
|
||||
{
|
||||
trace_test_begin();
|
||||
|
|
|
|||
Loading…
Reference in New Issue