diff --git a/Linear_cell_complex/doc/Linear_cell_complex/examples.txt b/Linear_cell_complex/doc/Linear_cell_complex/examples.txt index f41e9b41af0..4f178f666d1 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/examples.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/examples.txt @@ -3,5 +3,6 @@ \example Linear_cell_complex/linear_cell_complex_3.cpp \example Linear_cell_complex/linear_cell_complex_4.cpp \example Linear_cell_complex/linear_cell_complex_3_attributes_management.cpp +\example Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp \example Linear_cell_complex/draw_linear_cell_complex.cpp */ diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index 1ee1208d461..27f68625fc3 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -21,6 +21,7 @@ create_single_source_cgal_program("linear_cell_complex_3_operations.cpp") create_single_source_cgal_program( "linear_cell_complex_3_with_colored_vertices.cpp") create_single_source_cgal_program("linear_cell_complex_3_with_mypoint.cpp") +create_single_source_cgal_program("linear_cell_complex_3_incremntal_builder.cpp") create_single_source_cgal_program("linear_cell_complex_4.cpp") create_single_source_cgal_program("plane_graph_to_lcc_2.cpp") create_single_source_cgal_program("voronoi_2.cpp") diff --git a/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp b/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp new file mode 100644 index 00000000000..6ad599abb91 --- /dev/null +++ b/Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp @@ -0,0 +1,58 @@ +#include +#include +#include + +typedef CGAL::Linear_cell_complex_for_combinatorial_map<3, 3> LCC_3; +using Point=LCC_3::Point; + +//============================================================================== +int main() +{ + LCC_3 lcc; + CGAL::Linear_cell_complex_incremental_builder_3 ib(lcc); + + ib.add_vertex(Point(0,0,0)); // vertex 0 + ib.add_vertex(Point(1,0,0)); // vertex 1 + ib.add_vertex(Point(1,1,0)); // vertex 2 + ib.add_vertex(Point(0,1,0)); // vertex 3 + + ib.add_vertex(Point(0,1,1)); // vertex 4 + ib.add_vertex(Point(0,0,1)); // vertex 5 + ib.add_vertex(Point(1,0,1)); // vertex 6 + ib.add_vertex(Point(1,1,1)); // vertex 7 + + // Create a cube + ib.begin_surface(); + ib.add_facet({0,1,2,3}); // Create a new facet v1: given all of its indices + ib.add_facet({1,0,5,6}); + ib.add_facet({2,1,6,7}); + ib.add_facet({3,2,7,4}); + + ib.begin_facet(); // Create a new facet v2: begin facet + ib.add_vertex_to_facet(0); // all incrementally its indices + ib.add_vertex_to_facet(3); + ib.add_vertex_to_facet(4); + ib.add_vertex_to_facet(5); + ib.end_facet(); // end facet + + ib.add_facet({5,4,7,6}); + + ib.end_surface(); + + ib.add_vertex(Point(-1, 0.5, 0.5)); // vertex 8 + + // Create a pyramid, sharing one of its face with the cube + ib.begin_surface(); + ib.add_facet({3,0,5,4}); + ib.add_facet({0,3,8}); + ib.add_facet({3,4,8}); + ib.add_facet({4,5,8}); + ib.add_facet({5,0,8}); + ib.end_surface(); + + // Draw the lcc and display its characteristics + lcc.display_characteristics(std::cout)<