From 6a2932b8d279bac30777b1a206807714c0290c85 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Jan 2023 15:42:54 +0000 Subject: [PATCH 01/20] LCC: Add an incremental builder --- .../doc/Linear_cell_complex/PackageDescription.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt index 42da9fd9276..975b4a3f053 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt @@ -63,6 +63,7 @@ - `CGAL::Cell_attribute_with_point` - `CGAL::Cell_attribute_with_point_and_id` - `CGAL::Linear_cell_complex` +- `CGAL::Linear_cell_complex_incremental_builder_3` \cgalCRPSection{Global Functions} \cgalCRPSubsection{Constructions for Linear Cell Complex} @@ -78,4 +79,3 @@ - \link PkgDrawLinearCellComplex CGAL::draw() \endlink */ - From ac00c68f38219572b191508fbcea1abfd6933563 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Jan 2023 16:06:13 +0000 Subject: [PATCH 02/20] Add file --- .../Linear_cell_complex_incremental_builder.h | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h new file mode 100644 index 00000000000..771b00fa46a --- /dev/null +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h @@ -0,0 +1,94 @@ + +namespace CGAL { + +/*! +\ingroup PkgLinearCellComplexClasses + +The auxiliary class `Linear_cell_complex_incremental_builder` supports the incremental +construction of linear cell complexes. + +\tparam LCC a linear cell complex +*/ + +template < class LCC > +class Linear_cell_complex_incremental_builder_3 +{ + typedef LCC_ LCC; + typedef typename LCC::Dart_descriptor DH; + typedef typename LCC::Vertex_attribute_descriptor VAH; + typedef typename LCC::Point Point_3; + typedef typename LCC::size_type size_type; + + /// \name Creation + /// @{ + + /*! + * Constructor + */ + Linear_cell_complex_incremental_builder_3(LCC & alcc); + +/// @} + + /*! +\name Surface Creation + +To build a linear cell complex, the following regular expression gives +the correct and allowed order and nesting of method calls from this +section: + +\code +begin_surface ( add_vertex | ( begin_facet add_vertex_to_facet end_facet ) ) end_surface +\endcode +*/ +/// @{ + + + /*! + * + */ + void begin_surface(); + + + /*! + * adds a new vertex for `p` and returns its handle. + */ + VAH add_vertex(const Point_3& p); + + /* + * starts a new facet and returns its handle. + */ + void begin_facet(); + + /*! + * + */ + void add_vertex_to_facet(size_type i); + + /*! + * End of the facet. Returns the first dart of this facet. + */ + DH end_facet(); + + + /*! + * End of the surface construction. Returns one dart of the created surface. + */ + DH end_surface(); + +/// @} + +/// \name Additional Operations +/// @{ + +/*! + * is a synonym for `begin_facet()`, a call to `add_vertex_to_facet()` for each + * value in the range `[first,beyond)`, and a call to `end_facet()`. + */ + DH add_facet(std::initializer_list l); + + +/// @} + + }; + +} // namespace CGAL From d6e5e22ce10760f69240a39e1e2eb52534edaef8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Jan 2023 16:15:40 +0000 Subject: [PATCH 03/20] No _3 --- .../doc/Linear_cell_complex/PackageDescription.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt index 975b4a3f053..f6ba76d90be 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt @@ -63,7 +63,7 @@ - `CGAL::Cell_attribute_with_point` - `CGAL::Cell_attribute_with_point_and_id` - `CGAL::Linear_cell_complex` -- `CGAL::Linear_cell_complex_incremental_builder_3` +- `CGAL::Linear_cell_complex_incremental_builder` \cgalCRPSection{Global Functions} \cgalCRPSubsection{Constructions for Linear Cell Complex} From 217a65bfba83027c1fb47688b9397550b61849e9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Jan 2023 16:25:58 +0000 Subject: [PATCH 04/20] Make public: --- .../CGAL/Linear_cell_complex_incremental_builder.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h index 771b00fa46a..8f19ee07783 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h @@ -13,6 +13,7 @@ construction of linear cell complexes. template < class LCC > class Linear_cell_complex_incremental_builder_3 { + public: typedef LCC_ LCC; typedef typename LCC::Dart_descriptor DH; typedef typename LCC::Vertex_attribute_descriptor VAH; From 17b86d5536932e482d5a5c12bfd43eadbd712a7f Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Jan 2023 16:32:19 +0000 Subject: [PATCH 05/20] Another _3 --- .../CGAL/Linear_cell_complex_incremental_builder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h index 8f19ee07783..9663a9693c3 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h @@ -11,7 +11,7 @@ construction of linear cell complexes. */ template < class LCC > -class Linear_cell_complex_incremental_builder_3 +class Linear_cell_complex_incremental_builder { public: typedef LCC_ LCC; @@ -26,7 +26,7 @@ class Linear_cell_complex_incremental_builder_3 /*! * Constructor */ - Linear_cell_complex_incremental_builder_3(LCC & alcc); + Linear_cell_complex_incremental_builder(LCC & alcc); /// @} From ab2a655a53dd0ff1b78cddba726171bc3421c47e Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Jan 2023 13:44:08 +0000 Subject: [PATCH 06/20] Fixes after Guillaume's review --- .../doc/Linear_cell_complex/PackageDescription.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt index f6ba76d90be..5978b48c317 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt @@ -62,7 +62,6 @@ - `CGAL::Linear_cell_complex_traits` - `CGAL::Cell_attribute_with_point` - `CGAL::Cell_attribute_with_point_and_id` -- `CGAL::Linear_cell_complex` - `CGAL::Linear_cell_complex_incremental_builder` \cgalCRPSection{Global Functions} From 54245a754ff3c96cb132f9db35ab07a4a9801f5c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Jan 2023 14:38:31 +0000 Subject: [PATCH 07/20] Add example --- .../doc/Linear_cell_complex/examples.txt | 1 + .../Linear_cell_complex/CMakeLists.txt | 1 + ...ear_cell_complex_3_incremental_builder.cpp | 58 +++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp 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)< Date: Mon, 30 Jan 2023 15:03:53 +0000 Subject: [PATCH 08/20] Fix CMakeLists.txt --- .../examples/Linear_cell_complex/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt index 27f68625fc3..d0ed1c3a028 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt +++ b/Linear_cell_complex/examples/Linear_cell_complex/CMakeLists.txt @@ -21,7 +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_3_incremental_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") @@ -30,4 +30,5 @@ create_single_source_cgal_program("voronoi_3.cpp") create_single_source_cgal_program("draw_linear_cell_complex.cpp") if(CGAL_Qt5_FOUND) target_link_libraries(draw_linear_cell_complex PUBLIC CGAL::CGAL_Basic_viewer) + target_link_libraries(linear_cell_complex_3_incremental_builder PUBLIC CGAL::CGAL_Basic_viewer) endif() From 5270bbfdc703796c71af592105e5dac91b922b81 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Jan 2023 15:09:58 +0000 Subject: [PATCH 09/20] trailing whitespace --- .../linear_cell_complex_3_incremental_builder.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 index 6ad599abb91..1e16e5efdec 100644 --- 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 @@ -10,7 +10,7 @@ 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 @@ -34,13 +34,13 @@ int main() 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}); @@ -48,11 +48,11 @@ int main() ib.add_facet({3,4,8}); ib.add_facet({4,5,8}); ib.add_facet({5,0,8}); - ib.end_surface(); + ib.end_surface(); // Draw the lcc and display its characteristics lcc.display_characteristics(std::cout)< Date: Tue, 31 Jan 2023 10:10:03 +0000 Subject: [PATCH 10/20] Add _3 suffix and add example to the User Manual --- ...near_cell_complex_incremental_builder_3.h} | 6 ++--- .../Linear_cell_complex.txt | 16 +++++++++++++- .../PackageDescription.txt | 2 +- ...ear_cell_complex_3_incremental_builder.cpp | 2 +- ...near_cell_complex_incremental_builder_3.h} | 22 +++++++++---------- 5 files changed, 31 insertions(+), 17 deletions(-) rename Linear_cell_complex/doc/Linear_cell_complex/CGAL/{Linear_cell_complex_incremental_builder.h => Linear_cell_complex_incremental_builder_3.h} (89%) rename Linear_cell_complex/include/CGAL/{Linear_cell_complex_incremental_builder.h => Linear_cell_complex_incremental_builder_3.h} (93%) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h similarity index 89% rename from Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h rename to Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h index 9663a9693c3..863369c04b5 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h @@ -4,14 +4,14 @@ namespace CGAL { /*! \ingroup PkgLinearCellComplexClasses -The auxiliary class `Linear_cell_complex_incremental_builder` supports the incremental +The auxiliary class `Linear_cell_complex_incremental_builder_3` supports the incremental construction of linear cell complexes. \tparam LCC a linear cell complex */ template < class LCC > -class Linear_cell_complex_incremental_builder +class Linear_cell_complex_incremental_builder_3 { public: typedef LCC_ LCC; @@ -26,7 +26,7 @@ class Linear_cell_complex_incremental_builder /*! * Constructor */ - Linear_cell_complex_incremental_builder(LCC & alcc); + Linear_cell_complex_incremental_builder_3(LCC & alcc); /// @} diff --git a/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt b/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt index 925e269a738..fcb11828b2a 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt @@ -141,6 +141,14 @@ Some examples of use of these operations are given in Section \ref ssec5dexample If \link GenericMap::set_automatic_attributes_management `set_automatic_attributes_management(false)`\endlink is called, all the future insertion or removal operations will not update non void attributes. These attributes will be updated latter by the call to \link GenericMap::set_automatic_attributes_management `set_automatic_attributes_management(true)`\endlink. This can be useful to speed up an algorithm which uses several successive insertion and removal operations. See example \ref ssecAttributesManagement "Automatic attributes management". \cgalAdvancedEnd + +\subsection Linear_cell_complexIncrementalBuilder Incremental Builder + +A utility class `Linear_cell_complex_incremental_builder_3` helps in creating 2D and 3D linear cell complexes +from a list of points followed by a list of facets that are represented as indices into the point list. +Note that, compared to `Polyhedron_incremental_builder_3` it has only absolute indexing and no rollback +mechanism. + \section Linear_cell_complexExamples Examples \subsection Linear_cell_complexA3DLinearCellComplex A 3D Linear Cell Complex @@ -264,10 +272,16 @@ Linking with the cmake target `CGAL::CGAL_Basic_viewer` will link with `CGAL_Qt5 Result of the run of the draw_linear_cell_complex program. A window shows two 3D cubes and allows to navigate through the 3D scene. \cgalFigureEnd +\subsection Linear_cell_complexIncrementalBuilderExample Incremental Builder + +The following example shows the incremental builder + +\cgalExample{Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp} + + \section Linear_cell_complexDesign Design and Implementation History This package was developed by Guillaume Damiand, with the help of Andreas Fabri, Sébastien Loriot and Laurent Rineau. Monique Teillaud and Bernd Gärtner contributed to the manual. */ } /* namespace CGAL */ - diff --git a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt index 5978b48c317..d8cc1ad2fbd 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/PackageDescription.txt @@ -62,7 +62,7 @@ - `CGAL::Linear_cell_complex_traits` - `CGAL::Cell_attribute_with_point` - `CGAL::Cell_attribute_with_point_and_id` -- `CGAL::Linear_cell_complex_incremental_builder` +- `CGAL::Linear_cell_complex_incremental_builder_3` \cgalCRPSection{Global Functions} \cgalCRPSubsection{Constructions for Linear Cell Complex} 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 index 1e16e5efdec..9bcbb86a5ca 100644 --- 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 @@ -1,5 +1,5 @@ #include -#include +#include #include typedef CGAL::Linear_cell_complex_for_combinatorial_map<3, 3> LCC_3; diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder_3.h similarity index 93% rename from Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder.h rename to Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder_3.h index 087b3da7944..8efa806a91e 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder_3.h @@ -9,8 +9,8 @@ // // Author(s) : Guillaume Damiand // -#ifndef CGAL_LINEAR_CELL_COMPLEX_INCREMENTAL_BUILDER_H -#define CGAL_LINEAR_CELL_COMPLEX_INCREMENTAL_BUILDER_H 1 +#ifndef CGAL_LINEAR_CELL_COMPLEX_INCREMENTAL_BUILDER_3_H +#define CGAL_LINEAR_CELL_COMPLEX_INCREMENTAL_BUILDER_3_H 1 #include #include @@ -127,7 +127,7 @@ struct Find_opposite_2_with_control { if (!lcc.template is_free<2>(res)) { // Here a dart vah1->vah2 already exists, and it was already 2-sewn. - std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: try to use a same oriented edge twice."< vertex_to_dart_map_in_surface, vah2, vah1)!=lcc.null_descriptor) { // Here a dart vah1->vah2 already exists (but it was not already 2-sewn). - std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: try to use a same oriented edge twice."< { if (!lcc.template is_free<2>(res)) { // Here a dart vah1->vah2 already exists, and it was already 2-sewn. - std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: try to use a same oriented edge twice."< }; /////////////////////////////////////////////////////////////////////////////// template -struct Sew3_for_LCC_incremental_builder +struct Sew3_for_LCC_incremental_builder_3 { static void run(LCC_& lcc, typename LCC_::Dart_descriptor dh1, typename LCC_::Dart_descriptor dh2) @@ -218,8 +218,8 @@ struct Sew3_for_LCC_incremental_builder { if(!lcc.template is_free<3>(dh1)) { - std::cerr<<"ERROR in My_linear_cell_complex_incremental_builder_3: " - <<"it exists more than 2 faces with same indices."<(lcc.other_orientation(dh1), dh2); } @@ -227,7 +227,7 @@ struct Sew3_for_LCC_incremental_builder } }; template -struct Sew3_for_LCC_incremental_builder +struct Sew3_for_LCC_incremental_builder_3 { static void run(LCC_&, typename LCC_::Dart_descriptor, typename LCC_::Dart_descriptor) {} @@ -319,7 +319,7 @@ public: if(LCC::dimension>2) { opposite=opposite_face(); - Sew3_for_LCC_incremental_builder::run(lcc, opposite, min_dart); + Sew3_for_LCC_incremental_builder_3::run(lcc, opposite, min_dart); add_face_in_array(); } return first_dart; @@ -404,5 +404,5 @@ private: } //namespace CGAL -#endif // CGAL_LINEAR_CELL_COMPLEX_INCREMENTAL_BUILDER_H // +#endif // CGAL_LINEAR_CELL_COMPLEX_INCREMENTAL_BUILDER_3_H // // EOF // From 4ca40f8e07b4628d80505119e2c25f0ac56bd3c3 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Wed, 1 Feb 2023 11:35:19 +0100 Subject: [PATCH 11/20] LCC incremental builder doc --- .../CGAL/Linear_cell_complex_incremental_builder_3.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h index 863369c04b5..383cb47cd40 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h @@ -45,7 +45,7 @@ begin_surface ( add_vertex | ( begin_facet add_vertex_to_facet end_facet ) ) /*! - * + * starts a new surface. */ void begin_surface(); @@ -56,23 +56,23 @@ begin_surface ( add_vertex | ( begin_facet add_vertex_to_facet end_facet ) ) VAH add_vertex(const Point_3& p); /* - * starts a new facet and returns its handle. + * starts a new facet. */ void begin_facet(); /*! - * + * add vertex `i` at the end of the current facet. */ void add_vertex_to_facet(size_type i); /*! - * End of the facet. Returns the first dart of this facet. + * end of the facet. Returns the first dart of this facet. */ DH end_facet(); /*! - * End of the surface construction. Returns one dart of the created surface. + * end of the surface construction. Returns one dart of the created surface. */ DH end_surface(); From f1535c2ae4ed29b3d590e9a57308ff2b65a3d806 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 1 Feb 2023 10:52:31 +0000 Subject: [PATCH 12/20] Unify comments --- .../CGAL/Linear_cell_complex_incremental_builder_3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h index 383cb47cd40..12525e0cc33 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h @@ -61,18 +61,18 @@ begin_surface ( add_vertex | ( begin_facet add_vertex_to_facet end_facet ) ) void begin_facet(); /*! - * add vertex `i` at the end of the current facet. + * adds vertex `i` at the end of the current facet. */ void add_vertex_to_facet(size_type i); /*! - * end of the facet. Returns the first dart of this facet. + * ends the construction of the facet and returns the first dart of this facet. */ DH end_facet(); /*! - * end of the surface construction. Returns one dart of the created surface. + * ends the construction of the surface and returns one dart of the created surface. */ DH end_surface(); From 612991fa841068cf5e407ed7ed5e3cdf29447636 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Wed, 1 Feb 2023 13:08:51 +0100 Subject: [PATCH 13/20] add _3 after LCC incremental builder --- .../include/CGAL/Linear_cell_complex_constructors.h | 2 +- .../test/Linear_cell_complex/LCC_3_incremental_builder_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h index c1032854fba..1bdac283a67 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h @@ -13,7 +13,7 @@ #define CGAL_LINEAR_CELL_COMPLEX_CONSTRUCTORS_H 1 #include -#include +#include #include #include diff --git a/Linear_cell_complex/test/Linear_cell_complex/LCC_3_incremental_builder_test.cpp b/Linear_cell_complex/test/Linear_cell_complex/LCC_3_incremental_builder_test.cpp index 2569b0f929b..03d6bf55922 100644 --- a/Linear_cell_complex/test/Linear_cell_complex/LCC_3_incremental_builder_test.cpp +++ b/Linear_cell_complex/test/Linear_cell_complex/LCC_3_incremental_builder_test.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include "Linear_cell_complex_3_test.h" From 1530b0a25d8fee4241964b4b5c1b361b97f4c2ed Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 1 Feb 2023 13:02:03 +0000 Subject: [PATCH 14/20] Traverse the linear cell complex in the example --- .../linear_cell_complex_3_incremental_builder.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 index 9bcbb86a5ca..d05c1c1009f 100644 --- 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 @@ -50,6 +50,20 @@ int main() ib.add_facet({5,0,8}); ib.end_surface(); + + LCC_3::One_dart_per_cell_range<3,3> cells = lcc.one_dart_per_cell<3>(); + for (auto c = cells.begin(); c != cells.end(); ++c) { + std::cout << "a cell"<< std::endl; + LCC_3::One_dart_per_incident_cell_range<2,3> faces = lcc.one_dart_per_incident_cell<2,3>(c); + for (auto f = faces.begin(); f != faces.end(); ++f) { + std::cout << " a face"<< std::endl; + LCC_3::One_dart_per_incident_cell_range<0,2> vertices = lcc.one_dart_per_incident_cell<0,2>(f); + for(auto v = vertices.begin(); v!= vertices.end(); ++v){ + std::cout << " " << lcc.point(v) << std::endl; + } + } + } + // Draw the lcc and display its characteristics lcc.display_characteristics(std::cout)< Date: Thu, 2 Feb 2023 08:00:29 +0000 Subject: [PATCH 15/20] Fix doc --- .../CGAL/Linear_cell_complex_incremental_builder_3.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h index 12525e0cc33..f231dbf323e 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h @@ -7,7 +7,7 @@ namespace CGAL { The auxiliary class `Linear_cell_complex_incremental_builder_3` supports the incremental construction of linear cell complexes. -\tparam LCC a linear cell complex +\tparam LCC must be a model of the concept `LinearCellComplex` */ template < class LCC > @@ -40,6 +40,10 @@ section: \code begin_surface ( add_vertex | ( begin_facet add_vertex_to_facet end_facet ) ) end_surface \endcode + +When an edge is added in a facet, if the same edge exists in another facet of the same surface, then the two facets are glued along this edge. + +When a facet is added, if the same facet exists in another surface, the two surfaces are glued along this facet. */ /// @{ From 7b3fd28dac67f2319145a94f6e6d77b9013d657e Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Thu, 2 Feb 2023 12:31:35 +0100 Subject: [PATCH 16/20] missing dot --- .../doc/Linear_cell_complex/Linear_cell_complex.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt b/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt index fcb11828b2a..6eae9275a75 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt +++ b/Linear_cell_complex/doc/Linear_cell_complex/Linear_cell_complex.txt @@ -274,7 +274,7 @@ Result of the run of the draw_linear_cell_complex program. A window shows two 3D \subsection Linear_cell_complexIncrementalBuilderExample Incremental Builder -The following example shows the incremental builder +The following example shows the incremental builder. \cgalExample{Linear_cell_complex/linear_cell_complex_3_incremental_builder.cpp} From a0826b492942970ca9184ba475f4e9c6e688684f Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Thu, 2 Feb 2023 12:31:53 +0100 Subject: [PATCH 17/20] update documentation in example --- .../linear_cell_complex_3_incremental_builder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 index d05c1c1009f..2c53a5dfb6d 100644 --- 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 @@ -23,13 +23,13 @@ int main() // 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({0,1,2,3}); // Create a new facet version 1: 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.begin_facet(); // Create a new facet version 2: begin facet + ib.add_vertex_to_facet(0); // add sucessively its indices ib.add_vertex_to_facet(3); ib.add_vertex_to_facet(4); ib.add_vertex_to_facet(5); From c37341671e4a3058aec4122fbb34ff95fad04f99 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 2 Feb 2023 12:29:29 +0000 Subject: [PATCH 18/20] Turn comment into doxygen comment --- .../CGAL/Linear_cell_complex_incremental_builder_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h index f231dbf323e..a2c950d46d6 100644 --- a/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h +++ b/Linear_cell_complex/doc/Linear_cell_complex/CGAL/Linear_cell_complex_incremental_builder_3.h @@ -59,7 +59,7 @@ When a facet is added, if the same facet exists in another surface, the two surf */ VAH add_vertex(const Point_3& p); - /* + /*! * starts a new facet. */ void begin_facet(); From c716775fc05e249366dd838cb98d1283aa2e1475 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 2 Feb 2023 12:33:29 +0000 Subject: [PATCH 19/20] Add to change log --- Installation/CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index a8e5332db23..63acb4dc055 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -14,6 +14,9 @@ Release date: June 2023 - Added a version that uses indices instead of handles as dart and attribute descriptors. As the indices are integers convertible from and to `std::size_t`, they can be used as index into vectors which store properties. To use the index version, `Use_index` must be defined and be equal to `CGAL::Tag_true` in the item class. +### [Linear Cell Complex](https://doc.cgal.org/5.6/Manual/packages.html#PkgLinearCellComplex) +- Added the class `Linear_cell_complex_incremental_builder_3`. + ### [Polygon Mesh Processing](https://doc.cgal.org/5.6/Manual/packages.html#PkgPolygonMeshProcessing) - **Breaking change**: Deprecated the overloads of functions `CGAL::Polygon_mesh_processing::triangulate_hole()`, From b2798bc81ebd1860d270a55ec1fafe147ae4cae6 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 2 Feb 2023 14:33:28 +0000 Subject: [PATCH 20/20] polish the example --- .../linear_cell_complex_3_incremental_builder.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 index 2c53a5dfb6d..414be85978a 100644 --- 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 @@ -5,7 +5,7 @@ typedef CGAL::Linear_cell_complex_for_combinatorial_map<3, 3> LCC_3; using Point=LCC_3::Point; -//============================================================================== + int main() { LCC_3 lcc; @@ -23,25 +23,24 @@ int main() // Create a cube ib.begin_surface(); - ib.add_facet({0,1,2,3}); // Create a new facet version 1: given all of its indices + ib.add_facet({0,1,2,3}); // Create a new facet version 1: 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.add_facet({5,4,7,6}); - ib.begin_facet(); // Create a new facet version 2: begin facet + ib.begin_facet(); // Create a new facet version 2: begin facet ib.add_vertex_to_facet(0); // add sucessively 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_facet(); 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 + // Create a pyramid, sharing one of its facets with a facet of the cube ib.begin_surface(); ib.add_facet({3,0,5,4}); ib.add_facet({0,3,8});