diff --git a/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp b/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp index aee61c81bea..b2c283ddeea 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/diagrams.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/Documentation/doc/biblio/cgal_manual.bib b/Documentation/doc/biblio/cgal_manual.bib index 1752954416c..48965f3aa24 100644 --- a/Documentation/doc/biblio/cgal_manual.bib +++ b/Documentation/doc/biblio/cgal_manual.bib @@ -596,18 +596,20 @@ Teillaud" , author = "Olivier Devillers and Monique Teillaud" , title = "Perturbations and Vertex Removal in a {3D Delaunay} Triangulation" , booktitle = "Proc. 14th ACM-SIAM Sympos. Discrete Algorithms (SODA)" + , url = "http://hal.inria.fr/inria-00166710/" , year = 2003 , pages = "313-319" } -@TechReport{ cgal:dt-pvrdr-06, -author = {Devillers, Olivier and Teillaud, Monique}, -title = {Perturbations and Vertex Removal in {Delaunay} and Regular {3D} Triangulations}, -year = {2006}, -institution = {INRIA}, -number = {5968}, -type = {Research Report}, -note = {\url{ttp://hal.inria.fr/inria-00090522}} +@article{cgal:dt-pvrdr-06 +, author = "Olivier Devillers and Monique Teillaud" +, title = "Perturbations for {Delaunay} and weighted {Delaunay} {3D} Triangulations" +, journal = "Computational Geometry: Theory and Applications" +, volume = 44 +, year = 2011 +, pages = "160--168" +, url = "http://hal.archives-ouvertes.fr/inria-00560388/" +, doi = "10.1016/j.comgeo.2010.09.010" } @article{cgal:dw-tmgob-02, diff --git a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in index 972fb8ed031..01e09fe0932 100644 --- a/Documentation/doc/resources/1.8.4/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.4/BaseDoxyfile.in @@ -238,6 +238,7 @@ ALIASES += "cgalConcept=\details
\n \brief" ALIASES += "cgalConceptNamespace=\details
\n \brief" ALIASES += "cgalRefines=\xrefitem refines \"Refines\" \"Refinement Relationships\"" +ALIASES += "cgalRequires=\xrefitem requires \"Requires\" \"Type Requirements\"" ALIASES += "cgalModels=\xrefitem models \"Is Model Of\" \"Is Model Relationships\"" ALIASES += "cgalGeneralizes=\xrefitem generalizes \"Generalizes\" \"Generalization Relationships\"" ALIASES += "cgalHasModel=\xrefitem hasModels \"Has Models\" \"Has Model Relationships\"" diff --git a/Installation/AUTHORS b/Installation/AUTHORS index 3137dea9eee..69a2137a36d 100644 --- a/Installation/AUTHORS +++ b/Installation/AUTHORS @@ -74,6 +74,7 @@ Ralf Osbild Steve Oudot Eli Packer Dmitrii Pasechnik +Aymeric Pellé Luis Peñaranda Sylvain Pion Marc Pouget diff --git a/Installation/changes.html b/Installation/changes.html index c3527000086..ca5c03a8da4 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -16,7 +16,7 @@ padding-top: 0.2em; } code::before, code::after { - content: " "; + content: " "; letter-spacing: -0.2em; } @@ -214,6 +214,37 @@ and src/ directories). (but still equal to Traits::Point_3). +
  • + Added a new 3D traits class, Robust_weighted_circumcenter_filtered_traits_3 + which provides robust versions of the kernel functors Construct_weighted_circumcenter_3, + Compute_squared_radius_3, and Compute_squared_radius_smallest_orthogonal_sphere_3. + This class can be used as traits class in the the Mesh_3 package + to efficiently yet robustly generate 3D meshes. +
  • + +

    3D Periodic Triangulations

    +
      +
    • + Added the class Periodic_3_regular_triangulation_3, which provides functionality + for 3D periodic weighted Delaunay triangulations. The construction is fully + dynamic: it provides both point insertion and vertex removal. +
    • +
    • + Added new locate and geometric access functions for 3D periodic triangulations. +
    • +
    • + The class Periodic_3_Delaunay_triangulation_traits_3 now inherits + Periodic_3_triangulation_traits_3. +
    • +
    • Breaking change: + Some geometric access functions in Periodic_3_triangulation_3 were renamed. + The introduction of Periodic_3_regular_triangulation_3 required + to distinguish between functions such as segment() returning + a segment of weightless points, or a segment of weighted points. As a general + rule, previous geometrical access functions will return objects with point + type that of the triangulation (thus, weighted objects when using weighted triangulations) + and functions containing construct in the name will always + return weightless geometrical objects.
    @@ -1317,15 +1348,15 @@ and src/ directories). longer supported since CGAL-4.5. -
  • Since CGAL version 4.0, Eigen was the recommended third-party +
  • Since CGAL version 4.0, Eigen was the recommended third-party library to use with Planar Parameterization of Triangulated Surface Meshes, Surface Reconstruction from Point Sets, Approximation of Ridges and Umbilics on Triangulated Surface Meshes, and Estimation of Local Differential Properties of Point-Sampled Surfaces packages. From CGAL - version 4.5, Taucs, Blas and Lapack are no longer supported. + version 4.5, Taucs, Blas and Lapack are no longer supported.
  • -
  • CGAL is now compatible with the new CMake version 3.0.
  • +
  • CGAL is now compatible with the new CMake version 3.0.
  • @@ -1518,7 +1549,7 @@ and src/ directories).
  • Additional supported platforms:
    • The Apple Clang compiler version 5.0 is now supported on - OS X Mavericks.
    • + OS X Mavericks.
    • The Microsoft Windows Visual C++ compiler 2013 (VC12) is now supported.
    @@ -1692,7 +1723,7 @@ and src/ directories). constructor added to CGAL::Object. However, it is recommended to upgrade your code. The previous behavior can be restored by defining the - macro CGAL_INTERSECTION_VERSION to 1. + macro CGAL_INTERSECTION_VERSION to 1.
  • 2D Arrangements

    @@ -2016,7 +2047,7 @@ and src/ directories).
  • Additional supported platforms:
    • The Apple Clang compiler versions 3.1 and 3.2 are now supported on - Mac OS X.
    • + Mac OS X.
  • Improved configuration for essential and optional external third party software
  • diff --git a/Mesh_3/benchmark/Mesh_3/StdAfx.h b/Mesh_3/benchmark/Mesh_3/StdAfx.h index ad3cf5ed369..0aa9e0bd9a7 100644 --- a/Mesh_3/benchmark/Mesh_3/StdAfx.h +++ b/Mesh_3/benchmark/Mesh_3/StdAfx.h @@ -224,7 +224,6 @@ //#include //#include //#include -//#include //#include //#include //#include diff --git a/Mesh_3/doc/Mesh_3/CGAL/Mesh_triangulation_3.h b/Mesh_3/doc/Mesh_3/CGAL/Mesh_triangulation_3.h index e24f6e094cf..4b9b869b345 100644 --- a/Mesh_3/doc/Mesh_3/CGAL/Mesh_triangulation_3.h +++ b/Mesh_3/doc/Mesh_3/CGAL/Mesh_triangulation_3.h @@ -21,6 +21,16 @@ and defaults to `Mesh_vertex_base_3`. \tparam Cell_base must be a model of `MeshCellBase_3` or `Default` and defaults to `Compact_mesh_cell_base_3`. +\warning To improve the robustness of the meshing process, the input traits `Gt` + is wrapped with the traits class `Robust_weighted_circumcenter_filtered_traits_3`. + The class `Robust_weighted_circumcenter_filtered_traits_3` upgrades the functors + models of `Kernel::ConstructWeightedCircumcenter_3`, `Kernel::ComputeSquaredRadius_3`, + and `Kernel::ComputeSquaredRadiusSmallestOrthogonalSphere_3` that are + provided by `Gt` to use exact computations when the geometric configuration + is close to degenerate (e.g. almost coplanar points).
    + Users should therefore be aware that the traits class of the triangulation + will have type `Robust_weighted_circumcenter_filtered_traits_3`. + \sa `make_mesh_3()` \sa `Mesh_complex_3_in_triangulation_3` diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index e43b68d2e48..e36fa133546 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -947,7 +947,7 @@ insert_balls(const Vertex_handle& vp, const FT sp = get_radius(vp); const FT sq = get_radius(vq); - + // Compute geodesic distance const FT pq_geo_signed = domain_.geodesic_distance(p, q, curve_index); const CGAL::Sign d_sign = CGAL::sign(pq_geo_signed); diff --git a/Mesh_3/include/CGAL/Mesh_triangulation_3.h b/Mesh_3/include/CGAL/Mesh_triangulation_3.h index 681ac809d24..5040958f903 100644 --- a/Mesh_3/include/CGAL/Mesh_triangulation_3.h +++ b/Mesh_3/include/CGAL/Mesh_triangulation_3.h @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include @@ -44,9 +44,8 @@ namespace CGAL { struct Mesh_geom_traits_generator { private: - typedef Robust_weighted_circumcenter_filtered_traits_3 - Geom_traits; - + typedef Robust_weighted_circumcenter_filtered_traits_3 Geom_traits; + public: typedef Geom_traits type; typedef type Type; diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index acff5775f3c..ed0ad008a7f 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -50,7 +50,6 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_meshing_polyhedron_with_features.cpp" ) create_single_source_cgal_program( "test_meshing_unit_tetrahedron.cpp" ) create_single_source_cgal_program( "test_meshing_with_default_edge_size.cpp" ) - create_single_source_cgal_program( "test_robust_weighted_circumcenter.cpp" ) create_single_source_cgal_program( "test_meshing_determinism.cpp" ) create_single_source_cgal_program( "test_c3t3_extract_subdomains_boundaries.cpp" ) create_single_source_cgal_program( "test_mesh_3_issue_1554.cpp" ) diff --git a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h index e4c4da0c698..e8c9b937469 100644 --- a/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h +++ b/Periodic_2_triangulation_2/include/CGAL/Periodic_2_triangulation_traits_2.h @@ -102,10 +102,11 @@ public: const Iso_rectangle_2* _domain; }; -template < typename K, typename Construct_point_3_base> -class Periodic_2_construct_point_2 : public Construct_point_3_base +template < typename K, typename Construct_point_2_base> +class Periodic_2_construct_point_2 : public Construct_point_2_base { - typedef K Kernel; + typedef Construct_point_2_base Base; + typedef K Kernel; public: typedef typename Kernel::Point_2 Point; @@ -116,7 +117,7 @@ public: Periodic_2_construct_point_2(const Iso_rectangle_2 & dom) : _dom(dom) { } - using Construct_point_3_base::operator(); + using Base::operator(); Point operator() ( const Point& p, const Offset& o ) const { @@ -125,7 +126,7 @@ public: } private: - Iso_rectangle_2 _dom; + const Iso_rectangle_2& _dom; }; diff --git a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp index 66d7dc40096..ebfd09478b4 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp +++ b/Periodic_3_triangulation_3/demo/Periodic_3_triangulation_3/Scene.cpp @@ -1283,7 +1283,7 @@ inline void Scene::primitives_from_geom_it(Segment_set& sset) { case SEGMENT: for ( Segment_iterator sit = p3dt.periodic_segments_begin(it_type) ; sit != p3dt.periodic_segments_end(it_type) ; ++sit ) { - sset.insert(p3dt.segment(*sit)); + sset.insert(p3dt.construct_segment(*sit)); } break; case TRIANGLE: diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp index cd59c5dc42f..11b7c128f0a 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Viewer.cpp @@ -196,7 +196,7 @@ void Viewer::compute_elements() P3DT3::UNIQUE); ++ptit) { for (int i=0 ; i<4 ; i++) { - Segment_3 dual = scene->periodic_triangulation.segment( + Segment_3 dual = scene->periodic_triangulation.construct_segment( scene->periodic_triangulation.dual(*(ptit.get_facet()))); FT sz = dual.source().z(); diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_3.h index c5cf577ee1e..f299cc4d158 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_3.h @@ -4,62 +4,55 @@ namespace CGAL { /*! \ingroup PkgPeriodic3Triangulation3MainClasses -The class `Periodic_3_Delaunay_triangulation_3` represents a -Delaunay triangulation in three-dimensional periodic space. +The class `Periodic_3_Delaunay_triangulation_3` represents a +Delaunay triangulation in three-dimensional periodic space. -\cgalHeading{Template Parameters} +\tparam PT must be a model of the concept `Periodic_3DelaunayTriangulationTraits_3`. -The first template argument `PT` must be a model of the -`Periodic_3DelaunayTriangulationTraits_3` concept. - -The second template argument `TDS` must be a model of the -`TriangulationDataStructure_3` concept with some additional -functionality in cells and vertices. -Its default value is -`Triangulation_data_structure_3>,Triangulation_cell_base_3>>`. +\tparam TDS must be a model of the concept `TriangulationDataStructure_3`. Its default value +is `Triangulation_data_structure_3>,Triangulation_cell_base_3>>`. */ template< typename PT, typename TDS > -class Periodic_3_Delaunay_triangulation_3 : - public Periodic_3_triangulation_3 - { +class Periodic_3_Delaunay_triangulation_3 : + public Periodic_3_triangulation_3 +{ public: -/// \name Creation +/// \name Creation /// @{ /*! -Creates an empty periodic Delaunay triangulation `dt`, with -`domain` as original domain and possibly specifying -a traits class `traits`. -\pre `domain` is a cube. -*/ -Periodic_3_Delaunay_triangulation_3( -const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), -const Geom_traits & traits = Geom_traits()); +Creates an empty periodic Delaunay triangulation `dt`, with +`domain` as original domain and possibly specifying +a traits class `traits`. +\pre `domain` is a cube. +*/ +Periodic_3_Delaunay_triangulation_3( +const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), +const Geom_traits & traits = Geom_traits()); /*! -Copy constructor. -*/ -Periodic_3_Delaunay_triangulation_3 (const -Periodic_3_Delaunay_triangulation_3 & dt1); +Copy constructor. +*/ +Periodic_3_Delaunay_triangulation_3 (const +Periodic_3_Delaunay_triangulation_3 & dt1); /*! -Equivalent to constructing an empty triangulation with the optional -domain and traits class arguments and calling `insert(first,last)`. -\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain` and `domain` is a cube. -*/ -template < class InputIterator > -Periodic_3_Delaunay_triangulation_3 ( -InputIterator first, -InputIterator last, -const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), -const Geom_traits & traits = Geom_traits()); +Equivalent to constructing an empty triangulation with the optional +domain and traits class arguments and calling `insert(first,last)`. +\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain` and `domain` is a cube. +*/ +template < class InputIterator > +Periodic_3_Delaunay_triangulation_3 ( +InputIterator first, +InputIterator last, +const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), +const Geom_traits & traits = Geom_traits()); -/// @} +/// @} -/*! \name Insertion +/*! \name Insertion The following methods insert points in the triangulation ensuring the empty sphere property of Delaunay triangulations. The inserted points @@ -78,189 +71,189 @@ and `Cell_handle`s. /// @{ /*! -Inserts point `p` in the triangulation and returns the corresponding -vertex. The optional argument `start` is used as a starting place -for the point location. -\pre `p` lies in the original domain `domain`. -*/ -Vertex_handle insert(const Point & p, -Cell_handle start = Cell_handle() ); +Inserts point `p` in the triangulation and returns the corresponding +vertex. The optional argument `start` is used as a starting place +for the point location. +\pre `p` lies in the original domain `domain`. +*/ +Vertex_handle insert(const Point & p, +Cell_handle start = Cell_handle() ); /*! -Inserts point `p` in the triangulation and returns the corresponding -vertex. Similar to the above `insert()` function, but takes as additional -parameter the return values of a previous location query. See description of -`Periodic_3_triangulation_3::locate()`. -\pre `p` lies in the original domain `domain`. -*/ -Vertex_handle insert(const Point & p, Locate_type lt, -Cell_handle loc, int li, int lj); - +Inserts point `p` in the triangulation and returns the corresponding +vertex. Similar to the above `insert()` function, but takes as additional +parameter the return values of a previous location query. See description of +`Periodic_3_triangulation_3::locate()`. +\pre `p` lies in the original domain `domain`. +*/ +Vertex_handle insert(const Point & p, Locate_type lt, +Cell_handle loc, int li, int lj); /// @} /*! \name -The following method allows one to insert several points. It returns the number of inserted points. +The following method allows the insertion of several points and returns +the number of inserted points. */ /// @{ - /*! -Inserts the points in the iterator range \f$ \left[\right.\f$`first`, -`last`\f$ \left.\right)\f$. Returns the number of inserted points. -This function uses spatial sorting (cf. chapter \ref secspatial_sorting) -and therefore is not guaranteed to insert the points following the -order of `InputIterator`. If the third argument -`is_large_point_set` is set to `true` a heuristic for -optimizing the insertion of large point sets is applied. -\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain`. -*/ -template < class InputIterator > -std::ptrdiff_t -insert(InputIterator first, InputIterator last, -bool is_large_point_set = false); +Inserts the points in the iterator range \f$ \left[\right.\f$`first`, +`last`\f$ \left.\right)\f$. Returns the number of inserted points. +This function uses spatial sorting (cf. chapter \ref secspatial_sorting) +and therefore is not guaranteed to insert the points following the +order of `InputIterator`. If the third argument +`is_large_point_set` is set to `true` a heuristic for +optimizing the insertion of large point sets is applied. +\pre The `value_type` of `first` and `last` are `Point`s lying inside `domain`. +*/ +template < class InputIterator > +std::ptrdiff_t +insert(InputIterator first, InputIterator last, +bool is_large_point_set = false); -/// @} +/// @} -/// \name Point moving +/// \name Point moving /// @{ /*! -Moves the point stored in `v` to `p`, while preserving the Delaunay -property. This performs an action semantically equivalent to `remove(v)` -followed by `insert(p)`, but is supposedly faster when the point has -not moved much. Returns the handle to the new vertex. -\pre `p` lies in the original domain `domain`. -*/ -Vertex_handle move_point(Vertex_handle v, const Point & p); +Moves the point stored in `v` to `p`, while preserving the Delaunay +property. This performs an action semantically equivalent to `remove(v)` +followed by `insert(p)`, but is supposedly faster when the point has +not moved much. Returns the handle to the new vertex. +\pre `p` lies in the original domain `domain`. +*/ +Vertex_handle move_point(Vertex_handle v, const Point & p); -/// @} +/// @} -/*! \name Removal +/*! \name Removal + +The following methods remove points in the triangulation. When a vertex `v` is removed from a triangulation, all the cells incident to `v` must be removed, and the polyhedral region consisting of all the tetrahedra that are incident to `v` must be -re-triangulated. So, the problem reduces to triangulating a polyhedral +re-triangulated. The problem thus reduces to triangulating a polyhedral region, while preserving its boundary, or to compute a constrained triangulation. This is known to be sometimes impossible: the Schönhardt polyhedron cannot be triangulated \cgalCite{cgal:s-cgehd-98}. - However, when dealing with Delaunay triangulations, the case of such polyhedra that cannot be re-triangulated cannot happen, so \cgal -proposes a vertex removal. +proposes a vertex removal. */ /// @{ /*! -Removes the vertex `v` from the triangulation. When computing in -the 27-sheeted covering space it removes all 27 copies of `v`. -*/ -void remove(Vertex_handle v); +Removes the vertex `v` from the triangulation. When computing in +the 27-sheeted covering space it removes all 27 copies of `v`. +*/ +void remove(Vertex_handle v); /*! -Removes the vertices specified by the iterator range (`first, beyond`) of value type `Vertex_handle`. -`remove()` is called for each element of the range. -The number of vertices removed is returned; this number does not -account for periodic copies of removed vertices. -\pre The iterator must not iterate over several periodic copies of the same vertex, use e.g. the `Unique_vertex_iterator`. +Removes the vertices specified by the iterator range (`first, beyond`) of value type `Vertex_handle`. +`remove()` is called for each element of the range. +The number of vertices removed is returned; this number does not +account for periodic copies of removed vertices. +\pre The iterator must not iterate over several periodic copies of the same vertex, use e.g. the `Unique_vertex_iterator`. -*/ -template < class InputIterator > -std::ptrdiff_t remove(InputIterator first, InputIterator beyond); +*/ +template < class InputIterator > +std::ptrdiff_t remove(InputIterator first, InputIterator beyond); -/// @} +/// @} -/// \name Queries +/// \name Queries /// @{ /*! -Returns a value indicating on which side of the circumscribed sphere -of `c` the point-offset pair (`p`,`off`) lies. More -precisely, it returns: +Returns a value indicating on which side of the circumscribed sphere +of `c` the point-offset pair (`p`,`off`) lies. More +precisely, it returns: -- `ON_BOUNDED_SIDE` if (`p`,`off`) is inside the sphere. +- `ON_BOUNDED_SIDE` if (`p`,`off`) is inside the sphere. -- `ON_BOUNDARY` if (`p`,`off`) on the boundary of the sphere. +- `ON_BOUNDARY` if (`p`,`off`) on the boundary of the sphere. -- `ON_UNBOUNDED_SIDE` if (`p`,`off`) lies outside the -sphere. -\pre `p` lies in the original domain `domain`. -*/ -Bounded_side -side_of_sphere(Cell_handle c, const Point & p, -const Offset & off = Offset(0,0,0)) const; +- `ON_UNBOUNDED_SIDE` if (`p`,`off`) lies outside the +sphere. +\pre `p` lies in the original domain `domain`. +*/ +Bounded_side +side_of_sphere(Cell_handle c, const Point & p, +const Offset & off = Offset(0,0,0)) const; /*! -Returns any nearest vertex to the point `p`, or the default constructed -handle if the triangulation is empty. The optional argument `c` is a hint -specifying where to start the search. It always returns a vertex -corresponding to a point inside `domain` even if computing in a -multiply sheeted covering space. -\pre `c` is a cell of `dt` and `p` lies in the original domain `domain`. +Returns any nearest vertex to the point `p`, or the default constructed +handle if the triangulation is empty. The optional argument `c` is a hint +specifying where to start the search. It always returns a vertex +corresponding to a point inside `domain` even if computing in a +multiply sheeted covering space. +\pre `c` is a cell of `dt` and `p` lies in the original domain `domain`. -*/ -Vertex_handle nearest_vertex(Point p, -Cell_handle c = Cell_handle()); +*/ +Vertex_handle nearest_vertex(Point p, +Cell_handle c = Cell_handle()); /*! -Returns the vertex of the cell `c` that is nearest to the -point-offset pair (`p`,`off`). -\pre `p` lies in the original domain `domain`. -*/ -Vertex_handle nearest_vertex_in_cell(Cell_handle c, -Point p, Offset off = Offset(0,0,0)) const; +Returns the vertex of the cell `c` that is nearest to the +point-offset pair (`p`,`off`). +\pre `p` lies in the original domain `domain`. +*/ +Vertex_handle nearest_vertex_in_cell(Cell_handle c, +Point p, Offset off = Offset(0,0,0)) const; /// @} /*! \name -A point-offset pair (`p`,`off`) is said to be in conflict with a cell `c` iff `dt.side_of_sphere(c, p, off)` returns `ON_BOUNDED_SIDE`. The set of cells that are in conflict with (`p`,`off`) is star-shaped. +A point-offset pair (`p`,`off`) is said to be in conflict with a cell `c` iff `dt.side_of_sphere(c, p, off)` returns `ON_BOUNDED_SIDE`. The set of cells that are in conflict with (`p`,`off`) is star-shaped. */ /// @{ /*! -Computes the conflict hole induced by `p`. The starting cell -`c` must be in conflict. Then this function returns -respectively in the output iterators: +Computes the conflict hole induced by `p`. The starting cell +`c` must be in conflict. Then this function returns +respectively in the output iterators: -- `cit`: the cells in conflict. +- `cit`: the cells in conflict. -- `bfit`: the facets on the boundary, that is, the facets -`(t, i)` where the cell `t` is in -conflict, but `t->neighbor(i)` is not. +- `bfit`: the facets on the boundary, that is, the facets +`(t, i)` where the cell `t` is in +conflict, but `t->neighbor(i)` is not. -- `ifit`: the facets inside the hole, that is, delimiting two -cells in conflict. +- `ifit`: the facets inside the hole, that is, delimiting two +cells in conflict. -Returns the pair composed of the resulting output iterators. -\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`. -*/ -template -Triple -find_conflicts(Point p, Cell_handle c, -OutputIteratorBoundaryFacets bfit, -OutputIteratorCells cit, -OutputIteratorInternalFacets ifit); +Returns the pair composed of the resulting output iterators. +\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`. +*/ +template +Triple +find_conflicts(Point p, Cell_handle c, +OutputIteratorBoundaryFacets bfit, +OutputIteratorCells cit, +OutputIteratorInternalFacets ifit); /*! -Similar to `find_conflicts()`, but reports the vertices which are on the -boundary of the conflict hole of `p`, in the output iterator `res`. -Returns the resulting output iterator. -\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`. -*/ -template -OutputIterator -vertices_in_conflict(Point p, Cell_handle c, -OutputIterator res); +Similar to `find_conflicts()`, but reports the vertices which are on the +boundary of the conflict hole of `p`, in the output iterator `res`. +Returns the resulting output iterator. +\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`. +*/ +template +OutputIterator +vertices_in_conflict(Point p, Cell_handle c, +OutputIterator res); /// @} @@ -279,27 +272,27 @@ the Gabriel property of Delaunay faces. /*! -*/ -bool is_Gabriel(Cell_handle c, int i); +*/ +bool is_Gabriel(Cell_handle c, int i); /*! -*/ -bool is_Gabriel(Cell_handle c, int i, int j); +*/ +bool is_Gabriel(Cell_handle c, int i, int j); /*! -*/ -bool is_Gabriel(const Facet& f); +*/ +bool is_Gabriel(const Facet& f); /*! -*/ -bool is_Gabriel(const Edge& e); +*/ +bool is_Gabriel(const Edge& e); -/// @} +/// @} -/// \name Voronoi diagram +/// \name Voronoi diagram /// \cgal offers several functions to display the Voronoi diagram of a /// set of points in 3D. Note that a traits class providing exact /// constructions should be used in order to guarantee the computation @@ -308,94 +301,94 @@ bool is_Gabriel(const Edge& e); /// @{ /*! -Returns the representative of the circumcenter of the four vertices -of c that lies in the original domain `domain`. -*/ -Point dual(Cell_handle c) const; +Returns the representative of the circumcenter of the four vertices +of c that lies in the original domain `domain`. +*/ +Point dual(Cell_handle c) const; /*! -Returns the dual of facet `f`, which is a periodic segment. -*/ -Periodic_segment dual(Facet f) const; +Returns the dual of facet `f`, which is a periodic segment. +*/ +Periodic_segment dual(Facet f) const; /*! -same as the previous method for facet `(c,i)`. -\pre \f$ i\in\{0,1,2,3\}\f$ -*/ -Periodic_segment dual(Cell_handle c, int i) const; +same as the previous method for facet `(c,i)`. +\pre \f$ i\in\{0,1,2,3\}\f$ +*/ +Periodic_segment dual(Cell_handle c, int i) const; /*! -Returns in the output iterator the points of the dual polygon of -edge `e` in the same order as the `Facet_circulator` returns -facets incident to the edge `e`. The points form the dual polygon -in \f$ \mathbb R^3\f$, so they do not necessarily all lie inside the -original domain. -*/ -template -OutputIterator -dual(Edge e, OutputIterator pts) const; +Returns in the output iterator the points of the dual polygon of +edge `e` in the same order as the `Facet_circulator` returns +facets incident to the edge `e`. The points form the dual polygon +in \f$ \mathbb R^3\f$, so they do not necessarily all lie inside the +original domain. +*/ +template +OutputIterator +dual(Edge e, OutputIterator pts) const; /*! -same as the previous method for edge `(c,i,j)`. -\pre \f$ i,j\in\{0,1,2,3\}, i\neq j\f$ -*/ -template -OutputIterator -dual(Cell_handle c, int i, int j, OutputIterator pts) const; +same as the previous method for edge `(c,i,j)`. +\pre \f$ i,j\in\{0,1,2,3\}, i\neq j\f$ +*/ +template +OutputIterator +dual(Cell_handle c, int i, int j, OutputIterator pts) const; /*! -Returns in the output iterator the points of the dual polyhedron of -vertex `v` in no particular order. The points form the dual -polyhedron in \f$ \mathbb R^3\f$, so they do not necessarily lie all -inside the original domain. -*/ -template -OutputIterator -dual(Vertex_handle v, OutputIterator pts) const; +Returns in the output iterator the points of the dual polyhedron of +vertex `v` in no particular order. The points form the dual +polyhedron in \f$ \mathbb R^3\f$, so they do not necessarily lie all +inside the original domain. +*/ +template +OutputIterator +dual(Vertex_handle v, OutputIterator pts) const; /*! -Sends the set of duals to all the facets of `dt` into `os`. -*/ -template Stream & draw_dual(Stream & os); +Sends the set of duals to all the facets of `dt` into `os`. +*/ +template Stream & draw_dual(Stream & os); /*! -Returns the volume of the Voronoi cell dual to `v`. -*/ -Geom_traits::FT dual_volume(Vertex_handle v) const; +Returns the volume of the Voronoi cell dual to `v`. +*/ +Geom_traits::FT dual_volume(Vertex_handle v) const; /*! -Returns the centroid of the Voronoi cell dual to `v`. -*/ -Point dual_centroid(Vertex_handle v) const; +Returns the centroid of the Voronoi cell dual to `v`. +*/ +Point dual_centroid(Vertex_handle v) const; -/// @} +/// @} -/// \name Checking +/// \name Checking /// These methods are mainly a debugging help for the users of advanced features. /// @{ /*! -Checks the combinatorial validity of the triangulation and the -validity of its geometric embedding (see -Section \ref P3Triangulation3secintro). Also checks that all the -circumscribing spheres of cells are empty. +Checks the combinatorial validity of the triangulation and the +validity of its geometric embedding (see +Section \ref P3Triangulation3secintro). Also checks that all the +circumscribing spheres of cells are empty. -When `verbose` is set to true, messages describing the first -invalidity encountered are printed. -*/ -bool -is_valid(bool verbose = false) const; +When `verbose` is set to true, messages describing the first +invalidity encountered are printed. +*/ +bool +is_valid(bool verbose = false) const; /*! -Checks the combinatorial and geometric validity of the cell (see -Section \ref P3Triangulation3secintro). Also checks that the -circumscribing sphere of cells is empty. +Checks the combinatorial and geometric validity of the cell (see +Section \ref P3Triangulation3secintro). Also checks that the +circumscribing sphere of cells is empty. -When `verbose` is set to true, messages are printed to give -a precise indication of the kind of invalidity encountered. -*/ -bool -is_valid(Cell_handle c, bool verbose = false) const; +When `verbose` is set to true, messages are printed to give +a precise indication of the kind of invalidity encountered. +*/ +bool +is_valid(Cell_handle c, bool verbose = false) const; /// @} diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h index 8219d09cc88..9ce89508170 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h @@ -8,18 +8,19 @@ The class `Periodic_3_Delaunay_triangulation_traits_3` is designed as a default class `Periodic_3_Delaunay_triangulation_3`. \tparam Traits must be a model of the `DelaunayTriangulationTraits_3` concept. -\tparam Periodic_3Offset_3 must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`. +\tparam Offset must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`. If `Traits` is a `CGAL::Filtered_kernel` (detected when `Traits::Has_filtered_predicates` exists -and is `true`), this class automatically provides filtered predicates. Similarly statically filtered predicates +and is `true`), this class automatically provides filtered predicates. Similarly, statically filtered predicates will be used if the flag `Traits::Has_static_filters` exists and is `true`. By default, this holds for `CGAL::Exact_predicates_inexact_constructions_kernel` and `CGAL::Exact_predicates_exact_constructions_kernel`. \cgalModels Periodic_3DelaunayTriangulationTraits_3 */ -template< typename Traits, typename Periodic_3Offset_3 > -class Periodic_3_Delaunay_triangulation_traits_3 : public Traits { +template< typename Traits, typename Offset > +class Periodic_3_Delaunay_triangulation_traits_3 + : public Periodic_3_triangulation_traits_base_3 < Traits, Offset> { public: }; /* end Periodic_3_Delaunay_triangulation_traits_3 */ } /* end namespace CGAL */ diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_regular_triangulation_3.h new file mode 100644 index 00000000000..08f608d4acc --- /dev/null +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_regular_triangulation_3.h @@ -0,0 +1,429 @@ + +namespace CGAL { + +/*! +\ingroup PkgPeriodic3Triangulation3MainClasses + +The class `Periodic_3_regular_triangulation_3` represents a +weighted Delaunay triangulation in three-dimensional periodic space. + +\tparam PT must be a model of the concept `Periodic_3RegularTriangulationTraits_3`. + +\tparam TDS must be a model of the concept `TriangulationDataStructure_3`. +Its default value is +`Triangulation_data_structure_3 >, + Regular_triangulation_cell_base_3>>`. + +*/ +template< typename PT, typename TDS > +class Periodic_3_regular_triangulation_3 : + public Periodic_3_triangulation_3 +{ +public: + +/// \name Types +/// @{ + +/*! +*/ +typedef Periodic_3RegularTriangulationTraits_3::Point_3 Bare_point; + +/*! +The type for points +`p` of weighted points \f$ {p}^{(w)}=(p,w_p)\f$ +*/ +typedef Periodic_3RegularTriangulationTraits_3::Weighted_point_3 Weighted_point; + +/// @} + +/// \name Creation +/// @{ + +/*! +Creates an empty periodic regular triangulation `rt`, with +`domain` as original domain and possibly specifying +a traits class `traits`. +\pre `domain` is a cube. +*/ +Periodic_3_regular_triangulation_3( +const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), +const Geom_traits & traits = Geom_traits()); + +/*! +Copy constructor. +*/ +Periodic_3_regular_triangulation_3 (const +Periodic_3_regular_triangulation_3 & rt1); + +/*! +Equivalent to constructing an empty triangulation with the optional +domain and traits class arguments and calling `insert(first,last)`. +\pre The `value_type` of `first` and `last` are `Weighted_point`s lying inside `domain` and `domain` is a cube. +Their weights are non-negative and smaller than 1/64 times the squared cube edge length. +If the fourth argument +`is_large_point_set` is set to `true` a heuristic for +optimizing the insertion of large point sets is applied. +*/ +template < class InputIterator > +Periodic_3_regular_triangulation_3 ( +InputIterator first, +InputIterator last, +const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), +const Geom_traits & traits = Geom_traits(), +bool is_large_point_set = false); + +/// @} + +/// \name Access Functions +/// @{ + +/*! +Returns the number of hidden points. +*/ +size_type number_of_hidden_points() const; + +/// @} + +/*! \name Insertion + +The following methods insert points in the triangulation ensuring the +property that all power spheres are regular. The inserted weighted points need +to lie in the original domain (see Section \ref +P3Triangulation3secspace of the user manual). Note that insertion of a +new point can cause a switch from computing in the 27-sheeted covering +space to computing in the 1-sheeted covering space, which invalidates +some `Vertex_handle`s and `Cell_handle`s. + +*/ + +/// @{ + +/*! +Inserts point `p` in the triangulation and returns the corresponding +vertex. The optional argument `start` is used as a starting place +for the point location. + +If this insertion creates a vertex, this vertex is returned. + +If `p` coincides with an existing vertex and has a greater weight, +then the existing weighted point becomes hidden (see +`Periodic_3RegularTriangulationCellBase_3`) and `p` replaces it as vertex +of the triangulation. + +If `p` coincides with an already existing vertex (both point and +weights being equal), then this vertex is returned and the triangulation +remains unchanged. + +Otherwise if `p` does not appear as a vertex of the triangulation, +then it is stored as a hidden point and this method returns the default +constructed handle. + +\pre `p` lies in the original domain `domain`. Its weight is non-negative and smaller than 1/64 times the squared cube edge length. +*/ +Vertex_handle insert(const Weighted_point & p, +Cell_handle start = Cell_handle() ); + +/*! +Inserts point `p` in the triangulation and returns the corresponding +vertex. Similar to the above `insert()` function, but takes as additional +parameter the return values of a previous location query. See description of +`Periodic_3_triangulation_3::locate()`. +\pre `p` lies in the original domain `domain`. Its weight is non-negative and smaller than 1/64 times the squared cube edge length. +*/ +Vertex_handle insert(const Weighted_point & p, Locate_type lt, +Cell_handle loc, int li, int lj); + + +/// @} + +/*! \name +The following method allows one to insert several points. +*/ +/// @{ + + +/*! +Inserts the points in the iterator range \f$ \left[\right.\f$`first`, +`last`\f$ \left.\right)\f$. Returns the number of inserted points. +This function uses spatial sorting (cf. chapter \ref secspatial_sorting) +and therefore is not guaranteed to insert the points following the +order of `InputIterator`. If the third argument +`is_large_point_set` is set to `true` a heuristic for +optimizing the insertion of large point sets is applied. +\pre The `value_type` of `first` and `last` are `Weighted_point`s +lying inside `domain`. +Their weights are non-negative and smaller than 1/64 times the +squared cube edge length. +*/ +template < class InputIterator > +std::ptrdiff_t +insert(InputIterator first, InputIterator last, +bool is_large_point_set = false); + +/// @} + +/*! \name Removal + +*/ +/// @{ + +/*! +Removes the vertex `v` from the triangulation. When computing in +the 27-sheeted covering space it removes all 27 copies of `v`. +*/ +void remove(Vertex_handle v); + +/*! +Removes the vertices specified by the iterator range (`first, beyond`) of +value type `Vertex_handle`. +`remove()` is called for each element of the range. +The number of vertices removed is returned; this number does not +account for periodic copies of removed vertices. +\pre The iterator must not iterate over several periodic copies of the +same vertex, use e.g. the `Unique_vertex_iterator`. + +*/ +template < class InputIterator > +std::ptrdiff_t remove(InputIterator first, InputIterator beyond); + +/// @} + +/// \name Queries + +/// @{ + +/*! +Returns a value indicating the position of the (weighted point, offset) pair (`p`,`off`) +with respect to the power sphere of `c`. More +precisely, it returns: + +- `ON_BOUNDED_SIDE` if the angle between the weighted point (`p`,`off`) +and the power sphere of `c` is larger than \f$ \pi/2\f$ or if the ball of +(`p`,`off`) is included in the power sphere of `c`. + +- `ON_BOUNDARY` if the ball (`p`,`off`) is orthogonal to the power sphere of `c`. + +- `ON_UNBOUNDED_SIDE` if the angle between the weighted point (`p`,`off`) +and the power sphere of `c` is less than \f$ \pi/2\f$ or if the two balls +do not intersect. + +*/ +Bounded_side +side_of_power_sphere(Cell_handle c, const Weighted_point & p, +const Offset & off = Offset(0,0,0)) const; + +/*! +Returns the vertex of the triangulation which is nearest to \f$ p\f$ +with respect to the power distance. This means that the power +of the query point `p` with respect to the weighted point in +the returned vertex is smaller than the power of `p` +with respect to the weighted point +in any other vertex. Ties are broken arbitrarily. +It always returns a vertex +corresponding to a point inside `domain` even if computing in a +multiply sheeted covering space. +The default constructed +handle is returned if the triangulation is empty. +The optional argument `c` is a hint +specifying where to start the search. +\pre `c` is a cell of `rt` and `p` lies in the original domain `domain`. + +*/ +Vertex_handle nearest_power_vertex(const Bare_point & p, +Cell_handle c = Cell_handle()) const; + +/// @} + +/*! \name +A point-offset pair (`p`,`off`) is said to be in conflict with a cell `c` iff +`rt.side_of_power_sphere(c, p, off)` returns `ON_BOUNDED_SIDE`. +The set of cells that are in conflict with (`p`,`off`) is star-shaped. +*/ +/// @{ + + + +/*! +Computes the conflict hole induced by `p`. The starting cell +`c` must be in conflict. Then this function returns +respectively in the output iterators: + +- `cit`: the cells in conflict. + +- `bfit`: the facets on the boundary, that is, the facets +`(t, i)` where the cell `t` is in +conflict, but `t->neighbor(i)` is not. + +- `ifit`: the facets inside the hole, that is, delimiting two +cells in conflict. + +Returns the `Triple` composed of the resulting output iterators. +\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`. +Its weight is non-negative and smaller than 1/64 times the squared cube edge length. +*/ +template +Triple +find_conflicts(const Weighted_point & p, Cell_handle c, +OutputIteratorBoundaryFacets bfit, +OutputIteratorCells cit, +OutputIteratorInternalFacets ifit) const; + +/*! +Similar to `find_conflicts()`, but reports the vertices that are on the +boundary of the conflict hole of `p`, in the output iterator `res`. +Returns the resulting output iterator. +\pre `c` is in conflict with `p` and `p` lies in the original domain `domain`. +Its weight is non-negative and smaller than 1/64 times the squared cube edge length. +*/ +template +OutputIterator +vertices_in_conflict(const Weighted_point & p, Cell_handle c, +OutputIterator res) const; + + +/// @} + +/* \name +In the weighted setting, a face (cell, facet, edge or vertex) is said to be a +Gabriel face iff the smallest sphere orthogonal to the weighted points +associated to its vertices, has a positive power product with the weighted +point of any other vertex of the triangulation. Any weighted Gabriel +face belongs to the regular triangulation, but the reciprocal is not true. +The following member functions test the Gabriel property of the faces of the regular triangulation. +*/ +/// @{ + +/* + +*/ +// bool is_Gabriel(Cell_handle c, int i) const; + +/* + +*/ +// bool is_Gabriel(Cell_handle c, int i, int j) const; + +/* + +*/ +// bool is_Gabriel(const Facet& f) const; + +/* + +*/ +// bool is_Gabriel(const Edge& e) const; + +/* + +*/ +// bool is_Gabriel(Vertex_handle v) const; + +/// @} + + +/// \name Power diagram +/// \cgal offers several functions to display the Voronoi diagram of a +/// set of points in 3D. Note that a traits class providing exact +/// constructions should be used in order to guarantee the computation +/// of the Voronoi diagram (as opposed to computing the triangulation +/// only, which requires only exact predicates). +/// @{ + +/*! +Returns the representative of the weighted circumcenter of the four vertices +of c that lies in the original domain `domain`. +*/ +Bare_point dual(Cell_handle c) const; + +/*! +Returns the dual of facet `f`, which is a periodic segment. +*/ +Periodic_segment_3 dual(Facet f) const; + +/*! +same as the previous method for facet `(c,i)`. +\pre \f$ i\in\{0,1,2,3\}\f$ +*/ +Periodic_segment_3 dual(Cell_handle c, int i) const; + +/*! +Returns in the output iterator the points of the dual polygon of +edge `e` in the same order as the `Facet_circulator` returns +facets incident to the edge `e`. The points form the dual polygon +in \f$ \mathbb R^3\f$, so they do not necessarily all lie inside the +original domain. +*/ +template +OutputIterator +dual(Edge e, OutputIterator pts) const; + +/*! +same as the previous method for edge `(c,i,j)`. +\pre \f$ i,j\in\{0,1,2,3\}, i\neq j\f$ +*/ +template +OutputIterator +dual(Cell_handle c, int i, int j, OutputIterator pts) const; + +/*! +Returns in the output iterator the points of the dual polyhedron of +vertex `v` in no particular order. The points form the dual +polyhedron in \f$ \mathbb R^3\f$, so they do not necessarily lie all +inside the original domain. +*/ +template +OutputIterator +dual(Vertex_handle v, OutputIterator pts) const; + +/*! +Sends the set of duals to all the facets of `rt` into `os`. +*/ +template Stream & draw_dual(Stream & os); + +/*! +Returns the volume of the cell of the power diagram dual to `v`. +*/ +Geom_traits::FT dual_volume(Vertex_handle v) const; + +/*! +Returns the centroid of the cell of the power diagram dual to `v`. +*/ +Bare_point dual_centroid(Vertex_handle v) const; + +/// @} + +/// \name Checking +/// These methods are mainly a debugging help for the users of advanced features. +/// @{ + +/*! +Checks the combinatorial validity of the triangulation and the +validity of its geometric embedding (see +Section \ref P3Triangulation3secintro). Also checks that the power +spheres of all cells are regular. + +When `verbose` is set to true, messages describing the first +invalidity encountered are printed. +*/ +bool +is_valid(bool verbose = false) const; + +/*! +Checks the combinatorial and geometric validity of the cell (see +Section \ref P3Triangulation3secintro). Also checks that its power +sphere is regular. + +When `verbose` is set to true, messages are printed to give +a precise indication of the kind of invalidity encountered. +*/ +bool +is_valid(Cell_handle c, bool verbose = false) const; + +/// @} + +}; /* end Periodic_3_regular_triangulation_3 */ +} /* end namespace CGAL */ diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_regular_triangulation_traits_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_regular_triangulation_traits_3.h new file mode 100644 index 00000000000..e6ba3731ff8 --- /dev/null +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_regular_triangulation_traits_3.h @@ -0,0 +1,25 @@ + +namespace CGAL { + +/*! +\ingroup PkgPeriodic3Triangulation3TraitsClasses + +The class `Periodic_3_regular_triangulation_traits_3` is designed as a default traits class for the +class `Periodic_3_regular_triangulation_3`. + +\tparam Traits must be a model of the `RegularTriangulationTraits_3` concept. +\tparam Offset must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`. + +If `Traits` is a `CGAL::Filtered_kernel` (detected when `Traits::Has_filtered_predicates` exists +and is `true`), this class automatically provides filtered predicates. +By default, this holds for `CGAL::Exact_predicates_inexact_constructions_kernel` and +`CGAL::Exact_predicates_exact_constructions_kernel`. + +\cgalModels Periodic_3RegularTriangulationTraits_3 +*/ +template< typename Traits, typename Offset > +class Periodic_3_regular_triangulation_traits_3 : + public Periodic_3_triangulation_traits_base_3< Traits, Offset > { +public: +}; /* end Periodic_3_regular_triangulation_traits_3 */ +} /* end namespace CGAL */ diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h index c15ed5de14c..0f7e8c856c3 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_3.h @@ -4,127 +4,154 @@ namespace CGAL { /*! \ingroup PkgPeriodic3Triangulation3MainClasses -The class `Periodic_triangulation_3` represents a 3-dimensional -triangulation of a point set in \f$ \mathbb T_c^3\f$. +The class `Periodic_3_triangulation_3` represents a 3-dimensional +triangulation of a point set in \f$ \mathbb T_c^3\f$. -\tparam PT must be a model of the `Periodic_3TriangulationTraits_3` concept. +\tparam PT must be a model of the concept `Periodic_3TriangulationTraits_3`. -\tparam TDS must be a model of `TriangulationDataStructure_3` concept -with some additional functionality in cells and vertices. -Its default value is -`Triangulation_data_structure_3>,Triangulation_cell_base_3>>`. +\tparam TDS must be a model of the concept `TriangulationDataStructure_3` +with some additional functionality in cells and vertices. +Its default value is +`Triangulation_data_structure_3>,Triangulation_cell_base_3>>`. - -\sa `Periodic_3_Delaunay_triangulation_3` +\sa `Periodic_3_Delaunay_triangulation_3` +\sa `Periodic_3_regular_triangulation_3` */ template< typename PT, typename TDS > class Periodic_3_triangulation_3 { public: -/// \name Types +/// \name Types /// @{ /*! -*/ -typedef PT Geometric_traits; +*/ +typedef PT Geometric_traits; /*! -*/ -typedef TDS Triangulation_data_structure; +*/ +typedef TDS Triangulation_data_structure; /*! -*/ -typedef Geometric_traits::Periodic_3_offset_3 -Offset; +*/ +typedef Geometric_traits::Periodic_3_offset_3 +Offset; /*! -A type representing an axis-aligned cuboid. It must be a model of `PT::Iso_cuboid_3`. Used to represent the original domain. -*/ -typedef Geometric_traits::Iso_cuboid_3 Iso_cuboid; +A type representing an axis-aligned cuboid. It must be a model of `PT::Iso_cuboid_3`. Used to represent the original domain. +*/ +typedef Geometric_traits::Iso_cuboid_3 Iso_cuboid; /*! -Integer triple to -store the number of sheets in each direction of space. -*/ -typedef array Covering_sheets; +Integer triple to +store the number of sheets in each direction of space. +*/ +typedef array Covering_sheets; + +/*! +The point type of the triangulation. + +\note This type is equal to `Geometric_traits::Point_3` when considering periodic +Delaunay triangulations and to `Geometric_traits::Weighted_point_3` when +considering periodic weighted Delaunay triangulations. +*/ +typedef TDS::Vertex::Point Point; + +/*! +The geometric basic 3D point type. +*/ +typedef Geometric_traits::Point_3 Point_3; /*! -*/ -typedef Geometric_traits::Point_3 Point; +*/ +typedef Geometric_traits::Segment_3 Segment; /*! -*/ -typedef Geometric_traits::Segment_3 Segment; +*/ +typedef Geometric_traits::Triangle_3 Triangle; /*! -*/ -typedef Geometric_traits::Triangle_3 Triangle; +*/ +typedef Geometric_traits::Tetrahedron_3 Tetrahedron; /*! - -*/ -typedef Geometric_traits::Tetrahedron_3 Tetrahedron; +Represents a point-offset pair. The point in the pair lies in the original domain. +Note that the inner type is `Point`. +*/ +typedef std::pair< Point, Offset > Periodic_point; /*! -Represents a point-offset pair. The point in the -pair lies in the original domain. -*/ -typedef std::pair< Point, Offset > -Periodic_point; +Represents a point-offset pair. The point in the pair lies in the original domain. +Note that the inner type is `Point_3`. +*/ +typedef std::pair< Point_3, Offset > Periodic_point_3; /*! - -*/ -typedef array< Periodic_point, 2> -Periodic_segment; +A periodic segment. Note that the inner type is `Periodic_point`. +*/ +typedef array< Periodic_point, 2> Periodic_segment; /*! - -*/ -typedef array< Periodic_point, 3> -Periodic_triangle; +A periodic segment. Note that the inner type is `Periodic_point_3`. +*/ +typedef array< Periodic_point_3, 2> Periodic_segment_3; /*! +A periodic triangle. Note that the inner type is `Periodic_point`. +*/ +typedef array< Periodic_point, 3> Periodic_triangle; -*/ -typedef array< Periodic_point, 4> -Periodic_tetrahedron; +/*! +A periodic triangle. Note that the inner type is `Periodic_point_3`. +*/ +typedef array< Periodic_point_3, 3> Periodic_triangle_3; +/*! +A periodic tetrahedron. Note that the inner type is `Periodic_point`. +*/ +typedef array< Periodic_point, 4> Periodic_tetrahedron; + +/*! +A periodic tetrahedron. Note that the inner type is `Periodic_point_3`. +*/ +typedef array< Periodic_point_3, 4> Periodic_tetrahedron_3; /// @} /*! \name -Only vertices (\f$ 0\f$-faces) and cells (\f$ 3\f$-faces) are stored. Edges (\f$ 1\f$-faces) and facets (\f$ 2\f$-faces) are not explicitly represented and thus there are no corresponding classes (see Section \ref P3Triangulation3secintro). +Only vertices (\f$ 0\f$-faces) and cells (\f$ 3\f$-faces) are stored. +Edges (\f$ 1\f$-faces) and facets (\f$ 2\f$-faces) are not explicitly represented +and thus there are no corresponding classes (see Section \ref P3Triangulation3secintro). */ /// @{ /*! -*/ -typedef Triangulation_data_structure::Vertex Vertex; +*/ +typedef Triangulation_data_structure::Vertex Vertex; /*! -*/ -typedef Triangulation_data_structure::Cell Cell; +*/ +typedef Triangulation_data_structure::Cell Cell; /*! -*/ -typedef Triangulation_data_structure::Edge Edge; +*/ +typedef Triangulation_data_structure::Edge Edge; /*! -*/ -typedef Triangulation_data_structure::Facet Facet; +*/ +typedef Triangulation_data_structure::Facet Facet; @@ -148,95 +175,97 @@ functions. /// @{ /*! -handle to a vertex -*/ -typedef Triangulation_data_structure::Vertex_handle Vertex_handle; +handle to a vertex +*/ +typedef Triangulation_data_structure::Vertex_handle Vertex_handle; /*! -handle to a cell -*/ -typedef Triangulation_data_structure::Cell_handle Cell_handle; +handle to a cell +*/ +typedef Triangulation_data_structure::Cell_handle Cell_handle; /*! -Size type (an unsigned integral type) -*/ -typedef Triangulation_data_structure::size_type size_type; +Size type (an unsigned integral type) +*/ +typedef Triangulation_data_structure::size_type size_type; /*! -Difference type (a signed integral type) -*/ -typedef Triangulation_data_structure::difference_type difference_type; +Difference type (a signed integral type) +*/ +typedef Triangulation_data_structure::difference_type difference_type; /*! -iterator over cells -*/ -typedef Triangulation_data_structure::Cell_iterator Cell_iterator; +iterator over cells +*/ +typedef Triangulation_data_structure::Cell_iterator Cell_iterator; /*! -iterator over facets -*/ -typedef Triangulation_data_structure::Facet_iterator Facet_iterator; +iterator over facets +*/ +typedef Triangulation_data_structure::Facet_iterator Facet_iterator; /*! -iterator over edges -*/ -typedef Triangulation_data_structure::Edge_iterator Edge_iterator; +iterator over edges +*/ +typedef Triangulation_data_structure::Edge_iterator Edge_iterator; /*! -iterator over vertices -*/ -typedef Triangulation_data_structure::Vertex_iterator Vertex_iterator; +iterator over vertices +*/ +typedef Triangulation_data_structure::Vertex_iterator Vertex_iterator; /*! -iterator over the vertices whose -corresponding points lie in the original domain, i.e.\ for each set -of periodic copies the `Unique_vertex_iterator` iterates over -exactly one representative. -*/ -typedef unspecified_type Unique_vertex_iterator; +iterator over the vertices whose +corresponding points lie in the original domain, i.e.\ for each set +of periodic copies the `Unique_vertex_iterator` iterates over +exactly one representative. +*/ +typedef unspecified_type Unique_vertex_iterator; /*! -circulator over all cells incident to a given edge -*/ -typedef Triangulation_data_structure::Cell_circulator Cell_circulator; +circulator over all cells incident to a given edge +*/ +typedef Triangulation_data_structure::Cell_circulator Cell_circulator; /*! -circulator over all facets incident to a given edge -*/ -typedef Triangulation_data_structure::Facet_circulator Facet_circulator; +circulator over all facets incident to a given edge +*/ +typedef Triangulation_data_structure::Facet_circulator Facet_circulator; -/// @} +/// @} -/// \name Geometric Iterators: +/// \name Geometric Iterators: +/// The following iterators have value type `Periodic_segment`, `Periodic_triangle`, +/// and `Periodic_tetrahedron`, which have inner type `Point`. /// @{ /*! -iterator over the tetrahedra -corresponding to cells of the triangulation. -*/ -typedef unspecified_type Periodic_tetrahedron_iterator; +iterator over the tetrahedra +corresponding to cells of the triangulation. +*/ +typedef unspecified_type Periodic_tetrahedron_iterator; /*! -iterator over the triangles -corresponding to facets of the triangulation. -*/ -typedef unspecified_type Periodic_triangle_iterator; +iterator over the triangles +corresponding to facets of the triangulation. +*/ +typedef unspecified_type Periodic_triangle_iterator; /*! -iterator over the segments -corresponding to edges of the triangulation. -*/ -typedef unspecified_type Periodic_segment_iterator; +iterator over the segments +corresponding to edges of the triangulation. +*/ +typedef unspecified_type Periodic_segment_iterator; /*! -iterator over the points -corresponding to vertices of the triangulation. -*/ -typedef unspecified_type Periodic_point_iterator; +iterator over the points +corresponding to vertices of the triangulation. +*/ +typedef unspecified_type Periodic_point_iterator; -/// @} +/// @} -/// \name Enums +/// \name Enums /// @{ @@ -274,467 +303,564 @@ The elements of the enum have the following meaning: non-empty. */ }; -/// @} +/// @} -/// \name Creation +/// \name Creation /// @{ /*! -Introduces an empty triangulation `t` with `domain` as -original domain. -\pre `domain` is a cube. -*/ -Periodic_3_triangulation_3 -(const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), -const Geometric_traits & traits = Geometric_traits()); +Introduces an empty triangulation `t` with `domain` as +original domain. +\pre `domain` is a cube. +*/ +Periodic_3_triangulation_3 +(const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), +const Geometric_traits & traits = Geometric_traits()); /*! -Copy constructor. All vertices and faces are duplicated. -*/ -Periodic_3_triangulation_3 (const Periodic_3_triangulation_3 & tr); +Copy constructor. All vertices and faces are duplicated. +*/ +Periodic_3_triangulation_3 (const Periodic_3_triangulation_3 & tr); -/// @} +/// @} -/// \name Assignment +/// \name Assignment /// @{ /*! -The triangulation `tr` is duplicated, and modifying the copy after the -duplication does not modify the original. The previous triangulation held -by `t` is deleted. -*/ -Periodic_3_triangulation_3 & operator=(const Periodic_3_triangulation_3 & tr); +The triangulation `tr` is duplicated, and modifying the copy after the +duplication does not modify the original. The previous triangulation held +by `t` is deleted. +*/ +Periodic_3_triangulation_3 & operator=(const Periodic_3_triangulation_3 & tr); /*! -The triangulations `tr` and `t` are swapped. -`t`.`swap(tr)` should be preferred to `t` = `tr` or to -`t(tr)` if `tr` is deleted after that. Indeed, there is no -copy of cells and vertices, thus this method runs in constant time. -*/ -void swap(Periodic_3_triangulation_3 & tr); +The triangulations `tr` and `t` are swapped. +`t`.`swap(tr)` should be preferred to `t` = `tr` or to +`t(tr)` if `tr` is deleted after that. Indeed, there is no +copy of cells and vertices, thus this method runs in constant time. +*/ +void swap(Periodic_3_triangulation_3 & tr); /*! -Deletes all vertices and all cells of `t`. -*/ -void clear(); +Deletes all vertices and all cells of `t`. +*/ +void clear(); /*! -Equality operator. Returns true iff there exist a bijection between the -vertices of `t1` and those of `t2` and a bijection between the cells of -`t1` and those of `t2`, which preserve the geometry of the -triangulation, that is, the points of each corresponding pair of vertices are -equal, and the tetrahedra corresponding to each pair of cells are equal (up to -a permutation of their vertices). -\relates Periodic_3_triangulation_3 -*/ -template < class PT, class TDS1, class TDS2 > -bool operator==(const Periodic_3_triangulation_3 & t1, const Periodic_3_triangulation_3 & t2); +Equality operator. Returns true iff there exist a bijection between the +vertices of `t1` and those of `t2` and a bijection between the cells of +`t1` and those of `t2`, which preserve the geometry of the +triangulation, that is, the points of each corresponding pair of vertices are +equal, and the tetrahedra corresponding to each pair of cells are equal (up to +a permutation of their vertices). +\relates Periodic_3_triangulation_3 +*/ +template < class PT, class TDS1, class TDS2 > +bool operator==(const Periodic_3_triangulation_3 & t1, const Periodic_3_triangulation_3 & t2); /*! -The opposite of `operator==`. -\relates Periodic_3_triangulation_3 -*/ -template < class PT, class TDS1, class TDS2 > -bool operator!=(const Periodic_3_triangulation_3 & t1, const Periodic_3_triangulation_3 & t2); +The opposite of `operator==`. +\relates Periodic_3_triangulation_3 +*/ +template < class PT, class TDS1, class TDS2 > +bool operator!=(const Periodic_3_triangulation_3 & t1, const Periodic_3_triangulation_3 & t2); -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Returns a const reference to the geometric traits object. -*/ -const Geometric_traits & geom_traits() const; +Returns a const reference to the geometric traits object. +*/ +const Geometric_traits & geom_traits() const; /*! -Returns a const reference to the triangulation data structure. -*/ -const Triangulation_data_structure & tds() const; +Returns a const reference to the triangulation data structure. +*/ +const Triangulation_data_structure & tds() const; /*! -Returns the original domain. -*/ -Iso_cuboid domain() const; +Returns the original domain. +*/ +Iso_cuboid domain() const; /*! \cgalAdvancedFunction \cgalAdvancedBegin -Returns the number of sheets of the covering space the triangulation is +Returns the number of sheets of the covering space the triangulation is currently computed in. \cgalAdvancedEnd -*/ -Covering_sheets number_of_sheets() const; +*/ +Covering_sheets number_of_sheets() const; -/// @} +/*! +Get the offset between the origins of the internal offset coordinate +systems of two neighboring cells with respect from ch to its i-th neighbor. +*/ +Offset neighbor_offset(Cell_handle ch, int i) const; -/// \name Non const access +/// @} + +/// \name Non const access /// @{ /*! \cgalAdvancedFunction \cgalAdvancedBegin -Changes the domain. Note that this function calls `clear()`, -i.e., it erases the existing triangulation. +Changes the domain. Note that this function calls `clear()`, +i.e., it erases the existing triangulation. \cgalAdvancedEnd -*/ -void set_domain(const Iso_cuboid dom); +*/ +void set_domain(const Iso_cuboid dom); /*! \cgalAdvancedFunction \cgalAdvancedBegin -Returns a reference to the triangulation data structure. +Returns a reference to the triangulation data structure. The responsibility of keeping a valid triangulation belongs to the user when using advanced operations allowing a direct manipulation of the `tds`. This method is mainly a help for users implementing their own triangulation algorithms. \cgalAdvancedEnd -*/ -Triangulation_data_structure & tds(); +*/ +Triangulation_data_structure & tds(); -/// @} +/// @} -/// \name Non-constant-time queries and conversions +/// \name Non-constant-time queries and conversions /// @{ /*! -The current triangulation remains a triangulation in the 1-sheeted -covering space even after adding points if this method returns -`true`. This test relies on a heuristic, i.e.\ if it answers -`false` nothing is known. This test runs in constant-time when -not computing in the 1-sheeted covering space. (This test uses the length -of the longest edge in the triangulation as a -criterion \cgalCite{cgal:ct-c3pt-09}.) -*/ -bool is_extensible_triangulation_in_1_sheet_h1() const; +The current triangulation remains a triangulation in the 1-sheeted +covering space even after adding points if this method returns +`true`. This test relies on a heuristic, i.e.\ if it answers +`false` nothing is known. This test runs in constant-time when +not computing in the 1-sheeted covering space. (This test uses the length +of the longest edge in the triangulation as a +criterion \cgalCite{cgal:ct-c3pt-09}.) +*/ +bool is_extensible_triangulation_in_1_sheet_h1() const; /*! -The same as `is_extensible_triangulation_in_1_sheet_h1()` but with -a more precise heuristic, i.e.\ it might answer `true` in cases in which -`is_extensible_triangulation_in_1_sheet_h1()` would not. However, it is -much less time efficient when not computing in the 1-sheeted covering -space. (This test uses the diameter of the largest empty ball in the -input point set as a criterion \cgalCite{cgal:ct-c3pt-09}.) -*/ -bool is_extensible_triangulation_in_1_sheet_h2() const; +The same as `is_extensible_triangulation_in_1_sheet_h1()` but with +a more precise heuristic, i.e.\ it might answer `true` in cases in which +`is_extensible_triangulation_in_1_sheet_h1()` would not. However, it is +much less time efficient when not computing in the 1-sheeted covering +space. (This test uses the diameter of the largest empty ball in the +input point set as a criterion \cgalCite{cgal:ct-c3pt-09}.) +*/ +bool is_extensible_triangulation_in_1_sheet_h2() const; /*! -Returns `true` if the current triangulation would still be a -triangulation in the 1-sheeted covering space, returns `false` otherwise. -*/ -bool is_triangulation_in_1_sheet() const; +Returns `true` if the current triangulation would still be a +triangulation in the 1-sheeted covering space, returns `false` otherwise. +*/ +bool is_triangulation_in_1_sheet() const; /*! -Converts the current triangulation into the same periodic -triangulation in the 1-sheeted covering space. +Converts the current triangulation into the same periodic +triangulation in the 1-sheeted covering space. \attention It is not recommended to interfere with the built-in covering management. Especially a premature conversion to the 1-sheeted covering space might lead to problems when modifying the triangulation later. -*/ -void convert_to_1_sheeted_covering() const; +*/ +void convert_to_1_sheeted_covering() const; /*! -Converts the current triangulation into the same periodic -triangulation in the 27-sheeted covering space. +Converts the current triangulation into the same periodic +triangulation in the 27-sheeted covering space. \attention It is not recommended to interfere with the built-in covering management. Especially a premature conversion to the 1-sheeted covering space might lead to problems when modifying the triangulation later. -*/ -void convert_to_27_sheeted_covering() const; +*/ +void convert_to_27_sheeted_covering() const; /*! -Returns the number of vertices. Counts all vertices that are -representatives of the same point in \f$ \mathbb T_c^3\f$ as one vertex. -*/ -size_type number_of_vertices() const; +Returns the number of vertices. Counts all vertices that are +representatives of the same point in \f$ \mathbb T_c^3\f$ as one vertex. +*/ +size_type number_of_vertices() const; /*! -Returns the number of cells. Counts all cells that are -representatives of the same tetrahedron in \f$ \mathbb T_c^3\f$ as one -cell. -*/ -size_type number_of_cells() const; +Returns the number of cells. Counts all cells that are +representatives of the same tetrahedron in \f$ \mathbb T_c^3\f$ as one +cell. +*/ +size_type number_of_cells() const; /*! -Returns the number of vertices in the data structure. This is the -same as the number of sheets times `number_of_vertices()`. -*/ -size_type number_of_stored_vertices() const; +Returns the number of vertices in the data structure. This is the +same as the number of sheets times `number_of_vertices()`. +*/ +size_type number_of_stored_vertices() const; /*! -Returns the number of cells in the data structure. This is the same -as the number of sheets times `number_of_cells()`. -*/ -size_type number_of_stored_cells() const; +Returns the number of cells in the data structure. This is the same +as the number of sheets times `number_of_cells()`. +*/ +size_type number_of_stored_cells() const; -/// @} +/// @} -/// \name Non-constant-time access functions +/// \name Non-constant-time access functions /// @{ /*! -Returns the number of edges. Counts all edges that are -representatives of the same segment in \f$ \mathbb T_c^3\f$ as one edge. -*/ -size_type number_of_edges() const; +Returns the number of edges. Counts all edges that are +representatives of the same segment in \f$ \mathbb T_c^3\f$ as one edge. +*/ +size_type number_of_edges() const; /*! -Returns the number of facets. Counts all facets that are -representatives of the same triangle in \f$ \mathbb T_c^3\f$ as one -facet. -*/ -size_type number_of_facets() const; +Returns the number of facets. Counts all facets that are +representatives of the same triangle in \f$ \mathbb T_c^3\f$ as one +facet. +*/ +size_type number_of_facets() const; /*! -Returns the number of edges in the data structure. This is the same -as the number of sheets times `number_of_edges()`. -*/ -size_type number_of_stored_edges() const; +Returns the number of edges in the data structure. This is the same +as the number of sheets times `number_of_edges()`. +*/ +size_type number_of_stored_edges() const; /*! -Returns the number of facets in the data structure. This is the same -as the number of sheets times `number_of_facets()`. -*/ -size_type number_of_stored_facets() const; +Returns the number of facets in the data structure. This is the same +as the number of sheets times `number_of_facets()`. +*/ +size_type number_of_stored_facets() const; -/// @} +/// @} -/// \name Geometric Access Functions +/// \name Geometric Access Functions +/// The following functions return object of types `Periodic_segment`, +/// `Periodic_triangle`, and `Periodic_tetrahedron`, which have inner type `Point`. /// @{ /*! -Returns the periodic point given by vertex `v`. If `t` is -represented in the 1-sheeted covering space, the offset is always -zero. Otherwise `v` can correspond to a periodic copy outside -`domain` of an input point. -*/ -Periodic_point periodic_point(const Vertex_handle v) const; +Returns the periodic point given by vertex `v`. If `t` is +represented in the 1-sheeted covering space, the offset is always +zero. Otherwise `v` can correspond to a periodic copy outside +`domain` of an input point. +*/ +Periodic_point periodic_point(const Vertex_handle v) const; /*! -If `t` is represented in the 1-sheeted covering space, this function -returns the periodic point given by the \f$ i\f$-th vertex of cell -`c`, that is the point in the original domain and the offset of -the vertex in `c`. -If `t` is represented in the 27-sheeted covering space, -this offset is possibly added to another offset determining the periodic copy. -\pre \f$ i \in\{0,1,2,3\}\f$ -*/ -Periodic_point periodic_point(const Cell_handle c, int i) -const; +If `t` is represented in the 1-sheeted covering space, this function +returns the periodic point given by the \f$ i\f$-th vertex of cell +`c`, that is the point in the original domain and the offset of +the vertex in `c`. +If `t` is represented in the 27-sheeted covering space, +this offset is possibly added to another offset determining the periodic copy. +\pre \f$ i \in\{0,1,2,3\}\f$ +*/ +Periodic_point periodic_point(const Cell_handle c, int i) +const; /*! -Returns the periodic segment formed by the two point-offset pairs -corresponding to the two vertices of edge `(c,i,j)`. -\pre \f$ i,j \in\{0,1,2,3\}\f$, \f$ i\neq j\f$ -*/ -Periodic_segment periodic_segment(const Cell_handle c, int -i, int j) const; +Returns the periodic segment formed by the two point-offset pairs +corresponding to the two vertices of edge `(c,i,j)`. +\pre \f$ i,j \in\{0,1,2,3\}\f$, \f$ i\neq j\f$ +*/ +Periodic_segment periodic_segment(const Cell_handle c, int +i, int j) const; /*! -Same as the previous method for edge `e`. -*/ -Periodic_segment periodic_segment(const Edge & e) const; +Returns the periodic segment formed by the two point-offset pairs +corresponding to the two vertices of edge `(c,i,j)`. + +A translation in accordance with `offset` is applied on the point-offet pairs. +\pre \f$ i,j \in\{0,1,2,3\}\f$, \f$ i\neq j\f$ +*/ +Periodic_segment periodic_segment(const Cell_handle c, Offset offset, int +i, int j) const; /*! -Returns the periodic triangle formed by the three point-offset pairs -corresponding to the three vertices of facet -`(c,i)`. The triangle is oriented so that its normal points to the -inside of cell `c`. -\pre \f$ i \in\{0,1,2,3\}\f$ -*/ -Periodic_triangle periodic_triangle(const Cell_handle c, int -i) const; +Same as the previous method for edge `e`. +*/ +Periodic_segment periodic_segment(const Edge & e) const; /*! -Same as the previous method for facet `f`. -*/ -Periodic_triangle periodic_triangle(const Facet & f) const; +Returns the periodic triangle formed by the three point-offset pairs +corresponding to the three vertices of facet +`(c,i)`. The triangle is oriented so that its normal points to the +inside of cell `c`. +\pre \f$ i \in\{0,1,2,3\}\f$ +*/ +Periodic_triangle periodic_triangle(const Cell_handle c, int +i) const; /*! -Returns the periodic tetrahedron formed by the four point-offset pairs -corresponding to the four vertices of `c`. -*/ -Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c) const; +Returns the periodic triangle formed by the three point-offset pairs +corresponding to the three vertices of facet +`(c,i)`. +A translation in accordance with `offset` is applied on the point-offet pairs. -/// \name +The triangle is oriented so that its normal points to the +inside of cell `c`. +\pre \f$ i \in\{0,1,2,3\}\f$ +*/ +Periodic_triangle periodic_triangle(const Cell_handle c, Offset offset, int i) const; + +/*! +Same as the previous method for facet `f`. +*/ +Periodic_triangle periodic_triangle(const Facet & f) const; + +/*! +Returns the periodic tetrahedron formed by the four point-offset pairs +corresponding to the four vertices of `c`. +*/ +Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c) const; + +/*! +Returns the periodic tetrahedron formed by the four point-offset pairs +corresponding to the four vertices of `c`. + +A translation in accordance with `offset` is applied on the point-offet pairs. +*/ +Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c, Offset offset) const; + +/// \name +/// \warning The following functions were renamed with %CGAL 4.11 to clarify +/// that they return geometric objects with inner type `Point_3`. +/// /// Note that a traits class providing exact constructions should be /// used in order to guarantee the following operations to be exact /// (as opposed to computing the triangulation only, which requires /// only exact predicates). +/// /// @{ /*! -Converts the `Periodic_point` `s` (point-offset pair) to the -corresponding `Point` in \f$ \mathbb R^3\f$. -*/ -Point point(const Periodic_point & p ) const; +Converts the periodic point of type `PP` to a `Point_3`. The type `PP` can be either +`Periodic_point` or `Periodic_point_3`. +*/ +template +Point_3 construct_point(const PP & pp) const; /*! -Converts the `Periodic_segment` `s` to a `Segment`. -*/ -Segment segment(const Periodic_segment & s) const; +Converts the `Point` `p` to a `Point_3`. +*/ +Point_3 construct_point(const Point & p) const; /*! -Converts the `Periodic_triangle` `t` to a `Triangle`. -*/ -Triangle triangle(const Periodic_triangle & t) const; +Same as above, with offsets. +*/ +template +Point_3 construct_point(const P& p1, const Offset& o1) const; /*! -Converts the `Periodic_tetrahedron` `t` to a `Tetrahedron`. -*/ -Tetrahedron tetrahedron(const Periodic_tetrahedron & t) -const; - -/// @} - -/// \name Queries -/// @{ +Converts the periodic segment of type `PS` to a `Segment`. The type `PS` can be +either `Periodic_segment` or `Periodic_segment_3`. +*/ +template +Segment construct_segment(const PS & s) const; /*! -Tests whether `p` is a vertex of `t` by locating `p` in -the triangulation. If `p` is found, the associated vertex `v` -is given. -*/ -bool is_vertex(const Point & p, Vertex_handle & v) const; +Creates a segment from two points. The type `P` can be either `Point` or `Point_3`. +*/ +template +Segment construct_segment(const P& p1, const P& p2) const; /*! -Tests whether `v` is a vertex of `t`. -*/ -bool is_vertex(Vertex_handle v) const; +Same as above, with offsets. +*/ +template +Segment construct_segment(const P& p1, const P& p2, const Offset& o1, const Offset& o2) const; /*! -Tests whether `(u,v)` is an edge of `t`. If the edge is found, -it gives a cell `c` having this edge and the indices `i` -and `j` of the vertices `u` and `v` in `c`, in this order. -\pre `u` and `v` are vertices of `t`. -*/ -bool is_edge(Vertex_handle u, Vertex_handle v, -Cell_handle & c, int & i, int & j) const; +Converts the periodic triangle of type `PT` to a `Triangle`. The type `PT` can +be either `Periodic_triangle` or `Periodic_triangle_3`. +*/ +template +Triangle construct_triangle(const PT & t) const; /*! -Tests whether `((u,offu),(v,offu))` is an edge of -`t`. If the edge is found, it gives a cell `c` having this -edge and the indices `i` and `j` of the vertices `u` and -`v` in `c`, in this order. -\pre `u` and `v` are vertices of `t`. -*/ -bool is_edge(Vertex_handle u, const Offset & offu, -Vertex_handle v, const Offset & offv, -Cell_handle & c, int & i, int & j) const; +Creates a triangle from three points. The type `P` can be either `Point` or `Point_3`. +*/ +template +Triangle construct_triangle(const P& p1, const P& p2, const P& p3) const; /*! -Tests whether `(u,v,w)` is a facet of `t`. If the facet is found, -it computes a cell `c` having this facet and the indices `i`, -`j` and `k` of the vertices `u`, `v` and `w` in `c`, -in this order. -\pre `u`, `v` and `w` are vertices of `t`. -*/ -bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w, -Cell_handle & c, int & i, int & j, int & k) const; +Same as above, with offsets. +*/ +template +Triangle construct_triangle(const P& p1, const P& p2, const P& p3, + const Offset& o1, const Offset& o2, const Offset& o3) const; /*! -Tests whether `((u,offu),(v,offv),(w,offw))` -is a facet of `t`. If the facet is found, -it computes a cell `c` having this facet and the indices `i`, -`j` and `k` of the vertices `u`, `v` and `w` in `c`, -in this order. -\pre `u`, `v` and `w` are vertices of `t`. -*/ -bool is_facet(Vertex_handle u, const Offset & offu, -Vertex_handle v, const Offset & offv, -Vertex_handle w, const Offset & offw, -Cell_handle & c, int & i, int & j, int & k) const; +Converts the periodic tetrahedron of type `PT` to a `Tetrahedron`. The type `PT` +can be either `Periodic_tetrahedron` or `Periodic_tetrahedron_3`. +*/ +template +Tetrahedron construct_tetrahedron(const PT & t) const; /*! -Tests whether `c` is a cell of `t`. -*/ -bool is_cell(Cell_handle c) const; +Creates a tetrahedron from four points. The type `P` can be either `Point` or `Point_3`. +*/ +template +Tetrahedron construct_tetrahedron(const P& p1, const P& p2, const P& p3, const P& p4) const; /*! -Tests whether `(u,v,w,x)` is a cell of `t`. -If the cell `c` is found, the method -computes the indices `i`, `j`, `k` and `l` of the -vertices `u`, `v`, `w` and `x` in `c`, in this -order. -\pre `u`, `v`, `w` and `x` are vertices of `t`. -*/ -bool is_cell(Vertex_handle u, Vertex_handle v, -Vertex_handle w, Vertex_handle x, -Cell_handle & c, -int & i, int & j, int & k, int & l) const; - -/*! -Tests whether `(u,v,w,x)` is a cell of `t` and computes -this cell `c`. -\pre `u`, `v`, `w` and `x` are vertices of `t`. -*/ -bool is_cell(Vertex_handle u, Vertex_handle v, -Vertex_handle w, Vertex_handle x, -Cell_handle & c) const; - -/*! -Tests whether -`((u,offu),(v,offv),(w,offv),(x,offx))` is a cell of `t`. -If the cell `c` is found, the method -computes the indices `i`, `j`, `k` and `l` of the -vertices `u`, `v`, `w` and `x` in `c`, in this -order. -\pre `u`, `v`, `w` and `x` are vertices of `t`. -*/ -bool is_cell(Vertex_handle u, const Offset & offu, -Vertex_handle v, const Offset & offv, -Vertex_handle w, const Offset & offw, -Vertex_handle x, const Offset & offx, -Cell_handle & c, -int & i, int & j, int & k, int & l) const; - -/*! -Tests whether -`((u,offu),(v,offv),(w,offv),(x,offx))` is a -cell of `t` and computes this cell `c`. -\pre `u`, `v`, `w` and `x` are vertices of `t`. -*/ -bool is_cell(Vertex_handle u, const Offset & offu, -Vertex_handle v, const Offset & offv, -Vertex_handle w, const Offset & offw, -Vertex_handle x, const Offset & offx, -Cell_handle & c) const; +Same as above, with offsets. +*/ +template +Tetrahedron construct_tetrahedron(const P& p1, const P& p2, const P& p3, const P& p4, + const Offset& o1, const Offset& o2, const Offset& o3, const Offset& o4) const; /// @} -/// \name -/// There is a method `has_vertex` in the cell class. The analogous methods for facets are defined here. +/// \name Queries /// @{ /*! -If `v` is a vertex of `f`, then `j` is the index of -`v` in the cell `f.first`, and the method returns `true`. -*/ -bool has_vertex(const Facet & f, Vertex_handle v, int & j) const; +Tests whether `p` is a vertex of `t` by locating `p` in +the triangulation. If `p` is found, the associated vertex `v` +is given. +*/ +bool is_vertex(const Point & p, Vertex_handle & v) const; /*! -Same for facet `(c,i)`. Computes the index `j` of `v` in -`c`. -*/ -bool has_vertex(Cell_handle c, int i, -Vertex_handle v, int & j) const; +Tests whether `v` is a vertex of `t`. +*/ +bool is_vertex(Vertex_handle v) const; + +/*! +Tests whether `(u,v)` is an edge of `t`. If the edge is found, +it gives a cell `c` having this edge and the indices `i` +and `j` of the vertices `u` and `v` in `c`, in this order. +\pre `u` and `v` are vertices of `t`. +*/ +bool is_edge(Vertex_handle u, Vertex_handle v, +Cell_handle & c, int & i, int & j) const; + +/*! +Tests whether `((u,offu),(v,offu))` is an edge of +`t`. If the edge is found, it gives a cell `c` having this +edge and the indices `i` and `j` of the vertices `u` and +`v` in `c`, in this order. +\pre `u` and `v` are vertices of `t`. +*/ +bool is_edge(Vertex_handle u, const Offset & offu, +Vertex_handle v, const Offset & offv, +Cell_handle & c, int & i, int & j) const; + +/*! +Tests whether `(u,v,w)` is a facet of `t`. If the facet is found, +it computes a cell `c` having this facet and the indices `i`, +`j` and `k` of the vertices `u`, `v` and `w` in `c`, +in this order. +\pre `u`, `v` and `w` are vertices of `t`. +*/ +bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w, +Cell_handle & c, int & i, int & j, int & k) const; + +/*! +Tests whether `((u,offu),(v,offv),(w,offw))` +is a facet of `t`. If the facet is found, +it computes a cell `c` having this facet and the indices `i`, +`j` and `k` of the vertices `u`, `v` and `w` in `c`, +in this order. +\pre `u`, `v` and `w` are vertices of `t`. +*/ +bool is_facet(Vertex_handle u, const Offset & offu, +Vertex_handle v, const Offset & offv, +Vertex_handle w, const Offset & offw, +Cell_handle & c, int & i, int & j, int & k) const; + +/*! +Tests whether `c` is a cell of `t`. +*/ +bool is_cell(Cell_handle c) const; + +/*! +Tests whether `(u,v,w,x)` is a cell of `t`. +If the cell `c` is found, the method +computes the indices `i`, `j`, `k` and `l` of the +vertices `u`, `v`, `w` and `x` in `c`, in this +order. +\pre `u`, `v`, `w` and `x` are vertices of `t`. +*/ +bool is_cell(Vertex_handle u, Vertex_handle v, +Vertex_handle w, Vertex_handle x, +Cell_handle & c, +int & i, int & j, int & k, int & l) const; + +/*! +Tests whether `(u,v,w,x)` is a cell of `t` and computes +this cell `c`. +\pre `u`, `v`, `w` and `x` are vertices of `t`. +*/ +bool is_cell(Vertex_handle u, Vertex_handle v, +Vertex_handle w, Vertex_handle x, +Cell_handle & c) const; + +/*! +Tests whether +`((u,offu),(v,offv),(w,offv),(x,offx))` is a cell of `t`. +If the cell `c` is found, the method +computes the indices `i`, `j`, `k` and `l` of the +vertices `u`, `v`, `w` and `x` in `c`, in this +order. +\pre `u`, `v`, `w` and `x` are vertices of `t`. +*/ +bool is_cell(Vertex_handle u, const Offset & offu, +Vertex_handle v, const Offset & offv, +Vertex_handle w, const Offset & offw, +Vertex_handle x, const Offset & offx, +Cell_handle & c, +int & i, int & j, int & k, int & l) const; + +/*! +Tests whether +`((u,offu),(v,offv),(w,offv),(x,offx))` is a +cell of `t` and computes this cell `c`. +\pre `u`, `v`, `w` and `x` are vertices of `t`. +*/ +bool is_cell(Vertex_handle u, const Offset & offu, +Vertex_handle v, const Offset & offv, +Vertex_handle w, const Offset & offw, +Vertex_handle x, const Offset & offx, +Cell_handle & c) const; + +/// @} + +/// \name +/// There is a method `has_vertex` in the cell class. The analogous methods for facets are defined here. +/// @{ + +/*! +If `v` is a vertex of `f`, then `j` is the index of +`v` in the cell `f.first`, and the method returns `true`. +*/ +bool has_vertex(const Facet & f, Vertex_handle v, int & j) const; + +/*! +Same for facet `(c,i)`. Computes the index `j` of `v` in +`c`. +*/ +bool has_vertex(Cell_handle c, int i, +Vertex_handle v, int & j) const; /*! -*/ -bool has_vertex(const Facet & f, Vertex_handle v) const; +*/ +bool has_vertex(const Facet & f, Vertex_handle v) const; /*! -Same as the first two methods, but these two methods do not return the -index of the vertex. -*/ -bool has_vertex(Cell_handle c, int i, Vertex_handle v) const; +Same as the first two methods, but these two methods do not return the +index of the vertex. +*/ +bool has_vertex(Cell_handle c, int i, Vertex_handle v) const; /// @} @@ -744,22 +870,22 @@ bool has_vertex(Cell_handle c, int i, Vertex_handle v) const; /*! -*/ -bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const; +*/ +bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const; /*! -*/ -bool are_equal(const Facet & f, const Facet & g) const; +*/ +bool are_equal(const Facet & f, const Facet & g) const; /*! -*/ -bool are_equal(const Facet & f, Cell_handle n, int j) const; +*/ +bool are_equal(const Facet & f, Cell_handle n, int j) const; -/// @} +/// @} -/// \name Point Location +/// \name Point Location /// The class `Periodic_3_triangulation_3` provides three functions to /// locate a given point with respect to a triangulation. It provides /// also functions to test if a given point is inside a face or @@ -769,18 +895,33 @@ bool are_equal(const Facet & f, Cell_handle n, int j) const; /*! -Returns the cell that contains the query in its interior. If -`query` lies on a facet, an edge or on a vertex, one of the cells -having `query` on its boundary is returned. +Returns the cell that contains the query in its interior. If +`query` lies on a facet, an edge or on a vertex, one of the cells +having `query` on its boundary is returned. -The optional argument `start` is used as a starting place for the -search. -\pre `query` lies in the original domain `domain`. +The optional argument `start` is used as a starting place for the +search. +\pre `query` lies in the original domain `domain`. -*/ -Cell_handle -locate(const Point & query, Cell_handle start = Cell_handle()) const; +*/ +Cell_handle +locate(const Point & query, Cell_handle start = Cell_handle()) const; +/*! +Returns the cell that contains the query in its interior. If +`query` lies on a facet, an edge or on a vertex, one of the cells +having `query` on its boundary is returned. + +`locate_offset` is the offset that must be used by the function +periodic_tetrahedron() together with the returned cell, so that the +constructed Periodic_tetrahedron contains the query point. + +The optional argument `start` is used as a starting place for the +search. +\pre `query` lies in the original domain `domain`. +*/ +Cell_handle +locate(const Point & query, Offset& locate_offset, Cell_handle start = Cell_handle()) const; /*! Same as `locate()` but uses inexact predicates. @@ -797,55 +938,81 @@ inexact_locate(const Point & query, Cell_handle start = Cell_handle()) const; /*! -The \f$ k\f$-face that contains `query` in its interior is -returned, by means of the cell returned together with `lt`, which -is set to the locate type of the query (`VERTEX, EDGE, FACET, CELL`) and two indices `li` and `lj` that -specify the \f$ k\f$-face of the cell containing `query`. +The \f$ k\f$-face that contains `query` in its interior is +returned, by means of the cell returned together with `lt`, which +is set to the locate type of the query (`VERTEX, EDGE, FACET, CELL`) and two indices `li` and `lj` that +specify the \f$ k\f$-face of the cell containing `query`. -If the \f$ k\f$-face is a cell, `li` and `lj` have no -meaning; if it is a facet (resp. vertex), `li` gives the index of -the facet (resp. vertex) and `lj` has no meaning; if it is an -edge, `li` and `lj` give the indices of its vertices. +If the \f$ k\f$-face is a cell, `li` and `lj` have no +meaning; if it is a facet (resp. vertex), `li` gives the index of +the facet (resp. vertex) and `lj` has no meaning; if it is an +edge, `li` and `lj` give the indices of its vertices. -If there is no vertex in the triangulation yet, `lt` is set to -`EMPTY` and `locate` returns the default constructed handle. +If there is no vertex in the triangulation yet, `lt` is set to +`EMPTY` and `locate` returns the default constructed handle. -The optional argument `start` is used as a starting place for the -search. -\pre `query` lies in the original domain `domain`. +The optional argument `start` is used as a starting place for the +search. +\pre `query` lies in the original domain `domain`. -*/ -Cell_handle -locate(const Point & query, Locate_type & lt, -int & li, int & lj, Cell_handle start = Cell_handle() ) const; +*/ +Cell_handle +locate(const Point & query, Locate_type & lt, +int & li, int & lj, Cell_handle start = Cell_handle() ) const; /*! -Returns a value indicating on which side of the oriented boundary -of `c` the point `p` lies. More precisely, it returns: +The \f$ k\f$-face that contains `query` in its interior is +returned, by means of the cell returned together with `lt`, which +is set to the locate type of the query (`VERTEX, EDGE, FACET, CELL`) and two indices `li` and `lj` that +specify the \f$ k\f$-face of the cell containing `query`. -- `ON_BOUNDED_SIDE` if `p` is inside the cell. +If the \f$ k\f$-face is a cell, `li` and `lj` have no +meaning; if it is a facet (resp. vertex), `li` gives the index of +the facet (resp. vertex) and `lj` has no meaning; if it is an +edge, `li` and `lj` give the indices of its vertices. -- `ON_BOUNDARY` if `p` on the boundary of the cell. Then -`lt` together with `li` and `lj` give the precise location -on the boundary. (See the descriptions of the `locate` methods.) +If there is no vertex in the triangulation yet, `lt` is set to +`EMPTY` and `locate` returns the default constructed handle. -- `ON_UNBOUNDED_SIDE` if `p` lies outside the cell. -\pre `query` lies in the original domain `domain`. -*/ -Bounded_side -side_of_cell(const Point & p, -Cell_handle c, -Locate_type & lt, int & li, int & lj) const; +`locate_offset` is the offset that must be used by the function +periodic_tetrahedron() together with the returned cell, so that the +constructed Periodic_tetrahedron contains the query point. -/// @} +The optional argument `start` is used as a starting place for the +search. +\pre `query` lies in the original domain `domain`. +*/ +Cell_handle +locate(const Point & query, Offset& locate_offset, Locate_type & lt, +int & li, int & lj, Cell_handle start = Cell_handle() ) const; + +/*! +Returns a value indicating on which side of the oriented boundary +of `c` the point `p` lies. More precisely, it returns: + +- `ON_BOUNDED_SIDE` if `p` is inside the cell. + +- `ON_BOUNDARY` if `p` on the boundary of the cell. Then +`lt` together with `li` and `lj` give the precise location +on the boundary. (See the descriptions of the `locate` methods.) + +- `ON_UNBOUNDED_SIDE` if `p` lies outside the cell. +\pre `query` lies in the original domain `domain`. +*/ +Bounded_side +side_of_cell(const Point & p, +Cell_handle c, +Locate_type & lt, int & li, int & lj) const; + +/// @} /*! \name Traversal of the Triangulation -The periodic triangulation class provides several iterators and circulators -that allow one to traverse it. +The periodic triangulation class provides several iterators and circulators +that allow one to traverse it. -\name Cell, Face, Edge and Vertex Iterators +\name Cell, Face, Edge and Vertex Iterators The following iterators allow the user to visit cells, facets, edges and vertices of the stored triangulation, i.e.\ in case of computing in @@ -859,66 +1026,66 @@ their value types are respectively `Cell`, `Facet`, `Edge` and /// @{ /*! -Starts at an arbitrary vertex. Iterates over all vertices. Returns -`vertices_end()` if `t`.`number_of_vertices()` \f$ =0\f$. -*/ -Vertex_iterator vertices_begin() const; +Starts at an arbitrary vertex. Iterates over all vertices. Returns +`vertices_end()` if `t`.`number_of_vertices()` \f$ =0\f$. +*/ +Vertex_iterator vertices_begin() const; /*! -Past-the-end iterator -*/ -Vertex_iterator vertices_end() const; +Past-the-end iterator +*/ +Vertex_iterator vertices_end() const; /*! -Starts at an arbitrary edge. Iterates over all edges. Returns -`edges_end()` if `t`.`number_of_vertices()` \f$ =0\f$. -*/ -Edge_iterator edges_begin() const; +Starts at an arbitrary edge. Iterates over all edges. Returns +`edges_end()` if `t`.`number_of_vertices()` \f$ =0\f$. +*/ +Edge_iterator edges_begin() const; /*! -Past-the-end iterator -*/ -Edge_iterator edges_end() const; +Past-the-end iterator +*/ +Edge_iterator edges_end() const; /*! -Starts at an arbitrary facet. Iterates over all facets. Returns -`facets_end()` if `t`.`number_of_vertices()` \f$ =0\f$. -*/ -Facet_iterator facets_begin() const; +Starts at an arbitrary facet. Iterates over all facets. Returns +`facets_end()` if `t`.`number_of_vertices()` \f$ =0\f$. +*/ +Facet_iterator facets_begin() const; /*! -Past-the-end iterator -*/ -Facet_iterator facets_end() const; +Past-the-end iterator +*/ +Facet_iterator facets_end() const; /*! -Starts at an arbitrary cell. Iterates over all cells. Returns -`cells_end()` if `t`.`number_of_vertices()` \f$ =0\f$. -*/ -Cell_iterator cells_begin() const; +Starts at an arbitrary cell. Iterates over all cells. Returns +`cells_end()` if `t`.`number_of_vertices()` \f$ =0\f$. +*/ +Cell_iterator cells_begin() const; /*! -Past-the-end iterator -*/ -Cell_iterator cells_end() const; +Past-the-end iterator +*/ +Cell_iterator cells_end() const; /*! -Starts at an arbitrary vertex. Iterates over all vertices whose -corresponding points lie in the original domain, i.e.\ for each set -of periodic copies the `Unique_vertex_iterator` iterates over -exactly one representative. Returns `unique_vertices_end()` if -`t`.`number_of_vertices()` \f$ =0\f$. -*/ -Unique_vertex_iterator unique_vertices_begin() const; +Starts at an arbitrary vertex. Iterates over all vertices whose +corresponding points lie in the original domain, i.e.\ for each set +of periodic copies the `Unique_vertex_iterator` iterates over +exactly one representative. Returns `unique_vertices_end()` if +`t`.`number_of_vertices()` \f$ =0\f$. +*/ +Unique_vertex_iterator unique_vertices_begin() const; /*! -Past-the-end iterator -*/ -Unique_vertex_iterator unique_vertices_end() const; +Past-the-end iterator +*/ +Unique_vertex_iterator unique_vertices_end() const; -/// @} +/// @} -/*! \name Geometric Iterators +/*! \name Geometric Iterators The following iterators allow the user to obtain geometric primitives corresponding to cells, facets, edges, and vertices of the @@ -932,10 +1099,10 @@ the geometric primitives in the original domain. This can be controlled using the enum `Iterator_type`. \anchor P3Triangulation3figgeom_iterators -STORED -STORED_COVER_DOMAIN -UNIQUE -UNIQUE_COVER_DOMAIN +STORED +STORED_COVER_DOMAIN +UNIQUE +UNIQUE_COVER_DOMAIN
    The four different modes of the geometric iterators: STORED, STORED_COVER_DOMAIN, UNIQUE, UNIQUE_COVER_DOMAIN. Note that in case of computing in the 1-sheeted covering space, STORED and UNIQUE give the same result.
    @@ -944,72 +1111,72 @@ controlled using the enum `Iterator_type`. /// @{ /*! -Iterates over the points of the triangulation. Its behavior is -defined by the `Iterator_type` `it` as described on +Iterates over the points of the triangulation. Its behavior is +defined by the `Iterator_type` `it` as described on \ref CGAL::Periodic_3_triangulation_3::Iterator_type. -*/ -Periodic_point_iterator periodic_points_begin(Iterator_type it = -STORED) const; +*/ +Periodic_point_iterator periodic_points_begin(Iterator_type it = +STORED) const; /*! -Past-the-end iterator. Note that to match another -`Periodic_point_iterator` both must have the same -`Iterator_type` `it`. -*/ -Periodic_point_iterator periodic_points_end(Iterator_type it = -STORED) const; +Past-the-end iterator. Note that to match another +`Periodic_point_iterator` both must have the same +`Iterator_type` `it`. +*/ +Periodic_point_iterator periodic_points_end(Iterator_type it = +STORED) const; /*! -Iterates over the segments of the triangulation. Its behavior is -defined by the `Iterator_type` `it` as described on +Iterates over the segments of the triangulation. Its behavior is +defined by the `Iterator_type` `it` as described on \ref CGAL::Periodic_3_triangulation_3::Iterator_type. -*/ -Periodic_segment_iterator periodic_segments_begin(Iterator_type it = -STORED) const; +*/ +Periodic_segment_iterator periodic_segments_begin(Iterator_type it = +STORED) const; /*! -Past-the-end iterator. Note that to match another -`Periodic_segment_iterator` both must have the same -`Iterator_type` `it`. -*/ -Periodic_segment_iterator periodic_segments_end(Iterator_type it = -STORED) const; +Past-the-end iterator. Note that to match another +`Periodic_segment_iterator` both must have the same +`Iterator_type` `it`. +*/ +Periodic_segment_iterator periodic_segments_end(Iterator_type it = +STORED) const; /*! -Iterates over the triangles of the triangulation. Its behavior is -defined by the `Iterator_type` `it` as described on +Iterates over the triangles of the triangulation. Its behavior is +defined by the `Iterator_type` `it` as described on \ref CGAL::Periodic_3_triangulation_3::Iterator_type. -*/ -Periodic_triangle_iterator periodic_triangles_begin(Iterator_type it = -STORED) const; +*/ +Periodic_triangle_iterator periodic_triangles_begin(Iterator_type it = +STORED) const; /*! -Past-the-end iterator. Note that to match another -`Periodic_triangle_iterator` both must have the same -`Iterator_type` `it`. -*/ -Periodic_triangle_iterator periodic_triangles_end(Iterator_type it = -STORED) const; +Past-the-end iterator. Note that to match another +`Periodic_triangle_iterator` both must have the same +`Iterator_type` `it`. +*/ +Periodic_triangle_iterator periodic_triangles_end(Iterator_type it = +STORED) const; /*! -Iterates over the tetrahedra of the triangulation. Its behavior is -defined by the `Iterator_type` `it` as described on +Iterates over the tetrahedra of the triangulation. Its behavior is +defined by the `Iterator_type` `it` as described on \ref CGAL::Periodic_3_triangulation_3::Iterator_type. -*/ -Periodic_tetrahedron_iterator periodic_tetrahedra_begin(Iterator_type it = -STORED) const; +*/ +Periodic_tetrahedron_iterator periodic_tetrahedra_begin(Iterator_type it = +STORED) const; /*! -Past-the-end iterator. Note that to match another -`Periodic_tetrahedron_iterator` both must have the same -`Iterator_type` `it`. -*/ -Periodic_tetrahedron_iterator periodic_tetrahedra_end(Iterator_type it = -STORED) const; +Past-the-end iterator. Note that to match another +`Periodic_tetrahedron_iterator` both must have the same +`Iterator_type` `it`. +*/ +Periodic_tetrahedron_iterator periodic_tetrahedra_end(Iterator_type it = +STORED) const; -/// @} +/// @} -/// \name Cell and Facet Circulators +/// \name Cell and Facet Circulators /// The following circulators respectively visit all cells or all /// facets incident to a given edge. They are non-mutable and /// bidirectional. They are invalidated by any modification of one of @@ -1017,136 +1184,136 @@ STORED) const; /// @{ /*! -Starts at an arbitrary cell incident to `e`. -*/ -Cell_circulator incident_cells(Edge e) const; +Starts at an arbitrary cell incident to `e`. +*/ +Cell_circulator incident_cells(Edge e) const; /*! -As above for edge `(i,j)` of `c`. -*/ -Cell_circulator incident_cells(Cell_handle c, int i, int j) const; +As above for edge `(i,j)` of `c`. +*/ +Cell_circulator incident_cells(Cell_handle c, int i, int j) const; /*! -Starts at cell `start`. -\pre `start` is incident to `e`. -*/ -Cell_circulator incident_cells(Edge e, Cell_handle start) const; +Starts at cell `start`. +\pre `start` is incident to `e`. +*/ +Cell_circulator incident_cells(Edge e, Cell_handle start) const; /*! -As above for edge `(i,j)` of `c`. -*/ -Cell_circulator incident_cells(Cell_handle c, int i, int j, -Cell_handle start) const; +As above for edge `(i,j)` of `c`. +*/ +Cell_circulator incident_cells(Cell_handle c, int i, int j, +Cell_handle start) const; /*! -Starts at an arbitrary facet incident to `e`. -*/ -Facet_circulator incident_facets(Edge e) const; +Starts at an arbitrary facet incident to `e`. +*/ +Facet_circulator incident_facets(Edge e) const; /*! -As above for edge `(i,j)` of `c`. -*/ -Facet_circulator incident_facets(Cell_handle c, int i, int j) const; +As above for edge `(i,j)` of `c`. +*/ +Facet_circulator incident_facets(Cell_handle c, int i, int j) const; /*! -Starts at facet `start`. -\pre `start` is incident to `e`. -*/ -Facet_circulator incident_facets(Edge e, Facet start) const; +Starts at facet `start`. +\pre `start` is incident to `e`. +*/ +Facet_circulator incident_facets(Edge e, Facet start) const; /*! -Starts at facet of index `f` in `start`. -*/ -Facet_circulator incident_facets(Edge e, Cell_handle start, int f) -const; +Starts at facet of index `f` in `start`. +*/ +Facet_circulator incident_facets(Edge e, Cell_handle start, int f) +const; /*! -As above for edge `(i,j)` of `c`. -*/ -Facet_circulator incident_facets(Cell_handle c, int i, int j, -Facet start) const; +As above for edge `(i,j)` of `c`. +*/ +Facet_circulator incident_facets(Cell_handle c, int i, int j, +Facet start) const; /*! -As above for edge `(i,j)` of `c` and facet `(start,f)`. -*/ -Facet_circulator incident_facets(Cell_handle c, int i, int j, -Cell_handle start, int f) const; +As above for edge `(i,j)` of `c` and facet `(start,f)`. +*/ +Facet_circulator incident_facets(Cell_handle c, int i, int j, +Cell_handle start, int f) const; -/// @} +/// @} /// \name Traversal of the Incident Cells and Facets, and the Adjacent Vertices of a Given Vertex /// @{ /*! -Copies the `Cell_handle`s of all cells incident to `v` to the output -iterator `cells`. Returns the resulting output iterator. -\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. -*/ -template -OutputIterator -incident_cells(Vertex_handle v, OutputIterator cells) const; +Copies the `Cell_handle`s of all cells incident to `v` to the output +iterator `cells`. Returns the resulting output iterator. +\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. +*/ +template +OutputIterator +incident_cells(Vertex_handle v, OutputIterator cells) const; /*! -Copies the `Facet`s incident to `v` to the output iterator -`facets`. -Returns the resulting output iterator. -\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. -*/ -template -OutputIterator -incident_facets(Vertex_handle v, OutputIterator facets) const; +Copies the `Facet`s incident to `v` to the output iterator +`facets`. +Returns the resulting output iterator. +\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. +*/ +template +OutputIterator +incident_facets(Vertex_handle v, OutputIterator facets) const; /*! -Copies the `Edge`s incident to `v` to the output iterator -`edges`. -Returns the resulting output iterator. -\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. -*/ -template -OutputIterator -incident_edges(Vertex_handle v, OutputIterator edges) const; +Copies the `Edge`s incident to `v` to the output iterator +`edges`. +Returns the resulting output iterator. +\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. +*/ +template +OutputIterator +incident_edges(Vertex_handle v, OutputIterator edges) const; /*! -Copies the `Vertex_handle`s of all vertices adjacent to `v` to the -output iterator `vertices`. Returns the resulting output iterator. -\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. -*/ -template -OutputIterator -adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; +Copies the `Vertex_handle`s of all vertices adjacent to `v` to the +output iterator `vertices`. Returns the resulting output iterator. +\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. +*/ +template +OutputIterator +adjacent_vertices(Vertex_handle v, OutputIterator vertices) const; /*! -Returns the degree of a vertex, that is, the number of adjacent vertices. -\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. -*/ -size_type degree(Vertex_handle v) const; +Returns the degree of a vertex, that is, the number of adjacent vertices. +\pre `v` \f$ \neq\f$ `Vertex_handle()`, `t`.`is_vertex(v)`. +*/ +size_type degree(Vertex_handle v) const; -/// @} +/// @} -/// \name Traversal Between Adjacent Cells +/// \name Traversal Between Adjacent Cells /// @{ /*! -Returns the index of `c` in its \f$ i^{th}\f$ neighbor. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -int mirror_index(Cell_handle c, int i) const; +Returns the index of `c` in its \f$ i^{th}\f$ neighbor. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +int mirror_index(Cell_handle c, int i) const; /*! -Returns the vertex of the \f$ i^{th}\f$ neighbor of `c` that is opposite to -`c`. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -Vertex_handle mirror_vertex(Cell_handle c, int i) const; +Returns the vertex of the \f$ i^{th}\f$ neighbor of `c` that is opposite to +`c`. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +Vertex_handle mirror_vertex(Cell_handle c, int i) const; /*! -Returns the same facet viewed from the other adjacent cell. -*/ -Facet mirror_facet(Facet f) const; +Returns the same facet viewed from the other adjacent cell. +*/ +Facet mirror_facet(Facet f) const; -/// @} +/// @} -/// \name Checking +/// \name Checking /// \cgalAdvancedBegin /// The responsibility of keeping a valid triangulation belongs to the /// user when using advanced operations allowing a direct manipulation @@ -1156,27 +1323,27 @@ Facet mirror_facet(Facet f) const; /// @{ /*! -Checks the combinatorial validity of the triangulation. Checks also the -validity of its geometric embedding (see -Section \ref P3Triangulation3secintro). -When `verbose` -is set to true, messages describing the first invalidity encountered -are printed. -*/ -bool -is_valid(bool verbose = false) const; +Checks the combinatorial validity of the triangulation. Checks also the +validity of its geometric embedding (see +Section \ref P3Triangulation3secintro). +When `verbose` +is set to true, messages describing the first invalidity encountered +are printed. +*/ +bool +is_valid(bool verbose = false) const; /*! -Checks the combinatorial validity of the cell by calling the -`is_valid` method of the `Triangulation_data_structure` cell -class. Also checks the geometric validity of `c`, if `c` is -finite. (See Section \ref P3Triangulation3secintro.) +Checks the combinatorial validity of the cell by calling the +`is_valid` method of the `Triangulation_data_structure` cell +class. Also checks the geometric validity of `c`, if `c` is +finite. (See Section \ref P3Triangulation3secintro.) -When `verbose` is set to `true`, messages are printed to give -a precise indication of the kind of invalidity encountered. -*/ -bool -is_valid(Cell_handle c, bool verbose = false) const; +When `verbose` is set to `true`, messages are printed to give +a precise indication of the kind of invalidity encountered. +*/ +bool +is_valid(Cell_handle c, bool verbose = false) const; /// @} @@ -1184,49 +1351,49 @@ is_valid(Cell_handle c, bool verbose = false) const; /*! -Reads a triangulation from `is` and stores it in `t`. -\pre `is` has the below described format. +Reads a triangulation from `is` and stores it in `t`. +\pre `is` has the below described format. -The information in the `iostream` is: -
      -
    • the original domain -
    • the number of sheets of the covering space as in -`number_of_sheets()` -
    • the number of vertices -
    • the non-combinatorial information of vertices (point -resp. point-offset pairs, etc.) -
    • the number of cells -
    • the indices of the vertices of each cell -
    • the indices of the neighbors of each cell, where the index -corresponds to the preceding list of cells -
    • the offsets corresponding to the vertices of the cells -
    • the non-combinatorial information of each cell -
    +The information in the `iostream` is: +
      +
    • the original domain +
    • the number of sheets of the covering space as in +`number_of_sheets()` +
    • the number of vertices +
    • the non-combinatorial information of vertices (point +resp. point-offset pairs, etc.) +
    • the number of cells +
    • the indices of the vertices of each cell +
    • the indices of the neighbors of each cell, where the index +corresponds to the preceding list of cells +
    • the offsets corresponding to the vertices of the cells +
    • the non-combinatorial information of each cell +
    -\relates Periodic_3_triangulation_3 -*/ -istream& operator>> (istream& is, Periodic_3_triangulation_3 &t); +\relates Periodic_3_triangulation_3 +*/ +istream& operator>> (istream& is, Periodic_3_triangulation_3 &t); /*! -Writes the triangulation `t` into `os`. +Writes the triangulation `t` into `os`. -The information in the `iostream` is: -
      -
    • the original domain -
    • the number of sheets of the covering space as in -`number_of_sheets()` -
    • the number of vertices -
    • the non-combinatorial information of vertices (point -resp. point-offset pairs, etc.) -
    • the number of cells -
    • the indices of the vertices of each cell -
    • the indices of the neighbors of each cell, where the index -corresponds to the preceding list of cells -
    • the offsets corresponding to the vertices of the cells -
    • the non-combinatorial information of each cell -
    +The information in the `iostream` is: +
      +
    • the original domain +
    • the number of sheets of the covering space as in +`number_of_sheets()` +
    • the number of vertices +
    • the non-combinatorial information of vertices (point +resp. point-offset pairs, etc.) +
    • the number of cells +
    • the indices of the vertices of each cell +
    • the indices of the neighbors of each cell, where the index +corresponds to the preceding list of cells +
    • the offsets corresponding to the vertices of the cells +
    • the non-combinatorial information of each cell +
    -\relates Periodic_3_triangulation_3 -*/ -ostream& operator<< (ostream& os, const Periodic_3_triangulation_3 &t); +\relates Periodic_3_triangulation_3 +*/ +ostream& operator<< (ostream& os, const Periodic_3_triangulation_3 &t); } /* end namespace CGAL */ diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_hierarchy_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_hierarchy_3.h index dfbffede3b3..a9fac021ee0 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_hierarchy_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_hierarchy_3.h @@ -10,9 +10,8 @@ location queries. \cgalHeading{Template Parameters} -It is templated by a parameter which must be instantiated by one of the \cgal periodic triangulation classes. In the current -implementation, only `Periodic_3_Delaunay_triangulation_3` is -supported for `PTr`. +\tparam PTr must be one of the \cgal periodic triangulation classes. In the current +implementation, only `Periodic_3_Delaunay_triangulation_3` is supported for. `PTr::Vertex` has to be a model of the concept `Periodic_3TriangulationHierarchyVertexBase_3`. @@ -21,14 +20,14 @@ supported for `PTr`. `Periodic_3DelaunayTriangulationTraits_3`. `Periodic_3_triangulation_hierarchy_3` offers exactly the same functionalities as `PTr`. -Most of them (point location, insertion, removal \f$ \ldots\f$ ) are overloaded to -improve their efficiency by using the hierarchic structure. +Most of these functionalities (point location, insertion, removal \f$ \ldots\f$ ) +are overloaded to improve their efficiency by using the hierarchic structure. Note that, since the algorithms that are provided are randomized, the running time of constructing a triangulation with a hierarchy may be improved when shuffling the data points. -However, the I/O operations are not overloaded. So, writing a +However, the I/O operations are not overloaded. Thus, writing a hierarchy into a file will lose the hierarchic structure and reading it from the file will result in an ordinary triangulation whose efficiency will be the same as `PTr`. diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_traits_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_traits_3.h index a849673050f..bdf39faa352 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_traits_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/CGAL/Periodic_3_triangulation_traits_3.h @@ -4,23 +4,21 @@ namespace CGAL { /*! \ingroup PkgPeriodic3Triangulation3TraitsClasses -\warning Using this traits class for Periodic_3_Delaunay_triangulation_3 is deprecated. You should use Periodic_3_Delaunay_triangulation_traits_3 instead. - The class `Periodic_3_triangulation_traits_3` is designed as a default traits class for the -class `Periodic_3_triangulation_3`. +class `Periodic_3_triangulation_3`. \tparam Traits must be a model of the `TriangulationTraits_3` concept. -\tparam Periodic_3Offset_3 must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`. +\tparam Offset must be a model of the concept `Periodic_3Offset_3` and defaults to `Periodic_3_offset_3`. If `Traits` is a `CGAL::Filtered_kernel` (detected when `Traits::Has_filtered_predicates` exists -and is `true`), this class automatically provides filtered predicates. Similarly statically filtered predicates +and is `true`), this class automatically provides filtered predicates. Similarly, statically filtered predicates will be used if the flag `Traits::Has_static_filters` exists and is `true`. By default, this holds for `CGAL::Exact_predicates_inexact_constructions_kernel` and `CGAL::Exact_predicates_exact_constructions_kernel`. \cgalModels Periodic_3TriangulationTraits_3 */ -template< typename Traits, typename Periodic_3Offset_3 > +template< typename Traits, typename Offset > class Periodic_3_triangulation_traits_3 : public Traits { public: }; /* end Periodic_3_triangulation_traits_3 */ diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3DelaunayTriangulationTraits_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3DelaunayTriangulationTraits_3.h index 81f0462c714..64016500753 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3DelaunayTriangulationTraits_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3DelaunayTriangulationTraits_3.h @@ -3,24 +3,24 @@ \ingroup PkgPeriodic3Triangulation3Concepts \cgalConcept -The concept `Periodic_3DelaunayTriangulationTraits_3` is the first template parameter of the classes -`Periodic_3_Delaunay_triangulation_3`. -It refines the concept -`DelaunayTriangulationTraits_3` from the \cgal 3D Triangulations. -It redefines the geometric objects, predicates and constructions to -work with point-offset pairs. In most cases the offsets will be -(0,0,0) and the predicates from `DelaunayTriangulationTraits_3` -can be used directly. For efficiency reasons we maintain for each -functor the version without offsets. +The concept `Periodic_3DelaunayTriangulationTraits_3` is the first template parameter +of the class `CGAL::Periodic_3_Delaunay_triangulation_3`. +It refines the concept `DelaunayTriangulationTraits_3` from the +\cgal 3D Triangulations. +It redefines the geometric objects, predicates and constructions to +work with point-offset pairs. In most cases the offsets will be +(0,0,0) and the predicates from `DelaunayTriangulationTraits_3` +can be used directly. For efficiency reasons we maintain for each +functor the version without offsets. \cgalRefines Periodic_3TriangulationTraits_3 \cgalRefines DelaunayTriangulationTraits_3 -\cgalHasModel CGAL::Periodic_3_Delaunay_triangulation_traits_3 +\cgalHasModel CGAL::Periodic_3_Delaunay_triangulation_traits_3 -In addition to the requirements described for the traits class -DelaunayTriangulationTraits_3, the geometric traits class of a -Periodic Delaunay triangulation must fulfill the following +In addition to the requirements described for the traits class +DelaunayTriangulationTraits_3, the geometric traits class of a +Periodic Delaunay triangulation must fulfill the following requirements. \note The optional types must be provided in any case, however they @@ -34,42 +34,42 @@ public: /// @{ /*! -A predicate object that must provide the function operators +A predicate object that must provide the function operators -`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`, +`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`, -which determines on which side of the oriented sphere circumscribing -`p, q, r, s` the point `t` lies and +which determines on which side of the oriented sphere circumscribing +`p, q, r, s` the point `t` lies and -`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_t)`, +`Oriented_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_t)`, -which determines on which side of the oriented sphere circumscribing -`(p,o_p), (q,o_q), (r,o_r), (s,o_s)` the point-offset pair -`(t,o_t)` lies. -\pre `p`, `q`, `r`, `s`, `t` lie inside the domain. -*/ -typedef unspecified_type Side_of_oriented_sphere_3; +which determines on which side of the oriented sphere circumscribing +`(p,o_p), (q,o_q), (r,o_r), (s,o_s)` the point-offset pair +`(t,o_t)` lies. +\pre `p`, `q`, `r`, `s`, `t` lie inside the domain. +*/ +typedef unspecified_type Side_of_oriented_sphere_3; /*! -A predicate object that must provide the function operators +A predicate object that must provide the function operators -`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r)`, +`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r)`, -which compares the distance between `p` and `q` to the distance -between `p` and `r` and +which compares the distance between `p` and `q` to the distance +between `p` and `r` and -`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`, +`Comparison_result operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`, -which compares the distance between `(p,o_p)` and `(q,o_q)` to -the distance between `(p,o_p)` and `(r,o_r)`. -\pre `p`, `q`, `r` lie inside the domain. -*/ -typedef unspecified_type Compare_distance_3; +which compares the distance between `(p,o_p)` and `(q,o_q)` to +the distance between `(p,o_p)` and `(r,o_r)`. +\pre `p`, `q`, `r` lie inside the domain. +*/ +typedef unspecified_type Compare_distance_3; /// @} /// \name -/// In addition, only when vertex removal is used, the traits class must provide the following predicate objects +/// When vertex removal is used, the traits class must in addition provide the following predicate objects /// @{ /*! @@ -110,101 +110,86 @@ typedef unspecified_type Coplanar_side_of_bounded_circle_3; /// @} /// \name -/// In addition, only when `is_Gabriel` is used, the traits class must -/// provide the following predicate object: +/// When `is_Gabriel` is used, the traits class must +/// in addition provide the following predicate object: /// @{ /*! -A predicate object that must provide the function operators +A predicate object that must provide the function operators -`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t)`, +`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t)`, -which returns the position of the point `t` relative to the sphere -that has `pq` as its diameter, +which returns the position of the point `t` relative to the sphere +that has `pq` as its diameter, -`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_t)`, +`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_t)`, -which returns the position of the point-offset pair `(t,o_t)` -relative to the sphere that has `(p,o_p)(q,o_q)` as its diameter, +which returns the position of the point-offset pair `(t,o_t)` +relative to the sphere that has `(p,o_p)(q,o_q)` as its diameter, -`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t)`, +`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t)`, -which returns the position of the point `t` relative to the sphere -passing through `p, q`, and `r` and whose center is in the -plane defined by these three points, +which returns the position of the point `t` relative to the sphere +passing through `p, q`, and `r` and whose center is in the +plane defined by these three points, -`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_q)`, +`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_q)`, -which returns the position of the point-offset pair `(t,o_t)` -relative to the sphere passing through `(p,o_p), (q,o_q)`, and -`(r,o_r)` and whose center is in the plane defined by these three -point-offset pairs, +which returns the position of the point-offset pair `(t,o_t)` +relative to the sphere passing through `(p,o_p), (q,o_q)`, and +`(r,o_r)` and whose center is in the plane defined by these three +point-offset pairs, -`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`, +`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t)`, -which returns the relative position of point `t` to the sphere -defined by `p, q, r`, and `s`; the order of the points `p, q, r`, and `s` does not matter, and +which returns the relative position of point `t` to the sphere +defined by `p, q, r`, and `s`; the order of the points `p, q, r`, and `s` does not matter, and -`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_q)`, +`Bounded_side operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Point_3 t, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_q)`, -which returns the relative position of the point-offset pair -`(t,o_t)` to the sphere defined by `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)`; the order of the point-offset pairs -`(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` does not matter. -\pre `p, q, r`, and `s` are not coplanar, `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` are not coplanar, `p`, `q`, `r`, `s`, `t` lie inside the domain. -*/ -typedef unspecified_type Side_of_bounded_sphere_3; +which returns the relative position of the point-offset pair +`(t,o_t)` to the sphere defined by `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)`; the order of the point-offset pairs +`(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` does not matter. +\pre `p, q, r`, and `s` are not coplanar, `(p,o_p), (q,o_q), (r,o_r)`, and `(s,o_s)` are not coplanar, `p`, `q`, `r`, `s`, `t` lie inside the domain. +*/ +typedef unspecified_type Side_of_bounded_sphere_3; /// @} /// \name -/// In addition, only when the dual operations are used, the traits -/// class must provide the following constructor object: +/// When the dual operations are used, the traits +/// class must in addition provide the following constructor object: /// @{ /*! -A constructor object that must provide the function operators +A constructor object that must provide the function operators -`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`, +`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`, -which constructs the circumcenter of four points and +which constructs the circumcenter of four points and -`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`, +`Point_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`, -which constructs the circumcenter of four point-offset pairs. -\pre `p`, `q`, `r` and `s` as well as `(p,o_p)`, `(q,o_q)`, `(r,o_r)` and `(s,o_s)` must be non coplanar. `p`, `q`, `r`, `s` lie inside the domain. -*/ -typedef unspecified_type Construct_circumcenter_3; +which constructs the circumcenter of four point-offset pairs. +\pre `p`, `q`, `r` and `s` as well as `(p,o_p)`, `(q,o_q)`, `(r,o_r)` and `(s,o_s)` must be non coplanar. `p`, `q`, `r`, `s` lie inside the domain. +*/ +typedef unspecified_type Construct_circumcenter_3; -/// @} +/// @} -/// \name Creation -/// @{ - -/*! -Default constructor. -*/ -Periodic_3_Delaunay_triangulation_traits_3(); - -/*! -Copy constructor. -*/ -Periodic_3_Delaunay_triangulation_traits_3(const Periodic_triangulation_traits_3 & tr); - -/// @} - -/// \name Operations +/// \name Operations /// The following functions give access to the predicate and construction objects: /// @{ /*! -*/ -Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object(); +*/ +Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object(); /*! -*/ -Compare_distance_3 compare_distance_3_object(); +*/ +Compare_distance_3 compare_distance_3_object(); /// @} @@ -227,20 +212,20 @@ coplanar_side_of_bounded_circle_3_object(); /// @} /// \name -/// The following function must be provided only if the `is_Gabriel` +/// The following function must be provided if the `is_Gabriel` /// methods of `Periodic_3_Delaunay_triangulation_3` are used; /// otherwise a dummy function can be provided. /// @{ /*! -*/ -Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object(); +*/ +Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object(); /// @} -/// \name -/// The following function must be provided only if the methods of +/// \name +/// The following function must be provided if the methods of /// `Periodic_3_Delaunay_triangulation_3` returning elements of the /// Voronoi diagram are used; otherwise a dummy function can be /// provided: @@ -248,8 +233,8 @@ Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object(); /*! -*/ -Construct_circumcenter_3 construct_circumcenter_3_object(); +*/ +Construct_circumcenter_3 construct_circumcenter_3_object(); /// @} diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3Offset_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3Offset_3.h index f2507f4e950..5e6cbbdf526 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3Offset_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3Offset_3.h @@ -3,119 +3,120 @@ \ingroup PkgPeriodic3Triangulation3Concepts \cgalConcept -The concept `Periodic_3Offset_3` describes a three-dimensional integer vector -with some specialized access functions and operations. +The concept `Periodic_3Offset_3` describes a three-dimensional integer vector +with some specialized access functions and operations. -\cgalHasModel CGAL::Periodic_3_offset_3 - -\sa `Periodic_3DelaunayTriangulationTraits_3` +\cgalHasModel CGAL::Periodic_3_offset_3 +\sa `Periodic_3TriangulationTraits_3` +\sa `Periodic_3DelaunayTriangulationTraits_3` +\sa `Periodic_3RegularTriangulationTraits_3` */ class Periodic_3Offset_3 { public: -/// \name Creation +/// \name Creation /// @{ /*! -Default constructor. -*/ -Periodic_3Offset_3(); +Default constructor. +*/ +Periodic_3Offset_3(); /*! -Constructs the offset (x,y,z). -*/ -Periodic_3Offset_3(int x, int y, int z); +Constructs the offset (x,y,z). +*/ +Periodic_3Offset_3(int x, int y, int z); -/// @} +/// @} -/// \name Operations +/// \name Operations /// @{ /*! -Return the vector sum of `o` and `other`. -*/ -Periodic_3Offset_3 operator+(const Periodic_3Offset_3 & other) -const; +Return the vector sum of `o` and `other`. +*/ +Periodic_3Offset_3 operator+(const Periodic_3Offset_3 & other) +const; /*! -Return the vector difference of `o` and `other`. -*/ -Periodic_3Offset_3 operator-(const Periodic_3Offset_3 & other) -const; +Return the vector difference of `o` and `other`. +*/ +Periodic_3Offset_3 operator-(const Periodic_3Offset_3 & other) +const; /*! -Return the negative vector of `o`. -*/ -Periodic_3Offset_3 operator-() const; +Return the negative vector of `o`. +*/ +Periodic_3Offset_3 operator-() const; /*! -Add `other` to `o` using vector addition. -*/ -void operator+=(const Periodic_3Offset_3 & other) -const; +Add `other` to `o` using vector addition. +*/ +void operator+=(const Periodic_3Offset_3 & other) +const; /*! -Subtract `other` from `o` using vector subtraction. -*/ -void operator-=(const Periodic_3Offset_3 & other) -const; +Subtract `other` from `o` using vector subtraction. +*/ +void operator-=(const Periodic_3Offset_3 & other) +const; /*! -Return `true` if `other` and `o` represent the same vector. -*/ -bool operator==(const Periodic_3Offset_3 & other) const; +Return `true` if `other` and `o` represent the same vector. +*/ +bool operator==(const Periodic_3Offset_3 & other) const; /*! -Return `true` if `other` and `o` do not represent the same -vector. -*/ -bool operator!=(const Periodic_3Offset_3 & other) const; +Return `true` if `other` and `o` do not represent the same +vector. +*/ +bool operator!=(const Periodic_3Offset_3 & other) const; /*! -Compare `o` and `other` lexicographically. -*/ -bool operator<(const Periodic_3Offset_3 & other) const; +Compare `o` and `other` lexicographically. +*/ +bool operator<(const Periodic_3Offset_3 & other) const; -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Return the \f$ i\f$-th entry of `o`. -*/ -int operator[](int i); +Return the \f$ i\f$-th entry of `o`. +*/ +int operator[](int i); /*! -Return the \f$ x\f$-entry of `o`. -*/ -int x() const; +Return the \f$ x\f$-entry of `o`. +*/ +int x() const; /*! -Return the \f$ y\f$-entry of `o`. -*/ -int y() const; +Return the \f$ y\f$-entry of `o`. +*/ +int y() const; /*! -Return the \f$ z\f$-entry of `o`. -*/ -int z(); +Return the \f$ z\f$-entry of `o`. +*/ +int z(); /*! -Returns `true` if `o` is equal to (0,0,0). -*/ -bool is_null() const; +Returns `true` if `o` is equal to (0,0,0). +*/ +bool is_null() const; /*! -Inputs an offset from `is`. -*/ -istream& operator>>(istream & is, Periodic_3_offset_3 & off); +Inputs an offset from `is`. +*/ +istream& operator>>(istream & is, Periodic_3_offset_3 & off); /*! -Outputs an offset from `os`. -*/ +Outputs an offset from `os`. +*/ ostream& operator<<(ostream & os, Periodic_3_offset_3 & off) const; /// @} diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationDSCellBase_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationDSCellBase_3.h new file mode 100644 index 00000000000..1a511ee7ac7 --- /dev/null +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationDSCellBase_3.h @@ -0,0 +1,26 @@ + +/*! +\ingroup PkgPeriodic3Triangulation3Concepts +\cgalConcept + +\cgalRefines `RegularTriangulationCellBase_3` +\cgalRefines `Periodic_3TriangulationDSCellBase_3` + +\cgalHasModel CGAL::Regular_triangulation_cell_base_3 > +\cgalHasModel CGAL::Regular_triangulation_cell_base_with_weighted_circumcenter_3 > + +The template parameter `Periodic_3RegularTriangulationTraits_3` is expected to be the same as the +traits class used in `CGAL::Periodic_3_regular_triangulation_3`. + +\sa `TriangulationDataStructure_3` +\sa `Periodic_3RegularTriangulationDSVertexBase_3` + +*/ + +class Periodic_3RegularTriangulationDSCellBase_3 { +public: + +}; /* end Periodic_3RegularTriangulationDSCellBase_3 */ + diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationDSVertexBase_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationDSVertexBase_3.h new file mode 100644 index 00000000000..462101711f6 --- /dev/null +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationDSVertexBase_3.h @@ -0,0 +1,24 @@ + +/*! +\ingroup PkgPeriodic3Triangulation3Concepts +\cgalConcept + +\cgalRefines `RegularTriangulationVertexBase_3` +\cgalRefines `Periodic_3TriangulationDSVertexBase_3` + +\cgalHasModel CGAL::Regular_triangulation_vertex_base_3 > + +The template parameter `Periodic_3RegularTriangulationTraits_3` is expected to be the same as the +traits class used in `CGAL::Periodic_3_regular_triangulation_3`. + +\sa `TriangulationDataStructure_3` +\sa `Periodic_3RegularTriangulationDSCellBase_3` + +*/ + +class Periodic_3RegularTriangulationDSVertexBase_3 { +public: + +}; /* end Periodic_3RegularTriangulationDSVertexBase_3 */ + diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationTraits_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationTraits_3.h new file mode 100644 index 00000000000..0c2e6e0d919 --- /dev/null +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3RegularTriangulationTraits_3.h @@ -0,0 +1,222 @@ + +/*! +\ingroup PkgPeriodic3Triangulation3Concepts +\cgalConcept + +The concept `Periodic_3RegularTriangulationTraits_3` is the first template parameter +of the class `CGAL::Periodic_3_regular_triangulation_3`. +It refines the concept +`RegularTriangulationTraits_3` from the \cgal 3D Triangulations. +It redefines the geometric objects, predicates and constructions to +work with point-offset pairs. In most cases the offsets will be +(0,0,0) and the predicates from `RegularTriangulationTraits_3` +can be used directly. For efficiency reasons we maintain for each +functor the version without offsets. + +\cgalRefines Periodic_3TriangulationTraits_3 +\cgalRefines RegularTriangulationTraits_3 + +\cgalHasModel CGAL::Periodic_3_regular_triangulation_traits_3 + +In addition to the requirements described for the traits class +RegularTriangulationTraits_3, the geometric traits class of a +periodic regular triangulation must fulfill the following +requirements. + +\note The optional types must be provided in any case, however they +can be replaced by dummy types if the respective functions are not +used. +*/ +class Periodic_3RegularTriangulationTraits_3 { +public: + +/// \name +/// @{ + +/*! +A predicate object that must provide the function operators: + +`Oriented_side operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s, Weighted_point_3 t)`, + +which determines the position of `t` with respect to the power sphere of `p, q, r, s`. + +`Oriented_side operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s, Weighted_point_3 t, +Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s, Periodic_3_offset_3 o_t)`, + +which is the same for the point-offset pair `(t,o_t)` with respect to the power sphere of the point-offset pairs +`(p,o_p), (q,o_q), (r,o_r), (s,o_s)`. +\pre `p`, `q`, `r`, `s`, `t` lie inside the domain and `p, q, r, s` are not coplanar. + +
    + +When vertex removal is used, the predicate must in addition provide the following function operators: + +`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 t)`, + +which has a definition similar to the previous method, for coplanar points, +with the power circle of `p,q,r`. + +`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 t, +Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_t)`, + +which is the same for point-offset pairs. + +\pre `p`, `q`, `r`, `t` lie inside the domain, `p, q, r` are not collinear, and `p, q, r, t` are coplanar. + + +`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 t)`, + +which is the same for collinear points, and the power segment of `p` and `q`, + +`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 t, +Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_t)`, + +which is the same for point-offset pairs. + +\pre `p`, `q`, `t` lie inside the domain, `p` and `q` have different Bare_points, and `p, q, t` are collinear. + + +`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q)`, + +which is the same for equal points, that is when `p` and `q` +have equal coordinates, then it returns the comparison of the weights. + +`Oriented_side operator()( Weighted_point_3 p, Weighted_point_3 q, +Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`, + +which is the same for point-offset pairs. + +\pre `p` and `q` lie inside the domain and have equal Bare_points. + +*/ +typedef unspecified_type Power_side_of_oriented_power_sphere_3; + +/// @} + +/// \name +/// @{ + +/*! +A predicate object that must provide the function operators: + +`Orientation operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s, FT w)`, + +which compares the weight of the smallest sphere orthogonal to the input weighted +points with the input weight `w` and returns a `SMALLER`, `EQUAL`, or `LARGER`. + +\pre `p`, `q`, `r`, and `s` lie inside the domain. + +*/ +typedef unspecified_type Compare_weighted_squared_radius_3; + +/// @} + +/// \name +/// @{ + +/*! +A predicate object, model of `ComparePowerDistance_3`, that must provide +the function operator + +`Comparison_result operator()(Point_3 p, Weighted_point_3 q, Weighted_point_3 r)`, + +which compares the power distance between `p` and `q` to the power distance +between `p` and `r` and + +`Comparison_result operator()(Point_3 p, Weighted_point_3 q, Weighted_point_3 r, +Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`, + +which is the same for point-offset pairs. + +\note This predicate is required if a call to `nearest_power_vertex()` or +`nearest_power_vertex_in_cell()` is issued.*/ +typedef unspecified_type Compare_power_distance_3; + +/// @} + +/// \name +/// When vertex removal is used, the traits class must in addition provide the following predicate object +/// @{ + +/*! +A predicate object that must provide the function operators: + +`Orientation operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r)`, + +which returns `COLLINEAR`, if the points are collinear; otherwise +it must return a consistent orientation for any three points chosen in +a same plane and + +`Orientation operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, +Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`, + +which is the same for point-offset pairs. +\pre `p`, `q`, `r` lie inside the domain. +*/ +typedef unspecified_type Coplanar_orientation_3; + +/// @} + +/// \name +/// When the dual operations are used, the traits +/// class must in addition provide the following constructor object: +/// @{ + +/*! +A constructor object that must provide the function operators: + +`Weighted_point_3 operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s)`, + +which constructs the weighted circumcenter of four points and + +`Weighted_point_3 operator()(Weighted_point_3 p, Weighted_point_3 q, Weighted_point_3 r, Weighted_point_3 s, +Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`, + +which constructs the weighted circumcenter of four point-offset pairs. +\pre `p`, `q`, `r` and `s` as well as `(p,o_p)`, `(q,o_q)`, `(r,o_r)` and `(s,o_s)` must be non coplanar. `p`, `q`, `r`, `s` lie inside the domain. +*/ +typedef unspecified_type Construct_weighted_circumcenter_3; + +/// @} + +/// \name Operations +/// The following functions give access to the predicate and construction objects: +/// @{ + +/*! + +*/ +Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere_3_object(); + +Compare_weighted_squared_radius_3 compare_weighted_squared_radius_3_object(); + +/// @} + +/// \name +/// The following function must be provided if vertex removal is +/// used; otherwise dummy functions can be provided. +/// @{ + +/*! + +*/ +Coplanar_orientation_3 coplanar_3_orientation_3_object(); + +/// @} + +/// \name +/// The following function must be provided only if the methods of +/// `Periodic_3_regular_triangulation_3` returning elements of the +/// Voronoi diagram are used; otherwise a dummy function can be +/// provided. +/// @{ + +/*! + +*/ +Construct_weighted_circumcenter_3 construct_weighted_circumcenter_3_object(); + +/// @} + +}; /* end Periodic_3RegularTriangulationTraits_3 */ + diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSCellBase_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSCellBase_3.h index 0997fd07c67..4a7eebecefd 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSCellBase_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSCellBase_3.h @@ -6,47 +6,47 @@ A refinement of the concept `TriangulationDSCellBase_3` which adds an API for offsets. -At the base level (see Sections \ref P3Triangulation3secdesign -and \ref TDS3secdesign), a cell stores handles to its four vertices -and to its four neighbor cells. The vertices and neighbors are -indexed 0, 1, 2 and 3. Neighbor `i` lies opposite to vertex `i`. +At the base level (see Sections \ref P3Triangulation3secdesign +and \ref TDS3secdesign), a cell stores handles to its four vertices +and to its four neighbor cells. The vertices and neighbors are +indexed 0, 1, 2 and 3. Neighbor `i` lies opposite to vertex `i`. -For periodic triangulation the cell base class needs to +For periodic triangulations, the cell base class needs to additionally store an offset for each vertex. Only the last three bits of each integer are required to be stored. The remaining part does not contain any information. -\cgalRefines `TriangulationDSCellBase_3` +\cgalRefines `TriangulationDSCellBase_3` -\cgalHasModel CGAL::Periodic_3_triangulation_ds_cell_base_3 +\cgalHasModel CGAL::Periodic_3_triangulation_ds_cell_base_3 -\sa `TriangulationDataStructure_3` -\sa `TriangulationDSCellBase_3` -\sa `Periodic_3TriangulationDSVertexBase_3` +\sa `TriangulationDataStructure_3` +\sa `TriangulationDSCellBase_3` +\sa `Periodic_3TriangulationDSVertexBase_3` */ class Periodic_3TriangulationDSCellBase_3 { public: -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Returns the offset of vertex `i`. -\pre \f$ i \in\{0, 1, 2, 3\}\f$. -*/ -int offset(int i) const; +Returns the offset of vertex `i`. +\pre \f$ i \in\{0, 1, 2, 3\}\f$. +*/ +int offset(int i) const; -/// @} +/// @} -/// \name Setting +/// \name Setting /// @{ /*! -Sets the vertex offsets according to `off0` to `off3`. -*/ -void set_offsets(int off0, int off1, int off2, int off3); +Sets the vertex offsets according to `off0` to `off3`. +*/ +void set_offsets(int off0, int off1, int off2, int off3); /// @} diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSVertexBase_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSVertexBase_3.h index e5394c0ea37..1cf7e9ab938 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSVertexBase_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationDSVertexBase_3.h @@ -3,63 +3,58 @@ \ingroup PkgPeriodic3Triangulation3Concepts \cgalConcept -A refinement of the concept `TriangulationDSVertexBase_3` +A refinement of the concept `TriangulationDSVertexBase_3` which adds an API for offset. -At the base level of 3D-triangulations -(see Sections \ref P3Triangulation3secdesign and \ref TDS3secdesign), -a vertex provides access to one of its incident cells through a handle. +At the base level of 3D-triangulations +(see Sections \ref P3Triangulation3secdesign and \ref TDS3secdesign), +a vertex provides access to one of its incident cells through a handle. +\cgalRefines `TriangulationDSVertexBase_3` +\cgalHasModel CGAL::Periodic_3_triangulation_ds_vertex_base_3 -\cgalRefines `TriangulationDSVertexBase_3` - - - -\cgalHasModel CGAL::Periodic_3_triangulation_ds_vertex_base_3 - -\sa `TriangulationDataStructure_3` -\sa `TriangulationDSVertexBase_3` -\sa `Periodic_3TriangulationDSCellBase_3` +\sa `TriangulationDataStructure_3` +\sa `TriangulationDSVertexBase_3` +\sa `Periodic_3TriangulationDSCellBase_3` */ class Periodic_3TriangulationDSVertexBase_3 { public: -/// \name Types +/// \name Types /// @{ /*! -A model of the concept -`Periodic_3Offset_3` -*/ -typedef unspecified_type Periodic_3_offset_3; +A model of the concept `Periodic_3Offset_3` +*/ +typedef unspecified_type Periodic_3_offset_3; -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Returns the offset stored in the vertex. -*/ -Periodic_3_offset_3 offset() const; +Returns the offset stored in the vertex. +*/ +Periodic_3_offset_3 offset() const; /*! -Returns `true` if the offset has been set, `false` otherwise. -*/ -bool get_offset_flag() const; +Returns `true` if the offset has been set, `false` otherwise. +*/ +bool get_offset_flag() const; /*! -Sets the offset and sets the offset flag to `true`. -*/ -void set_offset(Periodic_3_offset_3 o); +Sets the offset and sets the offset flag to `true`. +*/ +void set_offset(Periodic_3_offset_3 o); /*! -Sets the offset flag to `false` and clears the offset. -*/ -void clear_offset(); +Sets the offset flag to `false` and clears the offset. +*/ +void clear_offset(); /// @} diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationTraits_3.h b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationTraits_3.h index 0c150cc5522..432d500dc78 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationTraits_3.h +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Concepts/Periodic_3TriangulationTraits_3.h @@ -4,19 +4,22 @@ \cgalConcept The concept `Periodic_3TriangulationTraits_3` is the first template parameter of the class -`Periodic_3_triangulation_3`. It refines the concept +`Periodic_3_triangulation_3`. It refines the concept `TriangulationTraits_3` from the \cgal 3D Triangulations. -It redefines the geometric objects, predicates and constructions to -work with point-offset pairs. In most cases the offsets will be +It redefines the geometric objects, predicates and constructions to +work with point-offset pairs. In most cases the offsets will be (0,0,0) and the predicates from `TriangulationTraits_3` -can be used directly. For efficiency reasons we maintain for each -functor the version without offsets. +can be used directly. For efficiency reasons we maintain for each +functor the version without offsets. \cgalRefines TriangulationTraits_3 \cgalHasModel CGAL::Periodic_3_triangulation_traits_3 -In addition to the requirements described for the traits class +\sa Periodic_3DelaunayTriangulationTraits_3 +\sa Periodic_3RegularTriangulationTraits_3 + +In addition to the requirements described for the traits class TriangulationTraits_3, the geometric traits class of a Periodic triangulation must fulfill the following requirements. @@ -24,31 +27,31 @@ requirements. class Periodic_3TriangulationTraits_3 { public: -/// \name Types +/// \name Types /// @{ /*! -The point type. It must be a model of `Kernel::Point_3`. -*/ -typedef unspecified_type Point_3; +The point type. It must be a model of `Kernel::Point_3`. +*/ +typedef unspecified_type Point_3; /*! -The vector type. It must be a model of -`Kernel::Vector_3`. -*/ -typedef unspecified_type Vector_3; +The vector type. It must be a model of +`Kernel::Vector_3`. +*/ +typedef unspecified_type Vector_3; /*! -The offset type. It must be a -model of the concept `Periodic_3Offset_3`. -*/ -typedef unspecified_type Periodic_3_offset_3; +The offset type. It must be a +model of the concept `Periodic_3Offset_3`. +*/ +typedef unspecified_type Periodic_3_offset_3; /*! -A type representing an axis-aligned -cuboid. It must be a model of `Kernel::Iso_cuboid_3`. -*/ -typedef unspecified_type Iso_cuboid_3; +A type representing an axis-aligned +cuboid. It must be a model of `Kernel::Iso_cuboid_3`. +*/ +typedef unspecified_type Iso_cuboid_3; /// @} @@ -60,161 +63,159 @@ typedef unspecified_type Iso_cuboid_3; /// @{ /*! -A segment type. It must be a model of `Kernel::Segment_3`. -*/ -typedef unspecified_type Segment_3; +A segment type. It must be a model of `Kernel::Segment_3`. +*/ +typedef unspecified_type Segment_3; /*! -A triangle type. It must be a model of -`Kernel::Triangle_3`. -*/ -typedef unspecified_type Triangle_3; +A triangle type. It must be a model of +`Kernel::Triangle_3`. +*/ +typedef unspecified_type Triangle_3; /*! -A tetrahedron type. It must be a model -of `Kernel::Tetrahedron_3`. -*/ -typedef unspecified_type Tetrahedron_3; +A tetrahedron type. It must be a model +of `Kernel::Tetrahedron_3`. +*/ +typedef unspecified_type Tetrahedron_3; /*! -A predicate object that must provide the function operators +A predicate object that must provide the function operators -`Comparison_result operator()(Point_3 p, Point_3 q)`, +`Comparison_result operator()(Point_3 p, Point_3 q)`, -which returns `EQUAL` if the two points are equal and +which returns `EQUAL` if the two points are equal and -`Comparison_result operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`, +`Comparison_result operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`, -which returns `EQUAL` if the two point-offset pairs are equal. -Otherwise it must return a consistent order for any two points chosen -in a same line. -\pre `p`, `q` lie inside the domain. -*/ -typedef unspecified_type Compare_xyz_3; +which returns `EQUAL` if the two point-offset pairs are equal. +Otherwise it must return a consistent order for any two points chosen +in a same line. +\pre `p`, `q` lie inside the domain. +*/ +typedef unspecified_type Compare_xyz_3; /*! -A predicate object that must provide the function operators +A predicate object that must provide the function operators -`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`, +`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`, -which returns `POSITIVE`, if `s` lies on the positive side of -the oriented plane `h` defined by `p`, `q`, and `r`, -returns `NEGATIVE` if `s` lies on the negative side of -`h`, and returns `COPLANAR` if `s` lies on `h` and +which returns `POSITIVE`, if `s` lies on the positive side of +the oriented plane `h` defined by `p`, `q`, and `r`, +returns `NEGATIVE` if `s` lies on the negative side of +`h`, and returns `COPLANAR` if `s` lies on `h` and -`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`, +`Orientation operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`, -which returns `POSITIVE`, if the point-offset pair `(s,o_s)` -lies on the positive side of the oriented plane `h` defined by -`(p,o_p)`, `(q,o_q)`, and `(r,o_r)`, -returns `NEGATIVE` if `(s,o_s)` lies on the negative side of -`h`, and returns `COPLANAR` if `(s,o_s)` lies on `h`. -\pre `p`, `q`, `r`, `s` lie inside the domain. -*/ -typedef unspecified_type Orientation_3; +which returns `POSITIVE`, if the point-offset pair `(s,o_s)` +lies on the positive side of the oriented plane `h` defined by +`(p,o_p)`, `(q,o_q)`, and `(r,o_r)`, +returns `NEGATIVE` if `(s,o_s)` lies on the negative side of +`h`, and returns `COPLANAR` if `(s,o_s)` lies on `h`. +\pre `p`, `q`, `r`, `s` lie inside the domain. +*/ +typedef unspecified_type Orientation_3; /// @} -/// \name +/// \name /// Note that the traits must provide exact constructions in order to /// guarantee exactness of the following construction functors. /// @{ /*! -A constructor object that must provide the function operator +A constructor object that must provide the function operator -`Point_3 operator()(Point_3 p, Periodic_3_offset_3 o_p)`, +`Point_3 operator()(Point_3 p, Periodic_3_offset_3 o_p)`, -which constructs a point from a point-offset pair. -\pre `p` lies inside the domain. -*/ -typedef unspecified_type Construct_point_3; +which constructs a point from a point-offset pair. +\pre `p` lies inside the domain. +*/ +typedef unspecified_type Construct_point_3; /*! -A constructor object that must provide the function operators +A constructor object that must provide the function operators -`Segment_3 operator()(Point_3 p, Point_3 q)`, +`Segment_3 operator()(Point_3 p, Point_3 q)`, -which constructs a segment from two points and +which constructs a segment from two points and -`Segment_3 operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`, +`Segment_3 operator()(Point_3 p, Point_3 q, Periodic_3_offset_3 o_p, Periodic_3_offset_3 o_q)`, -which constructs a segment from two point-offset pairs. -\pre `p`, `q` lie inside the domain. -*/ -typedef unspecified_type Construct_segment_3; +which constructs a segment from two point-offset pairs. +\pre `p`, `q` lie inside the domain. +*/ +typedef unspecified_type Construct_segment_3; /*! -A constructor object that must provide the function operators +A constructor object that must provide the function operators -`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r )`, +`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r )`, -which constructs a triangle from three points and +which constructs a triangle from three points and -`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`, +`Triangle_3 operator()(Point_3 p, Point_3 q, Point_3 r, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r)`, -which constructs a triangle from three point-offset pairs. -\pre `p`, `q`, `r` lie inside the domain. -*/ -typedef unspecified_type Construct_triangle_3; +which constructs a triangle from three point-offset pairs. +\pre `p`, `q`, `r` lie inside the domain. +*/ +typedef unspecified_type Construct_triangle_3; /*! -A constructor object that must provide the function operators +A constructor object that must provide the function operators -`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`, +`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s)`, -which constructs a tetrahedron from four points and +which constructs a tetrahedron from four points and -`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`, +`Tetrahedron_3 operator()(Point_3 p, Point_3 q, Point_3 r, Point_3 s, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_q, Periodic_3_offset_3 o_r, Periodic_3_offset_3 o_s)`, -which constructs a tetrahedron from four point-offset pairs. -\pre `p`, `q`, `r`, `s` lie inside the domain. -*/ -typedef unspecified_type Construct_tetrahedron_3; +which constructs a tetrahedron from four point-offset pairs. +\pre `p`, `q`, `r`, `s` lie inside the domain. +*/ +typedef unspecified_type Construct_tetrahedron_3; /// @} -/// \name Creation +/// \name Creation /// @{ /*! -Default constructor. -*/ +Default constructor. +*/ Periodic_3_triangulation_traits_3(); /*! -Copy constructor. -*/ +Copy constructor. +*/ Periodic_3_triangulation_traits_3(const Periodic_triangulation_traits_3 & tr); -/// @} +/// @} -/// \name Access Functions +/// \name Access Functions /// @{ /*! -Set the size of the -fundamental domain. This is necessary to evaluate predicates -correctly. -\pre `domain` represents a cube. -*/ -void set_domain(Iso_cuboid_3 domain); +Set the fundamental domain. This is necessary to evaluate predicates correctly. +\pre `domain` represents a cube. +*/ +void set_domain(const Iso_cuboid_3& domain); -/// @} +/// @} -/// \name Operations +/// \name Operations /// The following functions give access to the predicate and construction objects: /// @{ /*! -*/ -Compare_xyz_3 compare_xyz_3_object(); +*/ +Compare_xyz_3 compare_xyz_3_object(); /*! -*/ -Orientation_3 orientation_3_object(); +*/ +Orientation_3 orientation_3_object(); /// @} @@ -222,18 +223,18 @@ Orientation_3 orientation_3_object(); /*! -*/ -Construct_segment_3 construct_segment_3_object(); +*/ +Construct_segment_3 construct_segment_3_object(); /*! -*/ -Construct_triangle_3 construct_triangle_3_object(); +*/ +Construct_triangle_3 construct_triangle_3_object(); /*! -*/ -Construct_tetrahedron_3 construct_tetrahedron_3_object(); +*/ +Construct_tetrahedron_3 construct_tetrahedron_3_object(); /// @} diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/PackageDescription.txt b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/PackageDescription.txt index 898061a78e1..10ba236de93 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/PackageDescription.txt +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/PackageDescription.txt @@ -11,12 +11,16 @@ /*! \addtogroup PkgPeriodic3Triangulation3 -\todo check generated documentation + \cgalPkgDescriptionBegin{3D Periodic Triangulations,PkgPeriodic3Triangulation3Summary} \cgalPkgPicture{p3Delaunay3_small.jpg} \cgalPkgSummaryBegin -\cgalPkgAuthors{Manuel Caroli and Monique Teillaud} -\cgalPkgDesc{This package allows to build and handle triangulations of point sets in the three dimensional flat torus. Triangulations are built incrementally and can be modified by insertion or removal of vertices. They offer point location facilities. The package provides Delaunay triangulations and offers nearest neighbor queries and primitives to build the dual Voronoi diagrams.} +\cgalPkgAuthors{Manuel Caroli, Aymeric Pellé, Mael Rouxel-Labbé, and Monique Teillaud} +\cgalPkgDesc{This package allows to build and handle triangulations of point sets +in the three dimensional flat torus. Triangulations are built incrementally and +can be modified by insertion or removal of vertices. They offer point location +facilities. The package provides Delaunay and regular triangulations and offers +nearest neighbor queries and primitives to build the dual Voronoi diagrams.} \cgalPkgManuals{Chapter_3D_Periodic_Triangulations,PkgPeriodic3Triangulation3} \cgalPkgSummaryEnd \cgalPkgShortInfoBegin @@ -29,23 +33,24 @@ \cgalPkgDescriptionEnd The main classes of the 3D Periodic Triangulation package are -`CGAL::Periodic_3_triangulation_3` and -`CGAL::Periodic_3_Delaunay_triangulation_3`. They contain functionality +`CGAL::Periodic_3_triangulation_3`, +`CGAL::Periodic_3_Delaunay_triangulation_3`, +and `CGAL::Periodic_3_regular_triangulation_3`. + They contain functionality to access triangulations and to run queries on them. `CGAL::Periodic_3_Delaunay_triangulation_3` can construct and -modify Delaunay triangulations. It takes the geometric traits as well +modify Delaunay triangulations, while +`CGAL::Periodic_3_regular_triangulation_3` can do it for weighted Delaunay +triangulations. They take the geometric traits as well as the triangulation data structure as template parameters. -The geometric traits class must be a model of the concept -`Periodic_3DelaunayTriangulationTraits_3` for periodic Delaunay triangulations, -or `Periodic_3TriangulationTraits_3` for periodic triangulations. It must contains all -predicates and constructions that are needed by the functions in the -triangulation classes. +The geometric traits class of each triangulation class must be a model +of its associated concept, i.e., it must contain all +predicates and constructions that are needed by the +triangulation class. The package uses `CGAL::Triangulation_data_structure_3` to represent the -triangulation. The cells and vertices need to be models of the -concepts `Periodic_3TriangulationDSCellBase_3` and -`Periodic_3TriangulationDSVertexBase_3`, respectively. +triangulation. A triangulation is stored as a collection of vertices and cells that are linked together through incidence and adjacency relations. Each cell gives access to its four incident vertices and to its four @@ -70,9 +75,16 @@ of the concept `Periodic_3Offset_3`. - `Periodic_3TriangulationTraits_3` - `Periodic_3DelaunayTriangulationTraits_3` + +- `Periodic_3RegularTriangulationTraits_3` + - `TriangulationDataStructure_3` -- `Periodic_3TriangulationDSCellBase_3` - `Periodic_3TriangulationDSVertexBase_3` +- `Periodic_3TriangulationDSCellBase_3` + +- `Periodic_3RegularTriangulationDSCellBase_3` +- `Periodic_3RegularTriangulationDSVertexBase_3` + - `Periodic_3Offset_3` ## Classes ## @@ -81,15 +93,19 @@ of the concept `Periodic_3Offset_3`. - `CGAL::Periodic_3_triangulation_3` - `CGAL::Periodic_3_Delaunay_triangulation_3` + +- `CGAL::Periodic_3_regular_triangulation_3` + - `CGAL::Periodic_3_triangulation_hierarchy_3` -- `CGAL::Periodic_3_triangulation_ds_cell_base_3<>` - `CGAL::Periodic_3_triangulation_ds_vertex_base_3<>` +- `CGAL::Periodic_3_triangulation_ds_cell_base_3<>` - `CGAL::Periodic_3_offset_3` ### Traits Classes ### - `CGAL::Periodic_3_triangulation_traits_3` - `CGAL::Periodic_3_Delaunay_triangulation_traits_3` +- `CGAL::Periodic_3_regular_triangulation_traits_3` ## Enums ## diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Periodic_3_triangulation_3.txt b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Periodic_3_triangulation_3.txt index 7516e2b338e..65efd89d0e9 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Periodic_3_triangulation_3.txt +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/Periodic_3_triangulation_3.txt @@ -1,13 +1,13 @@ namespace CGAL { /*! -\mainpage User Manual +\mainpage User Manual \anchor Chapter_3D_Periodic_Triangulations \anchor chapterP3Triangulation3 \cgalAutoToc -\authors Manuel Caroli and Monique Teillaud +\authors Manuel Caroli, Aymeric Pellé, Mael Rouxel-Labbé and Monique Teillaud \image html p3Delaunay3.jpg \image latex p3Delaunay3.jpg @@ -21,7 +21,7 @@ contains all incident \f$ j\f$-simplices (\f$ jvertex, edge, facet, and cell, respectively. -\section P3Triangulation3secspace The Flat Torus +\section P3Triangulation3secspace The Flat Torus The 3D Periodic Triangulation package computes triangulations in the space \f$ \mathbb T_c^3\f$, which is defined as follows: Let \f$ c\in\mathbb @@ -32,12 +32,12 @@ R^3/G\f$. The parameter \f$ c\f$ defines the period. The elements of \f$ \mathbb T_c^3\f$ are the equivalence classes of sets of points in \f$ \mathbb R^3\f$. We call these points representatives -of an element of \f$ \mathbb +of an element of \f$ \mathbb T_c^3\f$. The implementation works not directly on elements of \f$ \mathbb T_c^3\f$ but on some representatives in \f$ \mathbb R^3\f$. So there need to be distinguished representatives to work on. Given \f$ \alpha\f$, \f$ \beta\f$, and \f$ \gamma\f$, the cube -\f$ [\alpha,\alpha+c)\times[\beta,\beta+c)\times[\gamma,\gamma+c)\f$ +\f$ [\alpha,\alpha+c)\times[\beta,\beta+c)\times[\gamma,\gamma+c)\f$ contains exactly one representative of each element in \f$ \mathbb T_c^3\f$. We call it original domain. From now on, when we talk about points, we generally mean representatives of elements @@ -49,7 +49,7 @@ There are simplices containing points inside the original domain but also points outside it. The points outside the original domain are periodic copies of points inside the original domain. So, to specify a simplex we need points together with some additional -information that determines the respective periodic copy of each point. +information that determines the respective periodic copy of each point. The set of representatives of an element of \f$ \mathbb T_c^3\f$ is a cubic point grid. We address each representative by a three-dimensional integer vector \f$ (o_x,o_y,o_z)\f$, called offset. It @@ -63,7 +63,7 @@ domain. To specify a \f$ k\f$-simplex we need \f$ k+1\f$ point-offset pairs Offsets in a cell. \cgalFigureEnd -\section P3Triangulation3secintro Representation +\section P3Triangulation3secintro Representation A triangulation is a collection of vertices and cells that are linked together through incidence and adjacency relations. Each cell gives @@ -120,7 +120,7 @@ the 27-sheeted covering space to the 1-sheeted covering space, the `Vertex_handl `Cell_handle`s referencing deleted items become invalid. In the data structure each vertex stores the input point it -corresponds to. If we are computing in the 27-sheeted covering +corresponds to. If we are computing in the 27-sheeted covering space, each vertex stores the representative inside the original domain it corresponds to. So, the 27 vertices corresponding to the same element of \f$ \mathbb T_c^3\f$ all store the same @@ -131,7 +131,7 @@ representative in \f$ \mathbb R^3\f$, and not different periodic copies. A periodic triangulation is said to be `locally valid` iff (a)-(b) Its underlying combinatorial graph, the triangulation -data structure, is `locally valid` +data structure, is `locally valid` (see Section \ref TDS3secintro of Chapter \ref chapterTDS3 "3D Triangulation Data Structure") (c) Any cell has its vertices ordered according to positive @@ -146,11 +146,28 @@ Delaunay triangulations have the empty sphere property, that is, the circumscribing sphere of each cell does not contain any other vertex of the triangulation in its interior. These triangulations are uniquely defined except in degenerate cases where -five points are co-spherical. Note however that the \cgal implementation computes a unique triangulation even in these cases +five points are co-spherical. Note however that the \cgal +implementation computes a uniquely defined triangulation even in these cases \cgalCite{cgal:dt-pvr3d-03}. -This implementation is fully dynamic: it supports both insertions of -points and vertex removal. +This implementation is fully dynamic: it supports both point insertion +and vertex removal. + +\section Periodic_3_triangulation_3regular Regular Triangulation + +The class `Periodic_3_regular_triangulation_3` implements regular +triangulations, also known as weighted Delaunay triangulations, of +point sets in \f$ \mathbb T_c^3\f$. + +A regular triangulation is a triangulation in which the power sphere +of each simplex is regular. See Section +\ref Triangulation3secclassRegulartriangulation for a complete +definition. +As for Delaunay triangulations, \cgal computes a uniquely defined +regular triangulation even in degenerate cases \cgalCite{cgal:dt-pvrdr-06}. + +The implementation is fully dynamic: it supports both point insertion +and vertex removal. \section Periodic_3_triangulation_3Triangulation Triangulation Hierarchy @@ -158,107 +175,121 @@ The class `Periodic_3_triangulation_hierarchy_3` is the adaptation of the hierarchical structure described in chapter \ref chapterTriangulation3 "3D Triangulations" to the periodic case. -\section P3Triangulation3secdesign Software Design +\section P3Triangulation3secdesign Software Design We have chosen the prefix "Periodic_3" to emphasize that the triangulation is periodic in all three directions of space. -The two main classes `Periodic_3_Delaunay_triangulation_3` and -`Periodic_3_triangulation_3` provide high-level geometric -functionality and are responsible for the geometric validity. -`Periodic_3_Delaunay_triangulation_3` contains all the -functionality that is special to Delaunay triangulations, such as -point insertion and vertex removal, the side-of-sphere test, finding -the conflicting region of a given point, dual functions etc. -`Periodic_3_triangulation_3` contains all the functionality -that is common to triangulations in general, such as location of a -point in the triangulation \cgalCite{cgal:dpt-wt-02}, access functions, -geometric queries like the orientation test etc. - +The main classes `Periodic_3_triangulation_3`, +`Periodic_3_Delaunay_triangulation_3`, and `Periodic_3_regular_triangulation_3` +provide high-level geometric functionality and are responsible +for the geometric validity. They are built as layers on top of a triangulation data structure, which stores their combinatorial structure. This separation between the geometry and the combinatorics is reflected in the software design by the fact that the triangulation classes take two template -parameters: +parameters:
    • the geometric traits class, which provides the type of points to use as well as the elementary operations on them (predicates and constructions). Furthermore it contains the offset type. -The concept for this parameter is described in more -detail in the section \ref P3Triangulation3secTraits -and models of one of the two concepts `Periodic_3DelaunayTriangulationTraits_3` -and `Periodic_3TriangulationTraits_3` can be used for this parameter. +The concept and models for this parameter are described in more +detail in Section \ref P3Triangulation3secTraits.
    • the triangulation data structure class, which stores the combinatorial structure, described in -Section \ref P3Triangulation3sectds and in more detail in -Chapter \ref chapterTDS3 "3D Triangulation Data Structure". The triangulation data structure needs -models of the concepts `Periodic_3TriangulationDSCellBase_3` and -`Periodic_3TriangulationDSVertexBase_3` as template parameters. +Section \ref P3Triangulation3sectds.
    -\subsection P3Triangulation3secTraits The Geometric Traits Parameter +The class `Periodic_3_triangulation_3` contains all the functionality +that is common to triangulations in general, such as location of a +point in the triangulation \cgalCite{cgal:dpt-wt-02}, access functions, +geometric queries like the orientation test etc. +The class `Periodic_3_Delaunay_triangulation_3` contains all the +functionality that is specific to Delaunay triangulations, such as +point insertion and vertex removal, the side-of-sphere test, finding +the conflicting region of a given point, computation of dual functions, etc. +The class `Periodic_3_regular_triangulation_3` does the same for regular +triangulations. -\subsubsection P3Triangulation3secTraitsP3T3 Traits for Periodic Triangulations +\subsection P3Triangulation3secTraits The Geometric Traits Parameter + +\subsubsection P3Triangulation3secTraitsP3T3 Traits for Periodic Triangulations The first template parameter of the triangulation class `Periodic_3_triangulation_3` is the geometric traits class, described by the concept `Periodic_3TriangulationTraits_3`. It is different to the TriangulationTraits_3 (see -chapter \ref Triangulation3secTraits "3D Triangulations") in that it -implements all objects, predicates and constructions with -using offsets. +chapter \ref Triangulation3secTraits "3D Triangulations") in that it +implements all objects, predicates and constructions using offsets. The class `Periodic_3_triangulation_traits_3` provides the required functionality. It expects two template -parameters: A model of the concept `TriangulationTraits_3` +parameters: a model of the concept `TriangulationTraits_3` and a model of the concept `Periodic_3Offset_3`. The second parameter `Periodic_3Offset_3` defaults to `Periodic_3_offset_3`. -\subsubsection P3Triangulation3secTraitsP3DT3 Traits for Periodic Delaunay Triangulations +\subsubsection P3Triangulation3secTraitsP3DT3 Traits for Periodic Delaunay Triangulations The first template parameter of the Delaunay triangulation class `Periodic_3_Delaunay_triangulation_3` is the geometric traits class, described by the concept `Periodic_3DelaunayTriangulationTraits_3`. It is different to the DelaunayTriangulationTraits_3 (see -chapter \ref Triangulation3secTraits "3D Triangulations") in that it -implements all objects, predicates and constructions with -using offsets. +chapter \ref Triangulation3secTraits "3D Triangulations") in that it +implements all objects, predicates and constructions using offsets. The class `Periodic_3_Delaunay_triangulation_traits_3` provides the required functionality. It expects two template -parameters: A model of the concept `DelaunayTriangulationTraits_3` +parameters: a model of the concept `DelaunayTriangulationTraits_3` and a model of the concept `Periodic_3Offset_3`. The second parameter `Periodic_3Offset_3` defaults to `Periodic_3_offset_3`. + +\subsubsection P3Triangulation3secTraitsP3regularT3 Traits for Periodic Regular Triangulations + +The first template parameter of the regular triangulation class +`Periodic_3_regular_triangulation_3` +is the geometric traits class, described by the concept +`Periodic_3RegularTriangulationTraits_3`. It is different to the +RegularTriangulationTraits_3 (see +chapter \ref Triangulation3secTraits "3D Triangulations") in that it +implements all objects, predicates and constructions using offsets. + +The class `Periodic_3_regular_triangulation_traits_3` +provides the required functionality. It expects two template +parameters: a model of the concept `RegularTriangulationTraits_3` +and a model of the concept `Periodic_3Offset_3`. + +The second parameter `Periodic_3Offset_3` defaults to +`Periodic_3_offset_3`. + + \subsubsection P3Triangulation3secTraitsK Compatible Kernels The kernels `Cartesian`, `Homogeneous`, `Simple_cartesian`, `Simple_homogeneous` and -`Filtered_kernel` can all be used as models for -`TriangulationTraits_3` and `DelaunayTriangulationTraits_3`. -`Periodic_3_triangulation_traits_3` and `Periodic_3_Delaunay_triangulation_traits_3` provide exact -predicates and exact constructions if `TriangulationTraits_3` and `DelaunayTriangulationTraits_3` do. They provide -exact predicates but not exact constructions if +`Filtered_kernel` can all be used as models of the concepts +`TriangulationTraits_3`, `DelaunayTriangulationTraits_3`, and +`RegularTriangulationTraits_3`. +The periodic triangulation classes provide exact +predicates and exact constructions if these respective template parameters +do. They provide exact predicates but not exact constructions if `Filtered_kernel` with `CK` an inexact kernel is used as -their first template parameter. Using -`Exact_predicates_inexact_constructions_kernel` as -`Traits` provides fast and exact predicates and not exact constructions, +template parameter. Using `Exact_predicates_inexact_constructions_kernel` +provides fast and exact predicates and not exact constructions, using `Exact_predicates_exact_constructions_kernel` provides fast and exact predicates and exact constructions. The latter is recommended if the dual constructions and constructions of points, segments, triangles, and tetrahedra are used. -\subsection P3Triangulation3sectds The Triangulation Data Structure Parameter +\subsection P3Triangulation3sectds The Triangulation Data Structure Parameter -The second template parameter of the main classes -`Periodic_3_triangulation_3` and -`Periodic_3_Delaunay_triangulation_3` is a +The second template parameter of the periodic triangulation classes is a triangulation data structure class. This class can be seen as a container for the cells and vertices maintaining incidence and adjacency relations (see Chapter \ref chapterTDS3 "3D Triangulation Data Structure"). A model of this triangulation data structure is @@ -279,22 +310,22 @@ structure or a different vertex or cell base class. \subsection Periodic_3_triangulation_3Flexibilityofthe Flexibility of the Design -`Periodic_3_triangulation_3` uses the -`TriangulationDataStructure_3` in essentially the same way as -`Triangulation_3`. That is why the flexibility described in -\ref Triangulation3secdesign is applicable in exactly the same -way. Also the classes `Triangulation_vertex_base_with_info_3` and +The class `Periodic_3_triangulation_3` uses the +`TriangulationDataStructure_3` in essentially the same way as the class +`Triangulation_3` and the flexibility described in +\ref Triangulation3secdesign is therefore applicable in exactly the same +way. Furthermore, the classes `Triangulation_vertex_base_with_info_3` and `Triangulation_cell_base_with_info_3` can be reused directly, see -also Example \ref P3Triangulation3secexamplescolor. +Example \ref P3Triangulation3secexamplescolor. -\section P3Triangulation3secexamples Examples +\section P3Triangulation3secexamples Examples \subsection Periodic_3_triangulation_3BasicExample Basic Example This example shows the incremental construction of a 3D Delaunay triangulation, the location of a point and how to perform elementary operations on indices in a cell. It uses the default parameter of the -`Periodic_3_Delaunay_triangulation_3` class for the triangulation +class `Periodic_3_Delaunay_triangulation_3` for the triangulation data structure. \cgalExample{Periodic_3_triangulation_3/simple_example.cpp} @@ -304,7 +335,7 @@ data structure. The following two examples show how the user can plug his own vertex base in a triangulation. Changing the cell base is similar. -\subsection P3Triangulation3secexamplescolor Adding a Color +\subsubsection P3Triangulation3secexamplescolor Adding a Color If the user does not need to add a type in a vertex that depends on the `TriangulationDataStructure_3` (e.g. a `Vertex_handle` or @@ -315,7 +346,7 @@ this way. \cgalExample{Periodic_3_triangulation_3/colored_vertices.cpp} -\subsection Periodic_3_triangulation_3AddingHandles Adding Handles +\subsubsection Periodic_3_triangulation_3AddingHandles Adding Handles If the user needs to add a type in a vertex that depends on the `TriangulationDataStructure_3` (e.g. a `Vertex_handle` or @@ -328,48 +359,46 @@ as the following example shows. The user can check at any time whether a triangulation would be a simplicial complex in \f$ \mathbb T_c^3\f$ and force a conversion if -so. However this should be done very carefully in order to be sure +so. However, this should be done very carefully in order to ensure that the internal structure always remains a simplicial complex and thus a triangulation. -In this example we construct a triangulation that can be converted to +In this example, we construct a triangulation that can be converted to the 1-sheeted covering space. However, we can insert new points such that the point set does not have a Delaunay triangulation in the 1-sheeted -covering space anymore, so the triangulation is not extensible. +covering space anymore, rendering the triangulation not extensible. \cgalExample{Periodic_3_triangulation_3/covering.cpp} \subsection Periodic_3_triangulation_3LargePointSet Large Point Set -For large point sets there are two optimizations available. Firstly, -there is spatial sorting that sorts the input points according to a +Two optimizations are available for large point sets. Firstly, +spatial sorting can be used to sort the input points according to a Hilbert curve, see chapter \ref secspatial_sorting "Spatial Sorting". -The second one inserts 36 appropriately chosen dummy points to avoid -the use of a 27-sheeted covering space in the beginning. The 36 dummy +Secondly, 36 appropriately chosen dummy points can be inserted to avoid +the use of a 27-sheeted covering space in the beginning. These 36 dummy points are deleted in the end. If the point set turns out to not have a Delaunay triangulation in the 1-sheeted covering space, the triangulation is converted to the 27-sheeted covering space during the removal of the 36 dummy -points. This might take even longer than computing the triangulation +points. Note that this might take even longer than computing the triangulation without using this optimization. In general, uniformly distributed random point sets of more than 1000 points have a Delaunay triangulation in the 1-sheeted covering space. -It is recommended to run this example only when compiled in release -mode because of the relatively large number of points. +The following example illustrates the use of these optimization techniques. \cgalExample{Periodic_3_triangulation_3/large_point_set.cpp} \subsection Periodic_3_triangulation_3GeometricAccess Geometric Access -There might be applications that need the geometric primitives of a -triangulation as an input but do not require a simplicial complex. For -these cases we provide the geometric iterators that return only the +Some application might use the geometric primitives of a +triangulation as an input but not require a simplicial complex. We provide +for these cases the geometric iterators that return only the geometric primitives fulfilling some properties. In the following -example we use the `Periodic_3_triangulation_3::Periodic_triangle_iterator` with the option -`UNIQUE_COVER_DOMAIN`. This means that only those triangles are -returned that have a non-empty intersection with the original domain -of the 1-sheeted covering space, see -Figure \ref P3Triangulation3figgeom_iterators. +example, we use the `Periodic_3_triangulation_3::Periodic_triangle_iterator` +with the option `UNIQUE_COVER_DOMAIN`. This means that only the triangles that +have a non-empty intersection with the original domain of the 1-sheeted covering +space are returned, see Figure \ref P3Triangulation3figgeom_iterators. The `Periodic_3_triangulation_3::Periodic_triangle` is actually a three-dimensional array of point-offset pairs. We check for all three entries of the periodic triangle whether the offset is (0,0,0) using the @@ -379,6 +408,51 @@ exact. \cgalExample{Periodic_3_triangulation_3/geometric_access.cpp} +\subsection Periodic_3_triangulation_3PeriodicRegularTriangulations Periodic Regular Triangulations + +The following five examples illustrate various features of 3D periodic +regular triangulations. + +\subsubsection Periodic_3_triangulation_3P3TR3FirstExample Basic example + +This example shows the incremental construction of a 3D Delaunay +triangulation, the location of a point and how to perform elementary +operations on indices in a cell. It uses the default parameter of the +class `Periodic_3_regular_triangulation_3` for the triangulation +data structure. + +\cgalExample{Periodic_3_triangulation_3/simple_regular_example.cpp} + +\subsubsection Periodic_3_triangulation_3P3TR3PointInsertionAndVertexRemoval Point Insertion and Vertex Removal + +This example shows the incremental construction of a 3D regular triangulation, +and the removal of a vertex. It uses the default parameter of the +`Periodic_3_regular_triangulation_3` class for the triangulation data structure. + +\cgalExample{Periodic_3_triangulation_3/p3rt3_insert_remove.cpp} + +\subsubsection Periodic_3_triangulation_3P3TR3SecondExample Data Structure + +This example shows the incremental construction of a 3D regular triangulation. +It uses a more appropriate triangulation data structure, which saves some memory resources. + +\cgalExample{Periodic_3_triangulation_3/p3rt3_insert_only.cpp} + +\subsubsection Periodic_3_triangulation_3P3TR3ThirdExample Hidden Points + +This example shows that points can be hidden during the incremental construction +of a 3D regular triangulation. + +\cgalExample{Periodic_3_triangulation_3/p3rt3_hidden_points.cpp} + +\subsubsection Periodic_3_triangulation_3P3TR3FourthExample Bad Weights + +Finally, this example shows how points whose weight does not +satisfy the precondition are handled during the incremental construction +of a 3D regular triangulation. + +\cgalExample{Periodic_3_triangulation_3/p3rt3_insert_point_with_bad_weight.cpp} + \subsection Periodic_3_triangulation_3PeriodicAlphaShapes Periodic Alpha Shapes It is possible to use the class `Periodic_3_Delaunay_triangulation_3` @@ -395,9 +469,12 @@ In 2007, Manuel Caroli continued work on the algorithms \cgalCite{cgal:ct-c3pt-09} and on the package with Monique Teillaud. +In 2015, Aymeric Pellé contributed to adding regular triangulations in +the package. + The package follows the design of the 3D Triangulations package (see Chapter \ref Chapter_3D_Triangulations "3D Triangulations"). -*/ +*/ } /* namespace CGAL */ diff --git a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/examples.txt b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/examples.txt index 6f330801abf..ad00038d8be 100644 --- a/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/examples.txt +++ b/Periodic_3_triangulation_3/doc/Periodic_3_triangulation_3/examples.txt @@ -1,8 +1,13 @@ /*! \example Periodic_3_triangulation_3/simple_example.cpp +\example Periodic_3_triangulation_3/simple_regular_example.cpp \example Periodic_3_triangulation_3/colored_vertices.cpp \example Periodic_3_triangulation_3/periodic_adding_handles.cpp \example Periodic_3_triangulation_3/covering.cpp \example Periodic_3_triangulation_3/large_point_set.cpp \example Periodic_3_triangulation_3/geometric_access.cpp +\example Periodic_3_triangulation_3/p3rt3_insert_remove.cpp +\example Periodic_3_triangulation_3/p3rt3_insert_only.cpp +\example Periodic_3_triangulation_3/p3rt3_hidden_points.cpp +\example Periodic_3_triangulation_3/p3rt3_insert_point_with_bad_weight.cpp /h*/ diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/README b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/README index 4589c446242..3396740a56e 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/README +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/README @@ -51,3 +51,32 @@ example demonstrates how to use the geometric access functions. ------------------------------------------------------------------------------- +------- p3rt3_insert_remove ------------------------------------------------------ + +This example shows the incremental construction of a 3D regular triangulation, +and the removal of a vextex. It uses the default parameter of the Periodic_3_regular_triangulation_3 +class for the triangulation data structure. + +------------------------------------------------------------------------------- + +------- p3rt3_insert_only ------------------------------------------------------ + +This example shows the incremental construction of a 3D regular triangulation. +It uses a more appropriate triangulation data structure, which saves some memory resources. + +------------------------------------------------------------------------------- + +------- p3rt3_hidden_points ------------------------------------------------------ + +This example shows that points can be hidden during the incremental construction +of a 3D regular triangulation. + +------------------------------------------------------------------------------- + +------- p3rt3_insert_point_with_bad_weight ------------------------------------------------------ + +This example shows how points whose weight does not +satisfy the precondition are handled during the incremental construction +of a 3D regular triangulation. + +------------------------------------------------------------------------------- diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/colored_vertices.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/colored_vertices.cpp index f5ff88839bd..aa9cd4e4225 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/colored_vertices.cpp +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/colored_vertices.cpp @@ -1,27 +1,29 @@ #include + #include #include #include + #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 GT; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 Gt; typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS; -typedef CGAL::Triangulation_vertex_base_3 Vb; +typedef CGAL::Triangulation_vertex_base_3 Vb; typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS; -typedef CGAL::Triangulation_cell_base_3 Cb; +typedef CGAL::Triangulation_cell_base_3 Cb; -typedef CGAL::Triangulation_vertex_base_with_info_3 VbInfo; -typedef CGAL::Triangulation_data_structure_3 TDS; -typedef CGAL::Periodic_3_Delaunay_triangulation_3 PDT; +typedef CGAL::Triangulation_vertex_base_with_info_3 VbInfo; +typedef CGAL::Triangulation_data_structure_3 TDS; +typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; -typedef PDT::Point Point; +typedef P3DT3::Point Point; -int main() +int main(int, char**) { - PDT T; + P3DT3 T; T.insert(Point(0,0,0)); T.insert(Point(.1,0,0)); @@ -31,10 +33,12 @@ int main() T.insert(Point(.9,0,.1)); // Set the color of finite vertices of degree 6 to red. - PDT::Vertex_iterator vit; - for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit) - if (T.degree(vit) == 6) + P3DT3::Vertex_iterator vit; + for (vit = T.vertices_begin(); vit != T.vertices_end(); ++vit) { + if (T.degree(vit) == 16) { vit->info() = CGAL::RED; + } + } return 0; } diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/covering.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/covering.cpp index 34300050f41..f84ab7db901 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/covering.cpp +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/covering.cpp @@ -1,38 +1,40 @@ #include + #include #include #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 GT; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; -typedef CGAL::Periodic_3_Delaunay_triangulation_3 PDT; +typedef P3DT3::Point Point; +typedef P3DT3::Covering_sheets Covering_sheets; -typedef PDT::Point Point; -typedef PDT::Covering_sheets Covering_sheets; - -int main() +int main(int, char**) { - PDT T; + P3DT3 T; // Input point grid (27 points) for (double x=0. ; x < .9 ; x += 0.33) { for (double y=0. ; y < .9 ; y += 0.33) { for (double z=0. ; z < .9 ; z += 0.33) { - T.insert(Point(x,y,z)); - } } } + T.insert(Point(x,y,z)); + } + } + } Covering_sheets cs = T.number_of_sheets(); std::cout<<"Current covering: "< + #include #include + #include #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 GT; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; -typedef CGAL::Periodic_3_Delaunay_triangulation_3 Delaunay; -typedef Delaunay::Point Point; -typedef Delaunay::Cell_handle Cell_handle; -typedef Delaunay::Facet Facet; +typedef P3DT3::Point Point; +typedef P3DT3::Cell_handle Cell_handle; +typedef P3DT3::Facet Facet; int main() { - Delaunay T; + P3DT3 T; CGAL::Random_points_in_cube_3 rnd(0.5); - GT::Vector_3 v(0.5,0.5,0.5); + Gt::Vector_3 v(0.5,0.5,0.5); // First, make sure the triangulation is 3D. T.insert(Point(0,0,0)); @@ -32,10 +34,10 @@ int main() Point p = (*rnd++)+v; // Locate the point - Delaunay::Locate_type lt; + P3DT3::Locate_type lt; int li, lj; Cell_handle c = T.locate(p, lt, li, lj); - if (lt == Delaunay::VERTEX) + if (lt == P3DT3::VERTEX) continue; // Point already exists // Get the cells that conflict with p in a vector V, @@ -44,8 +46,8 @@ int main() Facet f; T.find_conflicts(p, c, - CGAL::Oneset_iterator(f), // Get one boundary facet - std::back_inserter(V)); // Conflict cells in V + CGAL::Oneset_iterator(f), // Get one boundary facet + std::back_inserter(V)); // Conflict cells in V } std::cout << "Final triangulation has " << T.number_of_vertices() diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/geometric_access.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/geometric_access.cpp index 6c100c40e89..619725560f5 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/geometric_access.cpp +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/geometric_access.cpp @@ -1,19 +1,20 @@ #include + #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PK; -typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; -typedef PK::Point_3 Point; -typedef PK::Triangle_3 Triangle; +typedef Gt::Point_3 Point; +typedef Gt::Triangle_3 Triangle; typedef P3DT3::Periodic_triangle Periodic_triangle; typedef P3DT3::Periodic_triangle_iterator Periodic_triangle_iterator; typedef P3DT3::Iterator_type Iterator_type; -int main() { +int main(int, char**) { P3DT3 T; T.insert(Point(0,0,0)); diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/large_point_set.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/large_point_set.cpp index 42caf789c35..1b74ae7c6a4 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/large_point_set.cpp +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/large_point_set.cpp @@ -1,4 +1,5 @@ #include + #include #include @@ -9,14 +10,13 @@ #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 GT; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; -typedef CGAL::Periodic_3_Delaunay_triangulation_3 PDT; +typedef P3DT3::Point Point; -typedef PDT::Point Point; - -int main() +int main(int, char**) { CGAL::Timer t; typedef CGAL::Creator_uniform_3 Creator; @@ -26,7 +26,7 @@ int main() int n = 10000; std::vector pts; - PDT PT1, PT2, PT3; + P3DT3 PT1, PT2, PT3; // Generating n random points for (int i=0 ; i < n ; i++) { diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_hidden_points.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_hidden_points.cpp new file mode 100644 index 00000000000..28d46518ca2 --- /dev/null +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_hidden_points.cpp @@ -0,0 +1,41 @@ +#include + +#include +#include + +#include + +typedef CGAL::Epick K; +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3; + +typedef Gt::Iso_cuboid_3 Iso_cuboid; +typedef Gt::Point_3 Point_3; +typedef Gt::Weighted_point_3 Weighted_point_3; + +typedef P3RT3::Vertex_handle Vertex_handle; + +int main () +{ + P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1)); + + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.91,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.89), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.101,0.101,0.101), 0.001)); + assert(p3rt3.is_valid()); + + std::cout << "Number of vertices : " << p3rt3.number_of_vertices() << std::endl; + std::cout << "Number of hidden points : " << p3rt3.number_of_hidden_points() << std::endl; + + std::cout << "Removing the first point..." << std::endl; + p3rt3.remove(p3rt3.vertices_begin()); + // The first point is removed and the hidden point is revealed. + + std::cout << "Number of vertices : " << p3rt3.number_of_vertices() << std::endl; + std::cout << "Number of hidden points : " << p3rt3.number_of_hidden_points() << std::endl; + + std::cout << "EXIT SUCCESS" << std::endl; + return 0; +} diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_only.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_only.cpp new file mode 100644 index 00000000000..352d8c07df7 --- /dev/null +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_only.cpp @@ -0,0 +1,43 @@ +#include + +#include +#include +#include +#include +#include + +#include + +typedef CGAL::Epick K; +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Gt; + +/* If remove() isn't called in our program, we can use a triangulation data structure + * more appropriate, which saves some memory resources. + */ +typedef CGAL::Regular_triangulation_vertex_base_3 > Vb; +typedef CGAL::Regular_triangulation_cell_base_3 > Cb; +typedef CGAL::Triangulation_data_structure_3 Tds; + +typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3; + +typedef Gt::Iso_cuboid_3 Iso_cuboid; +typedef Gt::Weighted_point_3 Weighted_point_3; +typedef Gt::Point_3 Point_3; + +typedef P3RT3::Vertex_handle Vertex_handle; + +int main(int, char**) +{ + P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1)); + + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.4,0.4,0.4), 0.001)); + + std::cout << "EXIT SUCCESS" << std::endl; + return 0; +} diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_point_with_bad_weight.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_point_with_bad_weight.cpp new file mode 100644 index 00000000000..ae29136c01c --- /dev/null +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_point_with_bad_weight.cpp @@ -0,0 +1,44 @@ +#include + +#include +#include +#include +#include + +#include + +typedef CGAL::Epick K; +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Gt; + +/* If remove() isn't called in our program, we can use a triangulation data structure more appropriate + * which saves some memory resources. + */ +typedef CGAL::Regular_triangulation_vertex_base_3 > Vb; +typedef CGAL::Regular_triangulation_cell_base_3 > Cb; +typedef CGAL::Triangulation_data_structure_3 Tds; + +typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3; + +typedef Gt::Iso_cuboid_3 Iso_cuboid; +typedef Gt::Weighted_point_3 Weighted_point_3; +typedef Gt::Point_3 Point_3; + +int main () +{ + P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1)); + + // Here, we insert a point with a bad weight. +// p3rt3.insert(Weighted_point_3(Point_3(0.5,0.5,0.5), 1.)); + +// In debug mode, if we uncomment the previous instruction, the program displays the following error message : +// terminate called after throwing an instance of 'CGAL::Precondition_exception' +// what(): CGAL ERROR: precondition violation! +// Expr: point.weight() < ( FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()) ) +// [...] +// Explanation: point.weight() < 1/64 * domain_size * domain_size + + std::cout << "EXIT SUCCESS" << std::endl; + return 0; +} diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_remove.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_remove.cpp new file mode 100644 index 00000000000..e7261455383 --- /dev/null +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/p3rt3_insert_remove.cpp @@ -0,0 +1,34 @@ +#include + +#include +#include + +#include + +typedef CGAL::Epick K; +typedef K::FT FT; + +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3; + +typedef Gt::Weighted_point_3 Weighted_point_3; +typedef Gt::Point_3 Point_3; + +typedef P3RT3::Vertex_handle Vertex_handle; + +int main (int, char**) +{ + P3RT3 p3rt3(P3RT3::Iso_cuboid(0,0,0, 1,1,1)); + + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9), 0.01)); + p3rt3.insert(Weighted_point_3(Point_3(0.4,0.4,0.4), 0.001)); + + while (p3rt3.number_of_vertices()) + p3rt3.remove(p3rt3.vertices_begin()); + + std::cout << "EXIT SUCCESS" << std::endl; + return 0; +} diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp index ddcce2cefa1..c78d2c6053e 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/periodic_adding_handles.cpp @@ -1,11 +1,12 @@ #include + #include #include #include #include -template < class GT, class VbDS, - class Vb = CGAL::Triangulation_vertex_base_3 > +template < class Gt, class VbDS, + class Vb = CGAL::Triangulation_vertex_base_3 > class My_vertex_base : public Vb { @@ -17,7 +18,7 @@ public: template < class TDS2 > struct Rebind_TDS { typedef typename Vb::template Rebind_TDS::Other Vb2; - typedef My_vertex_base Other; + typedef My_vertex_base Other; }; My_vertex_base() {} @@ -32,23 +33,22 @@ public: Cell_handle ch; }; - typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 GT; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 Gt; -typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS; -typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS; -typedef CGAL::Triangulation_cell_base_3 Cb; +typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> VbDS; +typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> CbDS; +typedef CGAL::Triangulation_cell_base_3 Cb; -typedef CGAL::Triangulation_data_structure_3, Cb> TDS; -typedef CGAL::Periodic_3_Delaunay_triangulation_3 PDT; +typedef CGAL::Triangulation_data_structure_3, Cb> TDS; +typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; -typedef PDT::Vertex_handle Vertex_handle; -typedef PDT::Point Point; +typedef P3DT3::Vertex_handle Vertex_handle; +typedef P3DT3::Point Point; -int main() +int main(int, char**) { - PDT T; + P3DT3 T; Vertex_handle v0 = T.insert(Point(0,0,0)); Vertex_handle v1 = T.insert(Point(.1,0,0)); diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/simple_example.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/simple_example.cpp index 070697f2fb3..97e4ebc54a7 100644 --- a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/simple_example.cpp +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/simple_example.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -8,20 +9,19 @@ #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 GT; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3; -typedef CGAL::Periodic_3_Delaunay_triangulation_3 PDT; +typedef P3DT3::Point Point; +typedef P3DT3::Iso_cuboid Iso_cuboid; +typedef P3DT3::Vertex_handle Vertex_handle; +typedef P3DT3::Cell_handle Cell_handle; +typedef P3DT3::Locate_type Locate_type; -typedef PDT::Cell_handle Cell_handle; -typedef PDT::Vertex_handle Vertex_handle; -typedef PDT::Locate_type Locate_type; -typedef PDT::Point Point; -typedef PDT::Iso_cuboid Iso_cuboid; - -int main() +int main(int, char**) { - Iso_cuboid domain(-1,-1,-1,2,2,2); // The cube for the periodic domain + Iso_cuboid domain(-1,-1,-1,2,2,2); // the cube for the periodic domain // construction from a list of points : std::list L; @@ -29,9 +29,9 @@ int main() L.push_front(Point(1,0,0)); L.push_front(Point(0,1,0)); - PDT T(L.begin(), L.end(), domain); // Put the domain with the constructor + P3DT3 T(L.begin(), L.end(), domain); // put the domain with the constructor - PDT::size_type n = T.number_of_vertices(); + P3DT3::size_type n = T.number_of_vertices(); // insertion from a vector : std::vector V(3); @@ -49,7 +49,7 @@ int main() Point p(0,0,0); Cell_handle c = T.locate(p, lt, li, lj); // p is the vertex of c of index li : - assert( lt == PDT::VERTEX ); + assert( lt == P3DT3::VERTEX ); assert( c->vertex(li)->point() == p ); Vertex_handle v = c->vertex( (li+1)&3 ); @@ -61,14 +61,20 @@ int main() assert( nc->has_vertex( v, nli ) ); // nli is the index of v in nc - std::ofstream oFileT("output.tri",std::ios::out); - // writing file output; - oFileT << T; + // writing file output + std::ofstream oFileT("output.tri", std::ios::out); // as a .tri file + oFileT << T; - PDT T1; + std::ofstream to_off("output_regular.off"); // as a .off file + write_triangulation_to_off(to_off, T); + + std::ofstream d_to_off("output_dual.off"); + draw_dual_to_off(d_to_off, T); + + // reading file output + P3DT3 T1; std::ifstream iFileT("output.tri",std::ios::in); - // reading file output; - iFileT >> T1; + iFileT >> T1; assert( T1.is_valid() ); assert( T1.number_of_vertices() == T.number_of_vertices() ); assert( T1.number_of_cells() == T.number_of_cells() ); diff --git a/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/simple_regular_example.cpp b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/simple_regular_example.cpp new file mode 100644 index 00000000000..780de987255 --- /dev/null +++ b/Periodic_3_triangulation_3/examples/Periodic_3_triangulation_3/simple_regular_example.cpp @@ -0,0 +1,84 @@ +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Gt; +typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3; + +typedef P3RT3::Bare_point Point; +typedef P3RT3::Weighted_point Weighted_point; +typedef P3RT3::Iso_cuboid Iso_cuboid; +typedef P3RT3::Vertex_handle Vertex_handle; +typedef P3RT3::Cell_handle Cell_handle; +typedef P3RT3::Locate_type Locate_type; + +int main(int, char**) +{ + Iso_cuboid domain(-1,-1,-1, 2,2,2); // the cube for the periodic domain + + // construction from a list of weighted points : + std::list L; + L.push_front(Weighted_point(Point(0,0,0), 0.01)); + L.push_front(Weighted_point(Point(1,0,0), 0.02)); + L.push_front(Weighted_point(Point(0,1,0), 0.03)); + + P3RT3 T(L.begin(), L.end(), domain); // put the domain with the constructor + + P3RT3::size_type n = T.number_of_vertices(); + + // insertion from a vector : + std::vector V(3); + V[0] = Weighted_point(Point(0,0,1), 0.04); + V[1] = Weighted_point(Point(1,1,1), 0.05); + V[2] = Weighted_point(Point(-1,-1,-1), 0.06); + + n = n + T.insert(V.begin(), V.end()); + + assert( n == 6 ); // 6 points have been inserted + assert( T.is_valid() ); // checking validity of T + + Locate_type lt; + int li, lj; + Weighted_point p(Point(0,0,0), 1.); + Cell_handle c = T.locate(p, lt, li, lj); + // p is the vertex of c of index li : + assert( lt == P3RT3::VERTEX ); + assert( c->vertex(li)->point() == p ); + + Vertex_handle v = c->vertex( (li+1)&3 ); + // v is another vertex of c + Cell_handle nc = c->neighbor(li); + // nc = neighbor of c opposite to the vertex associated with p + // nc must have vertex v : + int nli; + assert( nc->has_vertex( v, nli ) ); + // nli is the index of v in nc + + // writing file output + std::ofstream oFileT("output_regular.tri", std::ios::out); // as a .tri file + oFileT << T; + + std::ofstream to_off("output_regular.off"); + write_triangulation_to_off(to_off, T); + + std::ofstream d_to_off("output_regular_dual.off"); // as a .off file + draw_dual_to_off(d_to_off, T); + + // reading file output + P3RT3 T1; + std::ifstream iFileT("output_regular.tri",std::ios::in); + iFileT >> T1; + assert( T1.is_valid() ); + assert( T1.number_of_vertices() == T.number_of_vertices() ); + assert( T1.number_of_cells() == T.number_of_cells() ); + + return 0; +} diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h index e84e42e5ef8..25d41fc9319 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2004,2006-2009 INRIA Sophia-Antipolis (France). +// Copyright (c) 1999-2004,2006-2009, 2017 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -12,45 +12,51 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Monique Teillaud // Sylvain Pion // Andreas Fabri // Nico Kruithof // Manuel Caroli - #ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H #define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H #include - #include #include // Needed by remove to fill the hole. -#include +#include #include +#include +#include +#include +#include + namespace CGAL { +template < class GT, class TDS > class Periodic_3_Delaunay_triangulation_3; +template < class GT, class TDS > std::istream& operator>> + (std::istream& is, Periodic_3_Delaunay_triangulation_3 &tr); + template < class Gt, - class Tds = Triangulation_data_structure_3 < - Triangulation_vertex_base_3< - Gt, Periodic_3_triangulation_ds_vertex_base_3<> - >, - Triangulation_cell_base_3< - Gt, Periodic_3_triangulation_ds_cell_base_3<> - > - > - > + class Tds = Triangulation_data_structure_3 < + Triangulation_vertex_base_3< + Gt, Periodic_3_triangulation_ds_vertex_base_3<> + >, + Triangulation_cell_base_3< + Gt, Periodic_3_triangulation_ds_cell_base_3<> + > + > + > class Periodic_3_Delaunay_triangulation_3 : - public Periodic_3_triangulation_3 + public Periodic_3_triangulation_3 { + friend std::istream& operator>> <> + (std::istream& is, Periodic_3_Delaunay_triangulation_3 &tr); + typedef Periodic_3_Delaunay_triangulation_3 Self; public: typedef Periodic_3_triangulation_3 Base; @@ -104,6 +110,8 @@ public: typedef typename Base::Offset Offset; typedef typename Base::Iso_cuboid Iso_cuboid; typedef typename Base::Covering_sheets Covering_sheets; + typedef typename Base::Periodic_segment_iterator Periodic_segment_iterator; + typedef typename Base::Periodic_tetrahedron_iterator Periodic_tetrahedron_iterator; //@} #ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 @@ -111,125 +119,402 @@ public: using Base::ccw; using Base::domain; using Base::geom_traits; + using Base::insert_dummy_points; using Base::int_to_off; + using Base::is_1_cover; + using Base::is_virtual; using Base::number_of_sheets; using Base::number_of_vertices; using Base::number_of_edges; using Base::number_of_facets; using Base::number_of_cells; - using Base::cells_begin; - using Base::cells_end; - using Base::vertices_begin; - using Base::vertices_end; - using Base::facets_begin; - using Base::facets_end; - using Base::tds; using Base::next_around_edge; using Base::vertex_triple_index; using Base::mirror_vertex; using Base::orientation; - using Base::insert_dummy_points; - using Base::swap; - using Base::is_1_cover; - using Base::is_virtual; using Base::point; + using Base::swap; + using Base::tds; + using Base::vertices_begin; + using Base::vertices_end; + using Base::edges_begin; + using Base::edges_end; + using Base::facets_begin; + using Base::facets_end; + using Base::cells_begin; + using Base::cells_end; #endif // For strict-ansi compliance using Base::adjacent_vertices; using Base::combine_offsets; - using Base::get_offset; - using Base::get_original_vertex; - using Base::get_location_offset; - using Base::get_neighbor_offset; + using Base::construct_point; + using Base::convert_to_27_sheeted_covering; + using Base::draw_dual; using Base::incident_edges; using Base::incident_facets; using Base::incident_cells; using Base::is_valid_conflict; + using Base::get_offset; + using Base::get_original_vertex; + using Base::get_location_offset; using Base::locate; + using Base::neighbor_offset; using Base::periodic_point; - using Base::segment; + +private: + /// This threshold should be chosen such that if all edges are shorter, + /// we can be sure that there are no self-edges anymore. + FT edge_length_threshold; + + /// This adjacency list stores all edges that are longer than + /// edge_length_threshold. + std::map< Vertex_handle, std::list > too_long_edges; + unsigned int too_long_edge_counter; + + class Cover_manager + { + Periodic_3_Delaunay_triangulation_3& tr; + + public: + Cover_manager (Periodic_3_Delaunay_triangulation_3& tr) + : tr(tr) + {} + + void create_initial_triangulation() + { + tr.create_initial_triangulation(); + } + + template + void delete_unsatisfying_elements(const CellIt begin, const CellIt end) + { + tr.delete_too_long_edges(begin, end); + } + + template + void insert_unsatisfying_elements(Vertex_handle v, const CellIt begin, const CellIt end) + { + tr.insert_too_long_edges(v, begin, end); + } + + bool can_be_converted_to_1_sheet () const + { + return tr.can_be_converted_to_1_sheet(); + } + + bool update_cover_data_during_management (Cell_handle new_ch, const std::vector& new_cells) + { + return tr.update_cover_data_during_management(new_ch, new_cells); + } + }; public: /** @name Creation */ //@{ - Periodic_3_Delaunay_triangulation_3( - const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1), - const Geometric_traits& gt = Geometric_traits()) - : Base(domain, gt) {} + Periodic_3_Delaunay_triangulation_3(const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1), + const Geometric_traits& gt = Geometric_traits()) + : Base(domain, gt), too_long_edge_counter(0) + { + edge_length_threshold = FT(0.166) * (domain.xmax()-domain.xmin()) + * (domain.xmax()-domain.xmin()); + } // copy constructor duplicates vertices and cells - Periodic_3_Delaunay_triangulation_3( - const Periodic_3_Delaunay_triangulation_3& tr) : Base(tr) { - CGAL_triangulation_expensive_postcondition( is_valid() ); + Periodic_3_Delaunay_triangulation_3(const Periodic_3_Delaunay_triangulation_3& tr) + : Base(tr), edge_length_threshold(tr.edge_length_threshold) + { + if(is_1_cover()) { + tds() = tr.tds(); + } else { + this->copy_multiple_covering(tr); + } + CGAL_triangulation_expensive_postcondition(*this == tr); + CGAL_triangulation_expensive_postcondition( is_valid() ); } template < typename InputIterator > Periodic_3_Delaunay_triangulation_3(InputIterator first, InputIterator last, - const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1), - const Geometric_traits& gt = Geometric_traits() ) - : Base(domain, gt) { + const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1), + const Geometric_traits& gt = Geometric_traits()) + : Base(domain, gt), too_long_edge_counter(0) + { + edge_length_threshold = FT(0.166) * (domain.xmax()-domain.xmin()) + * (domain.xmax()-domain.xmin()); insert(first, last); } + + Periodic_3_Delaunay_triangulation_3 operator=(Periodic_3_Delaunay_triangulation_3 tr) + { + tr.swap(*this); + return *this; + } + + void copy_multiple_covering(const Periodic_3_Delaunay_triangulation_3 & tr); + + void swap(Periodic_3_Delaunay_triangulation_3&tr) + { + std::swap(edge_length_threshold,tr.edge_length_threshold); + std::swap(too_long_edges,tr.too_long_edges); + std::swap(too_long_edge_counter,tr.too_long_edge_counter); + Base::swap(tr); + } + + virtual void clear_covering_data() + { + too_long_edges.clear(); + too_long_edge_counter = 0; + } + + virtual void update_cover_data_after_setting_domain () + { + edge_length_threshold = FT(0.166) * (domain().xmax()-domain().xmin()) + * (domain().xmax()-domain().xmin()); + } + + virtual void update_cover_data_after_converting_to_27_sheeted_covering() + { + // Set up too long edges data structure + int i=0; + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { + too_long_edges[vit] = std::list(); + ++i; + } + too_long_edge_counter = this->find_too_long_edges(too_long_edges); + } + + bool is_extensible_triangulation_in_1_sheet_h1() const; + bool is_extensible_triangulation_in_1_sheet_h2() const; + + // iterate over all edges and store the ones that are longer than + // edge_length_threshold in edges. Return the number of too long edges. + int find_too_long_edges(std::map >& edges) const + { + Point p1, p2; + int counter = 0; + Vertex_handle v_no,vh; + for(Edge_iterator eit = edges_begin(); eit != edges_end(); eit++) { + p1 = construct_point(eit->first->vertex(eit->second)->point(), + get_offset(eit->first, eit->second)); + p2 = construct_point(eit->first->vertex(eit->third)->point(), + get_offset(eit->first, eit->third)); + if(squared_distance(p1,p2) > edge_length_threshold) { + if(&*(eit->first->vertex(eit->second)) < &*(eit->first->vertex(eit->third))) { + v_no = eit->first->vertex(eit->second); + vh = eit->first->vertex(eit->third); + } else { + v_no = eit->first->vertex(eit->third); + vh = eit->first->vertex(eit->second); + } + edges[v_no].push_back(vh); + counter++; + } + } + return counter; + } //@} - /** @name Insertion */ //@{ - Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle()) { - Conflict_tester tester(p, this); - Point_hider hider; - return Base::insert_in_conflict(p, start, tester, hider); + void create_initial_triangulation() + { + // create the base for too_long_edges; + CGAL_triangulation_assertion( too_long_edges.empty() ); + CGAL_triangulation_assertion(too_long_edge_counter == 0); + + for(Vertex_iterator vit = vertices_begin(); vit !=vertices_end(); ++vit ) + too_long_edges[vit] = std::list();; + + std::vector temp_inc_cells; + for(Vertex_iterator vit = vertices_begin(); vit !=vertices_end(); ++vit ) { + temp_inc_cells.clear(); + incident_cells(vit, std::back_inserter(temp_inc_cells)); + for(unsigned int i=0; iindex(vit); + for(int j=0; j<4; j++) { + if(j==k) continue; + if(&*vit > &*(temp_inc_cells[i]->vertex(j))) continue; + if((find(too_long_edges[vit].begin(), + too_long_edges[vit].end(), + temp_inc_cells[i]->vertex(j)) == + too_long_edges[vit].end())) { + too_long_edges[vit].push_back(temp_inc_cells[i]->vertex(j)); + too_long_edge_counter++; + } + } + } + } } - Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle c, - int li, int lj) { + template + void delete_too_long_edges(const CellIt begin, const CellIt end) + { + std::pair< Vertex_handle, Vertex_handle > edge_to_delete, edge_to_delete2; + typename std::list< Vertex_handle >::iterator sit; + // Iterate over all cells that are in the star. That means that those cells + // are going to be deleted. Therefore, all of them have to be deleted from + // too_long_edges, if they are contained in it. + for(CellIt it = begin; it != end; ++it) { + for(int j=0; j<4; j++) { + for(int k=0; k<4; k++) { + if(&*((*it)->vertex(j)) < &*((*it)->vertex(k))) { + edge_to_delete = std::make_pair((*it)->vertex(j),(*it)->vertex(k)); + } else { + edge_to_delete = std::make_pair((*it)->vertex(k),(*it)->vertex(j)); + } + Vertex_handle v_no = edge_to_delete.first; + sit = std::find(too_long_edges[v_no].begin(), + too_long_edges[v_no].end(), + edge_to_delete.second); + if(sit != too_long_edges[v_no].end()) { + too_long_edges[v_no].erase(sit); + too_long_edge_counter--; + } + } + } + } + } + + template + void insert_too_long_edges(Vertex_handle v, const CellIt begin, const CellIt end) + { + CGAL_triangulation_precondition(number_of_vertices() != 0); + // add newly added edges to too_long_edges, if necessary. + Point p1,p2; + std::pair< Vertex_handle, Vertex_handle > edge_to_add; + std::list empty_list; + too_long_edges[v] = empty_list; + // Iterate over all cells of the new star. + for(CellIt it = begin; it != end; ++it) { + // Consider all possible vertex pairs. + for(int k=0; k<4; k++) { + for(int j=0; j<4; j++) { + if(j==k) continue; + if(&*((*it)->vertex(j)) > &*((*it)->vertex(k))) continue; + // make the offsets canonical (wrt. to some notion) + // add to too_long_edges, if not yet added and if "too long" + CGAL_triangulation_precondition( + &*((*it)->vertex(j))< &*((*it)->vertex(k))); + + edge_to_add = std::make_pair((*it)->vertex(j), (*it)->vertex(k)); + + p1 = construct_point((*it)->vertex(j)->point(), get_offset(*it, j)); + p2 = construct_point((*it)->vertex(k)->point(), get_offset(*it, k)); + + if((squared_distance(p1,p2) > edge_length_threshold) + && (find(too_long_edges[(*it)->vertex(j)].begin(), + too_long_edges[(*it)->vertex(j)].end(), + edge_to_add.second) + == too_long_edges[(*it)->vertex(j)].end())) { + too_long_edges[(*it)->vertex(j)].push_back(edge_to_add.second); + too_long_edge_counter++; + } + } + } + } + } + + bool can_be_converted_to_1_sheet() const + { + return too_long_edge_counter == 0; + } + + bool update_cover_data_during_management(Cell_handle new_ch, + const std::vector& new_cells) + { + for(int i=0; i < 4; i++) { + for(int j=0; j < 4; j++) { + if(j==i) continue; + if(&*(new_ch->vertex(i)) > &*(new_ch->vertex(j))) continue; + + Point p1 = construct_point(new_ch->vertex(i)->point(), + get_offset(new_ch, i)); + Point p2 = construct_point(new_ch->vertex(j)->point(), + get_offset(new_ch, j)); + Vertex_handle v_no = new_ch->vertex(i); + + if(squared_distance(p1, p2) > edge_length_threshold) { + // If the cell does not fulfill the edge-length criterion + // revert all changes to the triangulation and transform it + // to a triangulation in the needed covering space. + if(is_1_cover()) { + tds().delete_cells(new_cells.begin(), new_cells.end()); + convert_to_27_sheeted_covering(); + return true; + } + else if(find(too_long_edges[v_no].begin(), + too_long_edges[v_no].end(), + new_ch->vertex(j)) + == too_long_edges[v_no].end()) { + too_long_edges[v_no].push_back(new_ch->vertex(j)); + too_long_edge_counter++; + } + } + } + } + return false; + } + + /** @name Insertion */ //@{ + Vertex_handle insert(const Point& p, Cell_handle start = Cell_handle()) + { Conflict_tester tester(p, this); Point_hider hider; - return Base::insert_in_conflict(p,lt,c,li,lj, tester,hider); + Cover_manager cover_manager(*this); + return Base::insert_in_conflict(p, start, tester, hider, cover_manager); + } + + Vertex_handle insert(const Point& p, Locate_type lt, Cell_handle c, + int li, int lj) + { + Conflict_tester tester(p, this); + Point_hider hider; + Cover_manager cover_manager(*this); + return Base::insert_in_conflict(p,lt,c,li,lj, tester,hider, cover_manager); } template < class InputIterator > std::ptrdiff_t insert(InputIterator first, InputIterator last, - bool is_large_point_set = false) { - if (first == last) return 0; + bool is_large_point_set = false) + { + if(first == last) return 0; size_type n = number_of_vertices(); // The heuristic discards the existing triangulation so it can only be // applied to empty triangulations. - if (n!=0) is_large_point_set = false; + if(n!=0) + is_large_point_set = false; std::vector points(first, last); std::random_shuffle (points.begin(), points.end()); Cell_handle hint; std::vector dummy_points, double_vertices; typename std::vector::iterator pbegin = points.begin(); - if (is_large_point_set) + if(is_large_point_set) dummy_points = insert_dummy_points(); - else while (!is_1_cover()) { - insert(*pbegin); - ++pbegin; - if (pbegin == points.end()) return number_of_vertices() - n; - } + else while(!is_1_cover()) { + insert(*pbegin); + ++pbegin; + if(pbegin == points.end()) + return number_of_vertices() - n; + } - // Use Geom_traits::K for efficiency: spatial_sort creates a lot - // of copies of the traits but does not need the domain that is - // stored in it. - spatial_sort (pbegin, points.end(), typename Geom_traits::K()); + spatial_sort (pbegin, points.end(), this->geom_traits()); Conflict_tester tester(*pbegin,this); Point_hider hider; + Cover_manager cover_manager(*this); double_vertices = Base::insert_in_conflict( - points.begin(),points.end(),hint,tester,hider); - - if (is_large_point_set) { - typedef CGAL::Periodic_3_triangulation_remove_traits_3< Gt > P3removeT; + points.begin(), points.end(), hint, tester, hider, cover_manager); + + if(is_large_point_set) { + typedef CGAL::Periodic_3_Delaunay_triangulation_remove_traits_3 P3removeT; typedef CGAL::Delaunay_triangulation_3< P3removeT > DT; typedef Vertex_remover< DT > Remover; P3removeT remove_traits(domain()); DT dt(remove_traits); Remover remover(this,dt); Conflict_tester t(this); - for (unsigned int i=0; i - std::ptrdiff_t remove(InputIterator first, InputIterator beyond) { + std::ptrdiff_t remove(InputIterator first, InputIterator beyond) + { std::size_t n = number_of_vertices(); - while (first != beyond) { + while(first != beyond) { remove(*first); ++first; } @@ -258,24 +547,28 @@ public: public: /** @name Wrapping the traits */ //@{ - Oriented_side side_of_oriented_sphere(const Point &p, const Point &q, - const Point &r, const Point &s, const Point &t) const { + Oriented_side side_of_oriented_sphere(const Point& p, const Point& q, + const Point& r, const Point& s, + const Point& t) const { return geom_traits().side_of_oriented_sphere_3_object()(p,q,r,s,t); } - Oriented_side side_of_oriented_sphere(const Point &p, const Point &q, - const Point &r, const Point &s, const Point &t, const Offset &o_p, - const Offset &o_q, const Offset &o_r, const Offset &o_s, - const Offset &o_t) const { + Oriented_side side_of_oriented_sphere(const Point& p, const Point& q, + const Point& r, const Point& s, + const Point& t, + const Offset& o_p, const Offset& o_q, + const Offset& o_r, const Offset& o_s, + const Offset& o_t) const { return geom_traits().side_of_oriented_sphere_3_object()( - p,q,r,s,t,o_p,o_q,o_r,o_s,o_t); + p,q,r,s,t,o_p,o_q,o_r,o_s,o_t); } - Comparison_result compare_distance(const Point &p, const Point &q, - const Point &r) const { + Comparison_result compare_distance(const Point& p, const Point& q, + const Point& r) const { return geom_traits().compare_distance_3_object()(p, q, r); } - Comparison_result compare_distance(const Point &p, const Point &q, - const Point &r, const Offset &o_p, const Offset &o_q, - const Offset &o_r) const { + Comparison_result compare_distance(const Point& p, const Point& q, + const Point& r, + const Offset& o_p, const Offset& o_q, + const Offset& o_r) const { return geom_traits().compare_distance_3_object()(p, q, r, o_p, o_q, o_r); } //@} @@ -285,8 +578,8 @@ private: Bounded_side _side_of_sphere(const Cell_handle& c, const Point& p, const Offset & offset = Offset(), bool perturb = false) const; - Offset get_min_dist_offset(const Point & p, const Offset & o, - const Vertex_handle vh) const; + Offset get_min_dist_offset(const Point& p, const Offset& o, + const Vertex_handle vh) const; //@} public: @@ -297,23 +590,24 @@ public: int i=0; // TODO: optimize which copies to check depending on the offsets in // the cell. - while (bs == ON_UNBOUNDED_SIDE && i<8) { + while(bs == ON_UNBOUNDED_SIDE && i<8) { bs= _side_of_sphere(c,p,combine_offsets(offset,int_to_off(i)),perturb); i++; } return bs; } - Vertex_handle nearest_vertex(const Point& p, - Cell_handle c = Cell_handle()) const; - Vertex_handle nearest_vertex_in_cell(const Cell_handle& c, - const Point & p, const Offset & offset = Offset()) const; + Vertex_handle nearest_vertex(const Point& p, Cell_handle c = Cell_handle()) const; + Vertex_handle nearest_vertex_in_cell(const Cell_handle& c, const Point & p, + const Offset & offset = Offset()) const; /// Undocumented wrapper for find_conflicts. template std::pair find_conflicts(const Point &p, Cell_handle c, - OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit) const { + OutputIteratorBoundaryFacets bfit, + OutputIteratorCells cit) const + { Triple t = find_conflicts(p, c, bfit, cit, Emptyset_iterator()); return std::make_pair(t.first, t.second); @@ -324,13 +618,13 @@ public: Triple find_conflicts(const Point &p, Cell_handle c, - OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit, - OutputIteratorInternalFacets ifit) const; - + OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit, + OutputIteratorInternalFacets ifit) const; + /// Returns the vertices on the boundary of the conflict hole. template OutputIterator vertices_in_conflict(const Point&p, Cell_handle c, - OutputIterator res) const; + OutputIterator res) const; bool is_Gabriel(const Cell_handle c, int i) const; bool is_Gabriel(const Cell_handle c, int i, int j) const; @@ -341,129 +635,47 @@ public: return is_Gabriel(e.first, e.second, e.third); } //@} - + private: /** @name Voronoi diagram helpers */ //@{ - bool is_canonical(const Periodic_segment &ps) const { - if (number_of_sheets() == make_array(1,1,1)) return true; + bool is_canonical(const Periodic_segment &ps) const + { + if(number_of_sheets() == make_array(1,1,1)) return true; Offset o0 = ps.at(0).second; Offset o1 = ps.at(1).second; Offset cumm_off((std::min)(o0.x(),o1.x()),(std::min)(o0.y(),o1.y()), - (std::min)(o0.z(),o1.z())); + (std::min)(o0.z(),o1.z())); return (cumm_off == Offset(0,0,0)); } //@} + public: - Periodic_point periodic_circumcenter(Cell_handle c) const { - CGAL_triangulation_precondition(c != Cell_handle()); - Point v = geom_traits().construct_circumcenter_3_object()( - c->vertex(0)->point(), c->vertex(1)->point(), - c->vertex(2)->point(), c->vertex(3)->point(), - get_offset(c,0), get_offset(c,1), - get_offset(c,2), get_offset(c,3)); + /** @name Geometric access functions */ + /// @{ - // check that v lies within the domain. If not: translate - Iso_cuboid dom = domain(); - if ( !(v.x() < dom.xmin()) && v.x()offset((f.second+1)&3)); - Offset cell_off1 = int_to_off(f.first->offset((f.second+2)&3)); - Offset cell_off2 = int_to_off(f.first->offset((f.second+3)&3)); - Offset diff_off((cell_off0.x() == 1 - && cell_off1.x() == 1 - && cell_off2.x() == 1)?-1:0, - (cell_off0.y() == 1 - && cell_off1.y() == 1 - && cell_off2.y() == 1)?-1:0, - (cell_off0.z() == 1 - && cell_off1.z() == 1 - && cell_off2.z() == 1)?-1:0); - Offset off0 = combine_offsets(get_offset(f.first, (f.second+1)&3), - diff_off); - Offset off1 = combine_offsets(get_offset(f.first, (f.second+2)&3), - diff_off); - Offset off2 = combine_offsets(get_offset(f.first, (f.second+3)&3), - diff_off); - - // If there is one offset with entries larger than 1 then we are - // talking about a vertex that is too far away from the original - // domain to belong to a canonical triangle. - if (off0.x() > 1) return false; - if (off0.y() > 1) return false; - if (off0.z() > 1) return false; - if (off1.x() > 1) return false; - if (off1.y() > 1) return false; - if (off1.z() > 1) return false; - if (off2.x() > 1) return false; - if (off2.y() > 1) return false; - if (off2.z() > 1) return false; - - // If there is one direction of space for which all offsets are - // non-zero then the edge is not canonical because we can - // take the copy closer towards the origin in that direction. - int offx = off0.x() & off1.x() & off2.x(); - int offy = off0.y() & off1.y() & off2.y(); - int offz = off0.z() & off1.z() & off2.z(); - - return (offx == 0 && offy == 0 && offz == 0); -} - - bool canonical_dual_segment(Cell_handle c, int i, Periodic_segment& ps) const { - CGAL_triangulation_precondition(c != Cell_handle()); - Offset off = get_neighbor_offset(c,i,c->neighbor(i)); - Periodic_point p1 = periodic_circumcenter(c); - Periodic_point p2 = periodic_circumcenter(c->neighbor(i)); - Offset o1 = -p1.second; - Offset o2 = combine_offsets(-p2.second,-off); - Offset cumm_off((std::min)(o1.x(),o2.x()), - (std::min)(o1.y(),o2.y()),(std::min)(o1.z(),o2.z())); - const std::pair pp1 = std::make_pair(point(p1), o1-cumm_off); - const std::pair pp2 = std::make_pair(point(p2), o2-cumm_off); - ps = make_array(pp1,pp2); - return (cumm_off == Offset(0,0,0)); + Point point(Vertex_handle v) const + { + return point(v, geom_traits().construct_point_3_object()); + } + + Point point(Cell_handle c, int idx) const + { + return point(c, idx, geom_traits().construct_point_3_object()); + } + + // end of geometric functions + /// @} + + Periodic_point periodic_circumcenter(Cell_handle c) const { + return Base::periodic_circumcenter(c, geom_traits().construct_circumcenter_3_object()); } public: @@ -471,10 +683,15 @@ public: Point dual(Cell_handle c) const { return point(periodic_circumcenter(c)); } + + bool canonical_dual_segment(Cell_handle c, int i, Periodic_segment& ps) const { + return Base::canonical_dual_segment(c, i, ps, geom_traits().construct_circumcenter_3_object()); + } Periodic_segment dual(const Facet & f) const { return dual( f.first, f.second ); } - Periodic_segment dual(Cell_handle c, int i) const{ + Periodic_segment dual(Cell_handle c, int i) const + { Periodic_segment ps; canonical_dual_segment(c,i,ps); return ps; @@ -486,158 +703,40 @@ public: } template - OutputIterator dual(Cell_handle c, int i, int j, - OutputIterator points) const { - Cell_circulator cstart = incident_cells(c, i, j); - - Offset offv = periodic_point(c,i).second; - Vertex_handle v = c->vertex(i); - - Cell_circulator ccit = cstart; - do { - Point dual_orig = periodic_circumcenter(ccit).first; - int idx = ccit->index(v); - Offset off = periodic_point(ccit,idx).second; - Point dual = point(std::make_pair(dual_orig,-off+offv)); - *points++ = dual; - ++ccit; - } while (ccit != cstart); + OutputIterator dual(Cell_handle c, int i, int j, OutputIterator points) const { + Base::dual(c, i, j, points, geom_traits().construct_circumcenter_3_object()); return points; } template OutputIterator dual(Vertex_handle v, OutputIterator points) const { - std::vector cells; - incident_cells(v,std::back_inserter(cells)); - - for (unsigned int i=0; iindex(v); - Offset off = periodic_point(cells[i],idx).second; - Point dual = point(std::make_pair(dual_orig,-off)); - *points++ = dual; - } + Base::dual(v, points, geom_traits().construct_circumcenter_3_object()); return points; } template Stream& draw_dual(Stream& os) const { - CGAL_triangulation_assertion_code( unsigned int i = 0; ) - for (Facet_iterator fit = facets_begin(), end = facets_end(); - fit != end; ++fit) { - if (!is_canonical(*fit)) continue; - Periodic_segment pso = dual(*fit); - Segment so = segment(pso); - CGAL_triangulation_assertion_code ( ++i; ) - os << so.source()<<' '< edges; - incident_edges(v, std::back_inserter(edges)); - - FT vol(0); - for (typename std::list::iterator eit = edges.begin() ; - eit != edges.end() ; ++eit) { - - // compute the dual of the edge *eit but handle the translations - // with respect to the dual of v. That is why we cannot use one - // of the existing dual functions here. - Facet_circulator fstart = incident_facets(*eit); - Facet_circulator fcit = fstart; - std::vector pts; - do { - // TODO: possible speed-up by caching the circumcenters - Point dual_orig = periodic_circumcenter(fcit->first).first; - int idx = fcit->first->index(v); - Offset off = periodic_point(fcit->first,idx).second; - pts.push_back(point(std::make_pair(dual_orig,-off))); - ++fcit; - } while (fcit != fstart); - - Point orig(0,0,0); - for (unsigned int i=1 ; i edges; - incident_edges(v, std::back_inserter(edges)); - - FT vol(0); - FT x(0), y(0), z(0); - for (typename std::list::iterator eit = edges.begin() ; - eit != edges.end() ; ++eit) { - - // compute the dual of the edge *eit but handle the translations - // with respect to the dual of v. That is why we cannot use one - // of the existing dual functions here. - Facet_circulator fstart = incident_facets(*eit); - Facet_circulator fcit = fstart; - std::vector pts; - do { - // TODO: possible speed-up by caching the circumcenters - Point dual_orig = periodic_circumcenter(fcit->first).first; - int idx = fcit->first->index(v); - Offset off = periodic_point(fcit->first,idx).second; - pts.push_back(point(std::make_pair(dual_orig,-off))); - ++fcit; - } while (fcit != fstart); - - Point orig(0,0,0); - FT tetvol; - for (unsigned int i=1 ; i= d.xmax() ? x-d.xmax()+d.xmin() : x)); - y = (y < d.ymin() ? y+d.ymax()-d.ymin() - : (y >= d.ymax() ? y-d.ymax()+d.ymin() : y)); - z = (z < d.zmin() ? z+d.zmax()-d.zmin() - : (z >= d.zmax() ? z-d.zmax()+d.zmin() : z)); - - CGAL_triangulation_postcondition((d.xmin()<=x)&&(x::iterator Hidden_points_iterator; - + typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple; - + typedef typename Triangulation_R3::Triangulation_data_structure TDSE; typedef typename Triangulation_R3::Cell_handle CellE_handle; typedef typename Triangulation_R3::Vertex_handle VertexE_handle; typedef typename Triangulation_R3::Facet FacetE; typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator; - + typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle > VertexE_triple; - + typedef std::map Vertex_triple_Facet_map; typedef std::map Vertex_triple_FacetE_map; typedef typename Vertex_triple_FacetE_map::iterator Vertex_triple_FacetE_map_it; - + Vertex_remover(const Self *t, Triangulation_R3 &tmp_) : _t(t),tmp(tmp_) {} - + const Self *_t; Triangulation_R3 &tmp; - + void add_hidden_points(Cell_handle) { - std::copy (hidden_points_begin(), hidden_points_end(), - std::back_inserter(hidden)); + std::copy (hidden_points_begin(), hidden_points_end(), + std::back_inserter(hidden)); } - + Hidden_points_iterator hidden_points_begin() { return hidden.begin(); } @@ -712,14 +811,15 @@ public: template < class GT, class Tds > typename Periodic_3_Delaunay_triangulation_3::Vertex_handle Periodic_3_Delaunay_triangulation_3::nearest_vertex(const Point& p, - Cell_handle start) const { - if (number_of_vertices() == 0) + Cell_handle start) const +{ + if(number_of_vertices() == 0) return Vertex_handle(); Locate_type lt; int li, lj; Cell_handle c = locate(p, lt, li, lj, start); - if (lt == Base::VERTEX) return c->vertex(li); + if(lt == Base::VERTEX) return c->vertex(li); const Conflict_tester tester(p, this); Offset o = combine_offsets(Offset(),get_location_offset(tester,c)); @@ -729,16 +829,16 @@ Periodic_3_Delaunay_triangulation_3::nearest_vertex(const Point& p, Vertex_handle nearest = nearest_vertex_in_cell(c, p, o); std::vector vs; vs.reserve(32); - while (true) { + while(true) { Vertex_handle tmp = nearest; Offset tmp_off = get_min_dist_offset(p,o,tmp); adjacent_vertices(nearest, std::back_inserter(vs)); - for (typename std::vector::const_iterator - vsit = vs.begin(); vsit != vs.end(); ++vsit) + for(typename std::vector::const_iterator + vsit = vs.begin(); vsit != vs.end(); ++vsit) tmp = (compare_distance(p,tmp->point(),(*vsit)->point(), - o,tmp_off,get_min_dist_offset(p,o,*vsit)) - == SMALLER) ? tmp : *vsit; - if (tmp == nearest) + o,tmp_off,get_min_dist_offset(p,o,*vsit)) + == SMALLER) ? tmp : *vsit; + if(tmp == nearest) break; vs.clear(); nearest = tmp; @@ -751,30 +851,38 @@ Periodic_3_Delaunay_triangulation_3::nearest_vertex(const Point& p, template < class GT, class Tds > typename Periodic_3_Delaunay_triangulation_3::Offset Periodic_3_Delaunay_triangulation_3::get_min_dist_offset( - const Point & p, const Offset & o, const Vertex_handle vh) const { + const Point& p, const Offset& o, const Vertex_handle vh) const +{ Offset mdo = get_offset(vh); Offset min_off = Offset(0,0,0); - min_off = (compare_distance(p,vh->point(),vh->point(), - o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,0,1))) - == SMALLER ? min_off : Offset(0,0,1) ); - min_off = (compare_distance(p,vh->point(),vh->point(), - o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,0))) - == SMALLER ? min_off : Offset(0,1,0) ); - min_off = (compare_distance(p,vh->point(),vh->point(), - o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,1))) - == SMALLER ? min_off : Offset(0,1,1) ); - min_off = (compare_distance(p,vh->point(),vh->point(), - o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,0))) - == SMALLER ? min_off : Offset(1,0,0) ); - min_off = (compare_distance(p,vh->point(),vh->point(), - o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,1))) - == SMALLER ? min_off : Offset(1,0,1) ); - min_off = (compare_distance(p,vh->point(),vh->point(), - o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,0))) - == SMALLER ? min_off : Offset(1,1,0) ); - min_off = (compare_distance(p,vh->point(),vh->point(), - o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,1))) - == SMALLER ? min_off : Offset(1,1,1) ); + min_off = (compare_distance(p, vh->point(), vh->point(), + o, combine_offsets(mdo,min_off), + combine_offsets(mdo,Offset(0,0,1))) + == SMALLER ? min_off : Offset(0,0,1) ); + min_off = (compare_distance(p, vh->point(), vh->point(), + o, combine_offsets(mdo,min_off), + combine_offsets(mdo,Offset(0,1,0))) + == SMALLER ? min_off : Offset(0,1,0) ); + min_off = (compare_distance(p, vh->point(), vh->point(), + o, combine_offsets(mdo,min_off), + combine_offsets(mdo,Offset(0,1,1))) + == SMALLER ? min_off : Offset(0,1,1) ); + min_off = (compare_distance(p, vh->point(), vh->point(), + o, combine_offsets(mdo,min_off), + combine_offsets(mdo,Offset(1,0,0))) + == SMALLER ? min_off : Offset(1,0,0) ); + min_off = (compare_distance(p, vh->point(), vh->point(), + o, combine_offsets(mdo,min_off), + combine_offsets(mdo,Offset(1,0,1))) + == SMALLER ? min_off : Offset(1,0,1) ); + min_off = (compare_distance(p, vh->point(), vh->point(), + o, combine_offsets(mdo,min_off), + combine_offsets(mdo,Offset(1,1,0))) + == SMALLER ? min_off : Offset(1,1,0) ); + min_off = (compare_distance(p, vh->point(), vh->point(), + o, combine_offsets(mdo,min_off), + combine_offsets(mdo,Offset(1,1,1))) + == SMALLER ? min_off : Offset(1,1,1) ); return combine_offsets(mdo,min_off); } @@ -782,13 +890,15 @@ Periodic_3_Delaunay_triangulation_3::get_min_dist_offset( template < class GT, class Tds > typename Periodic_3_Delaunay_triangulation_3::Vertex_handle Periodic_3_Delaunay_triangulation_3::nearest_vertex_in_cell( - const Cell_handle& c, const Point & p, const Offset & o) const { + const Cell_handle& c, const Point& p, const Offset& o) const +{ CGAL_triangulation_precondition(number_of_vertices() != 0); Vertex_handle nearest = c->vertex(0); - for (int i=1 ; i<4 ; i++) { + for(int i=1; i<4; i++) { nearest = (compare_distance(p,nearest->point(),c->vertex(i)->point(), - o,get_offset(c,c->index(nearest)),get_offset(c,i)) == SMALLER) ? - nearest : c->vertex(i); + o, get_offset(c,c->index(nearest)), + get_offset(c,i)) == SMALLER) ? + nearest : c->vertex(i); } return nearest; } @@ -799,7 +909,8 @@ Periodic_3_Delaunay_triangulation_3::nearest_vertex_in_cell( template < class Gt, class Tds > typename Periodic_3_Delaunay_triangulation_3::Vertex_handle Periodic_3_Delaunay_triangulation_3:: -move_point(Vertex_handle v, const Point & p) { +move_point(Vertex_handle v, const Point& p) +{ CGAL_triangulation_expensive_precondition(is_vertex(v)); // Remember an incident vertex to restart // the point location after the removal. @@ -809,7 +920,7 @@ move_point(Vertex_handle v, const Point & p) { remove(v); - if (number_of_vertices() == 0) + if(number_of_vertices() == 0) return insert(p); return insert(p);//, old_neighbor->cell()); } @@ -817,7 +928,7 @@ move_point(Vertex_handle v, const Point & p) { template < class Gt, class Tds > void Periodic_3_Delaunay_triangulation_3::remove(Vertex_handle v) { - typedef CGAL::Periodic_3_triangulation_remove_traits_3< Gt > P3removeT; + typedef CGAL::Periodic_3_Delaunay_triangulation_remove_traits_3 P3removeT; typedef CGAL::Delaunay_triangulation_3< P3removeT > Euclidean_triangulation; typedef Vertex_remover< Euclidean_triangulation > Remover; @@ -825,8 +936,9 @@ void Periodic_3_Delaunay_triangulation_3::remove(Vertex_handle v) Euclidean_triangulation tmp(remove_traits); Remover remover(this, tmp); Conflict_tester ct(this); + Cover_manager cover_manager(*this); - Base::remove(v, remover, ct); + Base::remove(v, remover, ct, cover_manager); CGAL_triangulation_expensive_assertion(is_valid()); } @@ -835,10 +947,10 @@ template Triple -Periodic_3_Delaunay_triangulation_3::find_conflicts( const Point -&p, - Cell_handle c, OutputIteratorBoundaryFacets bfit, - OutputIteratorCells cit, OutputIteratorInternalFacets ifit) const { +Periodic_3_Delaunay_triangulation_3::find_conflicts( + const Point& p, Cell_handle c, OutputIteratorBoundaryFacets bfit, + OutputIteratorCells cit, OutputIteratorInternalFacets ifit) const +{ CGAL_triangulation_precondition(number_of_vertices() != 0); std::vector facets; @@ -856,7 +968,7 @@ Periodic_3_Delaunay_triangulation_3::find_conflicts( const Point // Reset the conflict flag on the boundary. for(typename std::vector::iterator fit=facets.begin(); - fit != facets.end(); ++fit) { + fit != facets.end(); ++fit) { fit->first->neighbor(fit->second)->tds_data().clear(); *bfit++ = *fit; } @@ -868,9 +980,9 @@ Periodic_3_Delaunay_triangulation_3::find_conflicts( const Point *cit++ = *ccit; } - for (typename std::vector::iterator - voit = this->v_offsets.begin(); - voit != this->v_offsets.end() ; ++voit) { + for(typename std::vector::iterator + voit = this->v_offsets.begin(); + voit != this->v_offsets.end(); ++voit) { (*voit)->clear_offset(); } this->v_offsets.clear(); @@ -882,30 +994,31 @@ template < class Gt, class Tds > template OutputIterator Periodic_3_Delaunay_triangulation_3::vertices_in_conflict( - const Point&p, Cell_handle c, OutputIterator res) const { - if (number_of_vertices() == 0) return res; + const Point& p, Cell_handle c, OutputIterator res) const +{ + if(number_of_vertices() == 0) return res; // Get the facets on the boundary of the hole. std::vector facets; find_conflicts(p, c, std::back_inserter(facets), Emptyset_iterator()); - + // Then extract uniquely the vertices. std::set vertices; - for (typename std::vector::const_iterator i = facets.begin(); + for(typename std::vector::const_iterator i = facets.begin(); i != facets.end(); ++i) { vertices.insert(i->first->vertex((i->second+1)&3)); vertices.insert(i->first->vertex((i->second+2)&3)); vertices.insert(i->first->vertex((i->second+3)&3)); } - + return std::copy(vertices.begin(), vertices.end(), res); } template < class Gt, class Tds > Bounded_side Periodic_3_Delaunay_triangulation_3:: -_side_of_sphere(const Cell_handle &c, const Point &q, - const Offset &offset, bool perturb ) const { - +_side_of_sphere(const Cell_handle& c, const Point& q, + const Offset& offset, bool perturb ) const +{ Point p0 = c->vertex(0)->point(), p1 = c->vertex(1)->point(), p2 = c->vertex(2)->point(), @@ -919,44 +1032,42 @@ _side_of_sphere(const Cell_handle &c, const Point &q, Oriented_side os = ON_NEGATIVE_SIDE; os= side_of_oriented_sphere(p0, p1, p2, p3, q, o0, o1, o2, o3, oq); - if (os != ON_ORIENTED_BOUNDARY || !perturb) + if(os != ON_ORIENTED_BOUNDARY || !perturb) return (Bounded_side) os; - //We are now in a degenerate case => we do a symbolic perturbation. + //We are now in a degenerate case => we do a symbolic perturbation. // We sort the points lexicographically. Periodic_point pts[5] = {std::make_pair(p0,o0), std::make_pair(p1,o1), - std::make_pair(p2,o2), std::make_pair(p3,o3), - std::make_pair(q,oq)}; + std::make_pair(p2,o2), std::make_pair(p3,o3), + std::make_pair(q,oq)}; const Periodic_point *points[5] ={&pts[0],&pts[1],&pts[2],&pts[3],&pts[4]}; - std::sort(points, points+5, - typename Base::template Perturbation_order< - typename Gt::Compare_xyz_3 >( - geom_traits().compare_xyz_3_object() ) ); + std::sort(points, points+5, typename Base::Perturbation_order(this)); + // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. // 2 iterations are enough (cf paper) - for (int i=4; i>2; --i) { - if (points[i] == &pts[4]) { + for(int i=4; i>2; --i) { + if(points[i] == &pts[4]) { CGAL_triangulation_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3) == POSITIVE); // since p0 p1 p2 p3 are non coplanar and positively oriented return ON_UNBOUNDED_SIDE; } Orientation o; - if (points[i] == &pts[3] && + if(points[i] == &pts[3] && (o = orientation(p0, p1, p2, q, o0, o1, o2, oq)) != COPLANAR ) { return (Bounded_side) o; } - if (points[i] == &pts[2] && + if(points[i] == &pts[2] && (o = orientation(p0, p1, q, p3, o0, o1, oq, o3)) != COPLANAR ) { return (Bounded_side) o; } - if (points[i] == &pts[1] && + if(points[i] == &pts[1] && (o = orientation(p0, q, p2, p3, o0, oq, o2, o3)) != COPLANAR ) { return (Bounded_side) o; } - if (points[i] == &pts[0] && + if(points[i] == &pts[0] && (o = orientation(q, p1, p2 ,p3, oq, o1, o2, o3)) != COPLANAR ) { return (Bounded_side) o; } @@ -968,47 +1079,50 @@ _side_of_sphere(const Cell_handle &c, const Point &q, template < class Gt, class Tds > bool Periodic_3_Delaunay_triangulation_3:: -is_Gabriel(const Cell_handle c, int i) const { +is_Gabriel(const Cell_handle c, int i) const +{ CGAL_triangulation_precondition(number_of_vertices() != 0); typename Geom_traits::Side_of_bounded_sphere_3 side_of_bounded_sphere = geom_traits().side_of_bounded_sphere_3_object(); - if (side_of_bounded_sphere ( - c->vertex(vertex_triple_index(i,0))->point(), - c->vertex(vertex_triple_index(i,1))->point(), - c->vertex(vertex_triple_index(i,2))->point(), - c->vertex(i)->point(), - get_offset(c,vertex_triple_index(i,0)), - get_offset(c,vertex_triple_index(i,1)), - get_offset(c,vertex_triple_index(i,2)), - get_offset(c,i) ) == ON_BOUNDED_SIDE ) return false; + if(side_of_bounded_sphere ( + c->vertex(vertex_triple_index(i,0))->point(), + c->vertex(vertex_triple_index(i,1))->point(), + c->vertex(vertex_triple_index(i,2))->point(), + c->vertex(i)->point(), + get_offset(c,vertex_triple_index(i,0)), + get_offset(c,vertex_triple_index(i,1)), + get_offset(c,vertex_triple_index(i,2)), + get_offset(c,i) ) == ON_BOUNDED_SIDE ) + return false; + Cell_handle neighbor = c->neighbor(i); int in = neighbor->index(c); - if (side_of_bounded_sphere( - neighbor->vertex(vertex_triple_index(in,0))->point(), - neighbor->vertex(vertex_triple_index(in,1))->point(), - neighbor->vertex(vertex_triple_index(in,2))->point(), - neighbor->vertex(in)->point(), - get_offset(neighbor,vertex_triple_index(in,0)), - get_offset(neighbor,vertex_triple_index(in,1)), - get_offset(neighbor,vertex_triple_index(in,2)), - get_offset(neighbor, in) ) == ON_BOUNDED_SIDE ) + if(side_of_bounded_sphere( + neighbor->vertex(vertex_triple_index(in,0))->point(), + neighbor->vertex(vertex_triple_index(in,1))->point(), + neighbor->vertex(vertex_triple_index(in,2))->point(), + neighbor->vertex(in)->point(), + get_offset(neighbor,vertex_triple_index(in,0)), + get_offset(neighbor,vertex_triple_index(in,1)), + get_offset(neighbor,vertex_triple_index(in,2)), + get_offset(neighbor, in) ) == ON_BOUNDED_SIDE ) return false; - + return true; } template < class Gt, class Tds > bool Periodic_3_Delaunay_triangulation_3:: -is_Gabriel(const Cell_handle c, int i, int j) const { +is_Gabriel(const Cell_handle c, int i, int j) const +{ typename Geom_traits::Side_of_bounded_sphere_3 side_of_bounded_sphere = geom_traits().side_of_bounded_sphere_3_object(); - Facet_circulator fcirc = incident_facets(c,i,j), - fdone(fcirc); + Facet_circulator fcirc = incident_facets(c,i,j), fdone(fcirc); Vertex_handle v1 = c->vertex(i); Vertex_handle v2 = c->vertex(j); do { @@ -1022,9 +1136,9 @@ is_Gabriel(const Cell_handle c, int i, int j) const { Offset off1 = int_to_off(cc->offset(i1)); Offset off2 = int_to_off(cc->offset(i2)); Offset off3 = int_to_off(cc->offset(i3)); - if (side_of_bounded_sphere( - v1->point(), v2->point(), cc->vertex(fcirc->second)->point(), - off1, off2, off3) == ON_BOUNDED_SIDE ) return false; + if(side_of_bounded_sphere( + v1->point(), v2->point(), cc->vertex(fcirc->second)->point(), + off1, off2, off3) == ON_BOUNDED_SIDE ) return false; } while(++fcirc != fdone); return true; } @@ -1033,21 +1147,21 @@ template < class Gt, class Tds > bool Periodic_3_Delaunay_triangulation_3:: is_valid(bool verbose, int level) const -{ - if (!Base::is_valid(verbose, level)) { - if (verbose) +{ + if(!Base::is_valid(verbose, level)) { + if(verbose) std::cerr << "Delaunay: invalid base" << std::endl; return false; } Conflict_tester tester(this); - if (!is_valid_conflict(tester, verbose, level)) { - if (verbose) + if(!is_valid_conflict(tester, verbose, level)) { + if(verbose) std::cerr << "Delaunay: conflict problems" << std::endl; return false; } - if (verbose) + if(verbose) std::cerr << "Delaunay valid triangulation" << std::endl; return true; } @@ -1055,44 +1169,48 @@ is_valid(bool verbose, int level) const template < class GT, class TDS > bool Periodic_3_Delaunay_triangulation_3:: -is_valid(Cell_handle ch, bool verbose, int level) const { +is_valid(Cell_handle ch, bool verbose, int level) const +{ bool error = false; - if (!Base::is_valid(ch, verbose, level)) { + if(!Base::is_valid(ch, verbose, level)) { error = true; - if (verbose) { + if(verbose) { std::cerr << "geometrically invalid cell" << std::endl; - for (int i=0; i<4; i++ ) - std::cerr << ch->vertex(i)->point() << ", "; + for(int i=0; i<4; i++) + std::cerr << ch->vertex(i)->point() << ", "; std::cerr << std::endl; } } - for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++ vit) { - for (int i=-1; i<=1; i++) - for (int j=-1; j<=1; j++) - for (int k=-1; k<=1; k++) { - if (periodic_point(ch,0) == std::make_pair(periodic_point(vit).first, - periodic_point(vit).second+Offset(i,j,k)) - || periodic_point(ch,1) == std::make_pair(periodic_point(vit).first, - periodic_point(vit).second+Offset(i,j,k)) - || periodic_point(ch,2) == std::make_pair(periodic_point(vit).first, - periodic_point(vit).second+Offset(i,j,k)) - || periodic_point(ch,3) == std::make_pair(periodic_point(vit).first, - periodic_point(vit).second+Offset(i,j,k)) ) - continue; - if (_side_of_sphere(ch, periodic_point(vit).first, - periodic_point(vit).second+Offset(i,j,k),true) - != ON_UNBOUNDED_SIDE) { - error = true; - if (verbose) { - std::cerr << "Delaunay invalid cell" << std::endl; - for (int i=0; i<4; i++ ) { - Periodic_point pp = periodic_point(ch,i); - std::cerr <<"("<_side_of_sphere(c, pt, o + off, true) == ON_BOUNDED_SIDE); } - + int compare_weight(Point, Point) const { return 0; } - + bool test_initial_cell(Cell_handle c, const Offset &off) const { - if (!(operator()(c, off))) + if(!(operator()(c, off))) CGAL_triangulation_assertion(false); return true; } - + void set_point(const Point &_p) { p = _p; } @@ -1145,31 +1263,32 @@ public: void set_offset(const Offset &off) const { o = off; } - + const Offset &get_offset() const { return o; } - + const Point &point() const { return p; } - + }; template < class GT, class Tds> class Periodic_3_Delaunay_triangulation_3::Point_hider { public: - Point_hider() {} + Point_hider() { } + + void set_original_cube (bool) const { } template - inline void set_vertices(InputIterator, InputIterator) const {} - inline void reinsert_vertices(Vertex_handle ) {} - inline Vertex_handle replace_vertex(Cell_handle c, int index, - const Point &) { + inline void set_vertices(InputIterator, InputIterator) const { } + inline void reinsert_vertices(Vertex_handle ) { } + inline Vertex_handle replace_vertex(Cell_handle c, int index, const Point &) { return c->vertex(index); } - inline void hide_point(Cell_handle, const Point &) {} + inline void hide_point(Cell_handle, const Point &) { } inline void hide(Point &, Cell_handle ) const { CGAL_triangulation_assertion(false); @@ -1178,54 +1297,50 @@ public: inline void do_hide(const Point &, Cell_handle ) const { CGAL_triangulation_assertion(false); } - template < class Tester > + template < class Tester > inline bool replace_vertex(const Point &, Vertex_handle , - const Tester &) const { + const Tester &) const { return true; } template - inline void hide_points(Vertex_handle, - const Conflict_tester &) { + inline void hide_points(Vertex_handle, const Conflict_tester &) { // No points to hide in the Delaunay triangulation. } - }; -#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG +#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG template template struct Periodic_3_Delaunay_triangulation_3::Vertex_remover { typedef TriangulationR3 Triangulation_R3; - + typedef typename std::vector::iterator Hidden_points_iterator; - + typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple; - + typedef typename Triangulation_R3::Triangulation_data_structure TDSE; typedef typename Triangulation_R3::Cell_handle CellE_handle; typedef typename Triangulation_R3::Vertex_handle VertexE_handle; typedef typename Triangulation_R3::Facet FacetE; typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator; - - typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle > - VertexE_triple; - - typedef std::map Vertex_triple_Facet_map; + + typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle > VertexE_triple; + + typedef std::map Vertex_triple_Facet_map; typedef std::map Vertex_triple_FacetE_map; - typedef typename Vertex_triple_FacetE_map::iterator - Vertex_triple_FacetE_map_it; - + typedef typename Vertex_triple_FacetE_map::iterator Vertex_triple_FacetE_map_it; + Vertex_remover(const Self *t, Triangulation_R3 &tmp_) : _t(t),tmp(tmp_) {} - + const Self *_t; Triangulation_R3 &tmp; - + void add_hidden_points(Cell_handle) { - std::copy (hidden_points_begin(), hidden_points_end(), - std::back_inserter(hidden)); + std::copy(hidden_points_begin(), hidden_points_end(), + std::back_inserter(hidden)); } - + Hidden_points_iterator hidden_points_begin() { return hidden.begin(); } @@ -1239,6 +1354,161 @@ struct Periodic_3_Delaunay_triangulation_3::Vertex_remover }; #endif //CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG -} //namespace CGAL +template < class GT, class TDS > +inline bool +Periodic_3_Delaunay_triangulation_3:: +is_extensible_triangulation_in_1_sheet_h1() const +{ + if(!is_1_cover()) { + if(too_long_edge_counter == 0) return true; + else return false; + } else { + typename Geometric_traits::FT longest_edge_squared_length(0); + Segment s; + for(Periodic_segment_iterator psit = this->periodic_segments_begin(Base::UNIQUE); + psit != this->periodic_segments_end(Base::UNIQUE); ++psit) { + s = this->construct_segment(*psit); + longest_edge_squared_length = (std::max)(longest_edge_squared_length, + s.squared_length()); + } + return (longest_edge_squared_length < edge_length_threshold); + } +} + +template < class GT, class TDS > +inline bool +Periodic_3_Delaunay_triangulation_3:: +is_extensible_triangulation_in_1_sheet_h2() const +{ + typedef typename Geometric_traits::Construct_circumcenter_3 + Construct_circumcenter; + typedef typename Geometric_traits::FT FT; + Construct_circumcenter construct_circumcenter + = geom_traits().construct_circumcenter_3_object(); + for(Periodic_tetrahedron_iterator tit = this->periodic_tetrahedra_begin(Base::UNIQUE); + tit != this->periodic_tetrahedra_end(Base::UNIQUE); ++tit) { + Point cc = construct_circumcenter( + tit->at(0).first, tit->at(1).first, + tit->at(2).first, tit->at(3).first, + tit->at(0).second, tit->at(1).second, + tit->at(2).second, tit->at(3).second); + + if( !(FT(16)*squared_distance(cc,point(tit->at(0))) + < (domain().xmax()-domain().xmin())*(domain().xmax()-domain().xmin())) ) + return false; + } + return true; +} + +template < class GT, class TDS > +inline void +Periodic_3_Delaunay_triangulation_3:: +copy_multiple_covering(const Periodic_3_Delaunay_triangulation_3 & tr) +{ + // Write the respective offsets in the vertices to make them + // automatically copy with the tds. + for(Vertex_iterator vit = tr.vertices_begin(); vit != tr.vertices_end(); ++vit) { + vit->set_offset(tr.get_offset(vit)); + } + + // copy the tds + tds() = tr.tds(); + // make a list of all vertices that belong to the original + // domain and initialize the basic structure of + // virtual_vertices_reverse + std::list vlist; + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { + if(vit->offset() == Offset()) { + vlist.push_back(vit); + this->virtual_vertices_reverse.insert( + std::make_pair(vit,std::vector(26))); + CGAL_triangulation_assertion(this->virtual_vertices_reverse.find(vit) + ->second.size() == 26); + } + } + + // Iterate over all vertices that are not in the original domain + // and construct the respective entries to virtual_vertices and + // virtual_vertices_reverse + for(Vertex_iterator vit2 = vertices_begin(); vit2 != vertices_end(); ++vit2) { + if(vit2->offset() != Offset()) { + typename std::list::iterator vlist_it + = std::find_if(vlist.begin(), vlist.end(), + typename Base::Finder(this,vit2->point())); + Offset off = vit2->offset(); + this->virtual_vertices.insert(std::make_pair(vit2, + std::make_pair(*vlist_it,off))); + this->virtual_vertices_reverse.find(*vlist_it) + ->second[9*off[0]+3*off[1]+off[2]-1]=vit2; + CGAL_triangulation_assertion(get_offset(vit2) == off); + } + } + + // Cleanup vertex offsets + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) + vit->clear_offset(); + for(Vertex_iterator vit = tr.vertices_begin(); vit != tr.vertices_end(); ++vit) + vit->clear_offset(); + + // Build up the too_long_edges container + too_long_edge_counter = 0; + too_long_edges.clear(); + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) + too_long_edges[vit] = std::list(); + + std::pair edge_to_add; + Point p1, p2; + int i, j; + for(Edge_iterator eit = edges_begin(); eit != edges_end(); ++eit) { + if(&*(eit->first->vertex(eit->second)) < &*(eit->first->vertex(eit->third))) { + i = eit->second; j = eit->third; + } else { + i = eit->third; j = eit->second; + } + edge_to_add = std::make_pair(eit->first->vertex(i), + eit->first->vertex(j)); + p1 = construct_point(eit->first->vertex(i)->point(), + get_offset(eit->first, i)); + p2 = construct_point(eit->first->vertex(j)->point(), + get_offset(eit->first, j)); + Vertex_handle v_no = eit->first->vertex(i); + if(squared_distance(p1,p2) > edge_length_threshold) { + CGAL_triangulation_assertion( + find(too_long_edges[v_no].begin(), + too_long_edges[v_no].end(), + edge_to_add.second) == too_long_edges[v_no].end()); + too_long_edges[v_no].push_back(edge_to_add.second); + too_long_edge_counter++; + } + } +} + +template < class GT, class TDS > +std::istream & +operator>> (std::istream& is, Periodic_3_Delaunay_triangulation_3 &tr) +{ + typedef Periodic_3_Delaunay_triangulation_3 P3DT3; + typedef typename P3DT3::Base Base; + typedef typename P3DT3::Vertex_iterator Vertex_iterator; + typedef typename GT::FT FT; + typedef typename P3DT3::Vertex_handle Vertex_handle; + + is >> static_cast(tr); + + int i = 0; + for(Vertex_iterator vi = tr.vertices_begin(); vi != tr.vertices_end(); ++vi) { + tr.too_long_edges[vi]=std::list(); + ++i; + } + + tr.edge_length_threshold = FT(0.166) * (tr.domain().xmax()-tr.domain().xmin()) + * (tr.domain().xmax()-tr.domain().xmin()); + tr.too_long_edge_counter = tr.find_too_long_edges(tr.too_long_edges); + + CGAL_triangulation_expensive_assertion( tr.is_valid() ); + return is; +} + +} // namespace CGAL #endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h deleted file mode 100644 index c2ffee5c218..00000000000 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_filtered_traits_3.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2004,2006-2009 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Sylvain Pion -// Nico Kruithof -// Manuel Caroli - - -#ifndef CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H -#define CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H - -#include - - -#define CGAL_DEPRECATED_HEADER "" -#define CGAL_REPLACEMENT_HEADER "" -#include - -#include - -#endif // CGAL_PERIODIC_3_TRIANGULATION_FILTERED_TRAITS_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h index f474d0e060a..0a71cd2075a 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_Delaunay_triangulation_traits_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 INRIA Sophia-Antipolis (France). +// Copyright (c) 2006-2009, 2017 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -14,100 +14,105 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Nico Kruithof // Manuel Caroli +// Mael Rouxel-Labbé #ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H #define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_TRAITS_3_H #include - -#include +#include +#include #include -#include -#include -#include -#include #include +#include +#include -namespace CGAL { +namespace CGAL { -template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 > +template < class K, class Off = typename CGAL::Periodic_3_offset_3 > class Periodic_3_Delaunay_triangulation_traits_base_3 - : public Periodic_3_triangulation_traits_base_3 + : public Periodic_3_triangulation_traits_3 { + typedef Periodic_3_Delaunay_triangulation_traits_base_3 Self; + typedef Periodic_3_triangulation_traits_3 Base; + public: - typedef Kernel K; - typedef Off Offset; - typedef Periodic_3_triangulation_traits_base_3 Base; - typedef Periodic_3_Delaunay_triangulation_traits_base_3< K, Offset > Self; + typedef K Kernel; + typedef Off Offset; typedef typename Base::RT RT; typedef typename Base::FT FT; typedef typename Base::Point_3 Point_3; - typedef typename Base::Vector_3 Vector_3; typedef typename Base::Periodic_3_offset_3 Periodic_3_offset_3; typedef typename Base::Iso_cuboid_3 Iso_cuboid_3; // The next typedef is there for backward compatibility // Some users take their point type from the traits class. // Before this type was Point - typedef Point_3 Point; + typedef Point_3 Point; - typedef typename Base::Segment_3 Segment_3; - typedef typename Base::Triangle_3 Triangle_3; - typedef typename Base::Tetrahedron_3 Tetrahedron_3; + typedef typename Base::Segment_3 Segment_3; + typedef typename Base::Triangle_3 Triangle_3; + typedef typename Base::Tetrahedron_3 Tetrahedron_3; + +public: + Periodic_3_Delaunay_triangulation_traits_base_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } // Delaunay specific predicates - typedef Traits_with_offsets_adaptor + typedef Functor_with_offset_points_adaptor Side_of_oriented_sphere_3; - typedef Traits_with_offsets_adaptor + typedef Functor_with_offset_points_adaptor Compare_distance_3; - typedef Traits_with_offsets_adaptor - Side_of_bounded_sphere_3; - // Degenerate dimension predicates - typedef Traits_with_offsets_adaptor + // Required for Periodic_3_Delaunay_triangulation_remove_traits + typedef Functor_with_offset_points_adaptor Coplanar_orientation_3; - typedef Traits_with_offsets_adaptor + typedef Functor_with_offset_points_adaptor Coplanar_side_of_bounded_circle_3; + // When is_Gabriel is used + typedef Functor_with_offset_points_adaptor + Side_of_bounded_sphere_3; + // Delaunay specific constructions - typedef Traits_with_offsets_adaptor + typedef Functor_with_offset_points_adaptor Construct_circumcenter_3; + using Base::construct_point_3_object; + // Operations - Side_of_oriented_sphere_3 - side_of_oriented_sphere_3_object() const { - return Side_of_oriented_sphere_3(&this->_domain); + Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const { + return Side_of_oriented_sphere_3(this->Base::side_of_oriented_sphere_3_object(), + construct_point_3_object()); } - Compare_distance_3 - compare_distance_3_object() const { - return Compare_distance_3(&this->_domain); + Compare_distance_3 compare_distance_3_object() const { + return Compare_distance_3(this->Base::compare_distance_3_object(), + construct_point_3_object()); } - Side_of_bounded_sphere_3 - side_of_bounded_sphere_3_object() const { - return Side_of_bounded_sphere_3(&this->_domain); + Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const { + return Side_of_bounded_sphere_3(this->Base::side_of_bounded_sphere_3_object(), + construct_point_3_object()); } - Coplanar_orientation_3 - coplanar_orientation_3_object() const { - return Coplanar_orientation_3(&this->_domain); + Coplanar_orientation_3 coplanar_orientation_3_object() const { + return Coplanar_orientation_3(this->Base::coplanar_orientation_3_object(), + construct_point_3_object()); } - Coplanar_side_of_bounded_circle_3 - coplanar_side_of_bounded_circle_3_object() const { - return Coplanar_side_of_bounded_circle_3(&this->_domain); + Coplanar_side_of_bounded_circle_3 coplanar_side_of_bounded_circle_3_object() const { + return Coplanar_side_of_bounded_circle_3(this->Base::coplanar_side_of_bounded_circle_3_object(), + construct_point_3_object()); } - Construct_circumcenter_3 - construct_circumcenter_3_object() const { - return Construct_circumcenter_3(&this->_domain); + Construct_circumcenter_3 construct_circumcenter_3_object() const { + return Construct_circumcenter_3(this->Base::construct_circumcenter_3_object(), + construct_point_3_object()); } }; @@ -123,24 +128,36 @@ class Periodic_3_Delaunay_triangulation_traits_3; namespace CGAL { -// This declaration is needed to break the cyclic dependency. -template < typename K, typename Off, bool Has_static_filters > -class Periodic_3_Delaunay_triangulation_filtered_traits_3; - template < class K, class Off> class Periodic_3_Delaunay_triangulation_traits_3 : public Periodic_3_Delaunay_triangulation_traits_base_3 { + typedef Periodic_3_Delaunay_triangulation_traits_base_3 Base; + public: - typedef K Kernel; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_Delaunay_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1), + const K& k = K()) + : Base(domain, k) + { } }; template < typename K, typename Off > -class Periodic_3_Delaunay_triangulation_traits_3 - : public Periodic_3_Delaunay_triangulation_filtered_traits_3 < K, Off, internal::Has_static_filters::value > +class Periodic_3_Delaunay_triangulation_traits_3 + : public Periodic_3_Delaunay_triangulation_filtered_traits_3< + K, Off, internal::Has_static_filters::value> { + typedef Periodic_3_Delaunay_triangulation_filtered_traits_3< + K, Off, internal::Has_static_filters::value> Base; + public: - typedef K Kernel; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_Delaunay_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1), + const K& k = K()) + : Base(domain, k) + { } }; } //namespace CGAL diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h index 4c6284c5ca4..d9951e2a671 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_offset_3.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Nico Kruithof // Manuel Caroli @@ -24,18 +24,18 @@ #include - #include #include #include -namespace CGAL { +namespace CGAL { -class Periodic_3_offset_3 { +class Periodic_3_offset_3 +{ template - friend std::ostream & operator<<(std::ostream &os, - const Periodic_3_offset_3 &off); - + friend std::ostream & operator<<(std::ostream &os, + const Periodic_3_offset_3 &off); + public: Periodic_3_offset_3() : _offx(0), _offy(0), _offz(0) {} Periodic_3_offset_3(int x, int y, int z) : _offx(x), _offy(y), _offz(z) {} @@ -78,13 +78,13 @@ public: } bool operator==(const Periodic_3_offset_3 &other) const { return ((_offx == other._offx) && - (_offy == other._offy) && - (_offz == other._offz)); + (_offy == other._offy) && + (_offz == other._offz)); } bool operator!=(const Periodic_3_offset_3 &other) const { return ((_offx != other._offx) || - (_offy != other._offy) || - (_offz != other._offz)); + (_offy != other._offy) || + (_offz != other._offz)); } bool operator<(const Periodic_3_offset_3 &other) const { if (_offx != other._offx) @@ -104,8 +104,8 @@ public: Periodic_3_offset_3 operator-(const Periodic_3_offset_3 &off2) const { return Periodic_3_offset_3(_offx-off2.x(), _offy-off2.y(), _offz-off2.z()); } - -private: + +private: int _offx, _offy, _offz; }; @@ -114,7 +114,7 @@ inline Point_3 operator+(const Point_3 &p, const Periodic_3_offset_3 &off) return (off.is_null() ? p : Point_3(p.x()+off.x(), p.y()+off.y(), p.z()+off.z())); } -inline std::ostream +inline std::ostream &operator<<(std::ostream &os, const Periodic_3_offset_3 &off) { if (is_ascii(os)) os << off.x() << " " << off.y() << " " << off.z(); diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h new file mode 100644 index 00000000000..dc3fd07ec26 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -0,0 +1,1419 @@ +// Copyright (c) 1999-2004,2006-2009,2013-2015,2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Author(s) : Monique Teillaud +// Aymeric Pelle +// Mael Rouxel-Labbé + +#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_3_H +#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_3_H + +#include + +// Needed by remove to fill the hole. +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace CGAL +{ +template < class Gt, + class Tds = + Triangulation_data_structure_3 < + Regular_triangulation_vertex_base_3 >, + Regular_triangulation_cell_base_3 > + > + > +class Periodic_3_regular_triangulation_3 + : public Periodic_3_triangulation_3 +{ + typedef Periodic_3_regular_triangulation_3 Self; + +public: + typedef Periodic_3_triangulation_3 Tr_Base; + + typedef Gt Geometric_traits; + typedef Geometric_traits Geom_traits; + typedef Tds Triangulation_data_structure; + + typedef typename Gt::FT FT; + + typedef typename Tr_Base::Periodic_segment_3 Periodic_segment_3; + typedef typename Tr_Base::Periodic_triangle_3 Periodic_triangle_3; + typedef typename Tr_Base::Periodic_tetrahedron_3 Periodic_tetrahedron_3; + typedef typename Tr_Base::Periodic_segment Periodic_segment; + typedef typename Tr_Base::Periodic_triangle Periodic_triangle; + typedef typename Tr_Base::Periodic_tetrahedron Periodic_tetrahedron; + typedef typename Tr_Base::Periodic_tetrahedron_iterator Periodic_tetrahedron_iterator; + + typedef typename Tr_Base::Vertex_handle Vertex_handle; + typedef typename Tr_Base::Cell_handle Cell_handle; + + typedef typename Tr_Base::Vertex Vertex; + typedef typename Tr_Base::Edge Edge; + typedef typename Tr_Base::Facet Facet; + typedef typename Tr_Base::Cell Cell; + + typedef typename Tr_Base::Vertex_iterator Vertex_iterator; + typedef typename Tr_Base::Edge_iterator Edge_iterator; + typedef typename Tr_Base::Facet_iterator Facet_iterator; + typedef typename Tr_Base::Facet_circulator Facet_circulator; + typedef typename Tr_Base::Cell_iterator Cell_iterator; + typedef typename Tr_Base::Cell_circulator Cell_circulator; + + typedef typename Tr_Base::All_vertices_iterator All_vertices_iterator; + typedef typename Tr_Base::All_edges_iterator All_edges_iterator; + typedef typename Tr_Base::All_facets_iterator All_facets_iterator; + typedef typename Tr_Base::All_cells_iterator All_cells_iterator; + + typedef typename Tr_Base::size_type size_type; + typedef typename Tr_Base::difference_type difference_type; + typedef typename Tr_Base::Locate_type Locate_type; + + typedef typename Tr_Base::Offset Offset; + typedef typename Tr_Base::Iso_cuboid Iso_cuboid; + typedef typename Tr_Base::Covering_sheets Covering_sheets; + + // Traits are not supposed to define "Bare_point", but checking for backward compatibility + typedef typename boost::mpl::eval_if_c< + internal::Has_nested_type_Bare_point::value, + typename internal::Bare_point_type, + boost::mpl::identity + >::type Bare_point; + typedef typename Gt::Weighted_point_3 Weighted_point; + + typedef std::pair Periodic_bare_point; + typedef std::pair Periodic_weighted_point; + + typedef typename Gt::Segment_3 Segment; + typedef typename Gt::Triangle_3 Triangle; + typedef typename Gt::Tetrahedron_3 Tetrahedron; + + typedef typename Gt::Object_3 Object; + + //Tag to distinguish Delaunay from Regular triangulations + typedef Tag_true Weighted_tag; + +#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2 + using Tr_Base::cw; + using Tr_Base::ccw; + using Tr_Base::domain; + using Tr_Base::geom_traits; + using Tr_Base::int_to_off; + using Tr_Base::is_1_cover; + using Tr_Base::is_virtual; + using Tr_Base::mirror_vertex; + using Tr_Base::number_of_vertices; + using Tr_Base::number_of_edges; + using Tr_Base::number_of_facets; + using Tr_Base::number_of_cells; + using Tr_Base::number_of_sheets; + using Tr_Base::next_around_edge; + using Tr_Base::orientation; + using Tr_Base::point; + using Tr_Base::set_offsets; + using Tr_Base::swap; + using Tr_Base::tds; + using Tr_Base::vertex_triple_index; + using Tr_Base::vertices_begin; + using Tr_Base::vertices_end; + using Tr_Base::edges_begin; + using Tr_Base::edges_end; + using Tr_Base::facets_begin; + using Tr_Base::facets_end; + using Tr_Base::cells_begin; + using Tr_Base::cells_end; +#endif + + // For strict-ansi compliance + using Tr_Base::combine_offsets; + using Tr_Base::draw_dual; + using Tr_Base::find_conflicts; + using Tr_Base::get_offset; + using Tr_Base::get_original_vertex; + using Tr_Base::get_location_offset; + using Tr_Base::adjacent_vertices; + using Tr_Base::incident_edges; + using Tr_Base::incident_facets; + using Tr_Base::incident_cells; + using Tr_Base::is_valid_conflict; + using Tr_Base::locate; + using Tr_Base::neighbor_offset; + using Tr_Base::periodic_point; +#ifndef CGAL_NO_STRUCTURAL_FILTERING + using Tr_Base::inexact_locate; +#endif + +private: + struct Cell_handle_hash + : public std::unary_function + { + std::size_t operator()(const Cell_handle& ch) const { + return boost::hash()(&*ch); + } + }; + + boost::unordered_set cells_with_too_big_orthoball; + + class Cover_manager + { + Periodic_3_regular_triangulation_3& tr; + +public: + Cover_manager (Periodic_3_regular_triangulation_3& tr) + : tr(tr) + { } + + void create_initial_triangulation() { + tr.create_initial_triangulation(); + } + + template + void delete_unsatisfying_elements(const CellIt begin, const CellIt end) { + tr.delete_cells_with_too_big_orthoball(begin, end); + } + + template + void insert_unsatisfying_elements(Vertex_handle v, const CellIt begin, const CellIt end) { + tr.insert_cells_with_too_big_orthoball(v, begin, end); + } + + bool can_be_converted_to_1_sheet () const { + return tr.can_be_converted_to_1_sheet(); + } + + bool update_cover_data_during_management (Cell_handle new_ch, const std::vector& new_cells) { + return tr.update_cover_data_during_management(new_ch, new_cells); + } + }; + +public: + /** @name Creation */ //@{ + Periodic_3_regular_triangulation_3 (const Iso_cuboid& domain = Iso_cuboid(0, 0, 0, 1, 1, 1), + const Geometric_traits& gt = Geometric_traits()) + : Tr_Base(domain, gt) + { } + + // copy constructor duplicates vertices and cells + Periodic_3_regular_triangulation_3 (const Periodic_3_regular_triangulation_3& tr) + : Tr_Base(tr) + { + if(is_1_cover()) + tds() = tr.tds(); + else + this->copy_multiple_covering(tr); + + CGAL_triangulation_expensive_postcondition(*this == tr); + CGAL_triangulation_expensive_postcondition( is_valid() ); + } + + template < typename InputIterator > + Periodic_3_regular_triangulation_3(InputIterator first, InputIterator last, + const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1), + const Geometric_traits& gt = Geometric_traits(), + bool is_large_point_set = false) + : Tr_Base(domain, gt) + { + insert(first, last, is_large_point_set); + } + + void copy_multiple_covering(const Periodic_3_regular_triangulation_3& tr) + { + // Write the respective offsets in the vertices to make them + // automatically copy with the tds. + for(Vertex_iterator vit = tr.vertices_begin(); vit != tr.vertices_end(); ++vit) { + vit->set_offset(tr.get_offset(vit)); + } + + // copy the tds + tds() = tr.tds(); + + // make a list of all vertices that belong to the original + // domain and initialize the basic structure of + // virtual_vertices_reverse + std::list vlist; + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { + if(vit->offset() == Offset()) { + vlist.push_back(vit); + this->virtual_vertices_reverse.insert( + std::make_pair(vit,std::vector(26))); + CGAL_triangulation_assertion(this->virtual_vertices_reverse.find(vit) + ->second.size() == 26); + } + } + + // Iterate over all vertices that are not in the original domain + // and construct the respective entries to virtual_vertices and + // virtual_vertices_reverse + for(Vertex_iterator vit2 = vertices_begin(); + vit2 != vertices_end(); ++vit2) { + if(vit2->offset() != Offset()) { + typename std::list::iterator vlist_it + = std::find_if(vlist.begin(), vlist.end(), + typename Tr_Base::Finder(this,vit2->point())); + Offset off = vit2->offset(); + this->virtual_vertices.insert(std::make_pair(vit2, + std::make_pair(*vlist_it,off))); + this->virtual_vertices_reverse.find(*vlist_it) + ->second[9*off[0]+3*off[1]+off[2]-1]=vit2; + CGAL_triangulation_assertion(get_offset(vit2) == off); + } + } + + // Cleanup vertex offsets + for(Vertex_iterator vit = vertices_begin(); + vit != vertices_end(); ++vit) + vit->clear_offset(); + for(Vertex_iterator vit = tr.vertices_begin(); + vit != tr.vertices_end(); ++vit) + vit->clear_offset(); + + insert_cells_with_too_big_orthoball(tr.cells_begin(), tr.cells_end()); + } + + Periodic_3_regular_triangulation_3 operator= (Periodic_3_regular_triangulation_3 tr) + { + tr.swap(*this); + return *this; + } + + void swap(Periodic_3_regular_triangulation_3&tr) + { + std::swap(cells_with_too_big_orthoball, tr.cells_with_too_big_orthoball); + Tr_Base::swap(tr); + } + + void create_initial_triangulation() + { + CGAL_triangulation_assertion( cells_with_too_big_orthoball.empty() ); + + for(Cell_iterator iter = cells_begin(), end_iter = cells_end(); iter != end_iter; ++iter) + cells_with_too_big_orthoball.insert(iter); + } + + template + void delete_cells_with_too_big_orthoball(CellIt begin, const CellIt end) + { + for(; begin != end; ++begin) + { + typename boost::unordered_set::iterator iter = cells_with_too_big_orthoball.find(*begin); + if(iter != cells_with_too_big_orthoball.end()) + { + cells_with_too_big_orthoball.erase(iter); + } + } + } + + CGAL::Comparison_result compare_orthsphere_radius_to_threshold ( + const Periodic_weighted_point& p0, const Periodic_weighted_point& p1, + const Periodic_weighted_point& p2, const Periodic_weighted_point& p3, + const FT threshold) const + { + return geom_traits().compare_weighted_squared_radius_3_object()( + p0.first, p1.first, p2.first, p3.first, + p0.second, p1.second, p2.second, p3.second, + threshold); + } + + CGAL::Comparison_result compare_orthsphere_radius_to_threshold (Cell_handle cell, + const FT threshold) const + { + Periodic_weighted_point p0 = periodic_point(cell, 0); + Periodic_weighted_point p1 = periodic_point(cell, 1); + Periodic_weighted_point p2 = periodic_point(cell, 2); + Periodic_weighted_point p3 = periodic_point(cell, 3); + + return compare_orthsphere_radius_to_threshold(p0, p1, p2, p3, threshold); + } + + template + void insert_cells_with_too_big_orthoball(Vertex_handle /*v*/, CellIt begin, const CellIt end) + { + FT threshold = FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()); + for(; begin != end; ++begin) + { + if(compare_orthsphere_radius_to_threshold(*begin, threshold) != CGAL::SMALLER) + { + cells_with_too_big_orthoball.insert(*begin); + } + } + } + + void insert_cells_with_too_big_orthoball(Cell_iterator begin, Cell_iterator end) + { + FT threshold = FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()); + for(; begin != end; ++begin) + { + if(compare_orthsphere_radius_to_threshold(begin, threshold) != CGAL::SMALLER) + { + cells_with_too_big_orthoball.insert(begin); + } + } + } + + bool can_be_converted_to_1_sheet () const + { + return cells_with_too_big_orthoball.empty(); + } + + bool update_cover_data_during_management (Cell_handle new_ch, const std::vector& new_cells) + { + bool result = false; + FT threshold = FT(0.015625) * (domain().xmax() - domain().xmin()) * (domain().xmax() - domain().xmin()); + + if(compare_orthsphere_radius_to_threshold(new_ch, threshold) != CGAL::SMALLER) + { + if(is_1_cover()) + { + tds().delete_cells(new_cells.begin(), new_cells.end()); + this->convert_to_27_sheeted_covering(); + result = true; + } + else + { + cells_with_too_big_orthoball.insert(new_ch); + } + } + + return result; + } + + virtual void update_cover_data_after_converting_to_27_sheeted_covering () + { + FT threshold = FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax() - domain().xmin()); + for(Cell_iterator iter = cells_begin(), end_iter = cells_end(); iter != end_iter; ++iter) + { + if(compare_orthsphere_radius_to_threshold(iter, threshold) != CGAL::SMALLER) + { + cells_with_too_big_orthoball.insert(iter); + } + } + } + + // in the regular setting, there is nothing to do since we use `cells_with_too_big_orthoball` + // instead of an edge length threshold + virtual void update_cover_data_after_setting_domain () {} + + // the function below is used in `convert_to_1_sheeted_covering()` of P3T3 + // but only makes sense for regular triangulations. + virtual void gather_cell_hidden_points(const Cell_handle cit, + std::vector& hidden_points) + { + std::copy(cit->hidden_points_begin(), cit->hidden_points_end(), + std::back_inserter(hidden_points)); + } + + virtual void reinsert_hidden_points_after_converting_to_1_sheeted(const std::vector& hidden_points) + { + typename std::vector::const_iterator wpv_it = hidden_points.begin(); + typename std::vector::const_iterator wpv_end = hidden_points.end(); + + while(wpv_it != wpv_end) + insert(*wpv_it++); + } + + /** @name Insertion */ //@{ + Vertex_handle insert(const Weighted_point& point, + Cell_handle start = Cell_handle()) + { + Conflict_tester tester(point, this); + Point_hider hider(this); + Cover_manager cover_manager(*this); + CGAL_triangulation_precondition(point.weight() >= 0); + CGAL_triangulation_precondition_msg + ( + point.weight() < ( FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()) ), + "point.weight() < 1/64 * domain_size * domain_size" + ); + return Tr_Base::insert_in_conflict(point, start, tester, hider, cover_manager); + } + + Vertex_handle insert(const Weighted_point& point, + Locate_type lt, Cell_handle c, + int li, int lj) + { + Conflict_tester tester(point, this); + Point_hider hider(this); + Cover_manager cover_manager(*this); + CGAL_triangulation_precondition(point.weight() >= 0); + CGAL_triangulation_precondition_msg + ( + point.weight() < ( FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()) ), + "point.weight() < 1/64 * domain_size * domain_size" + ); + return Tr_Base::insert_in_conflict(point,lt,c,li,lj, tester,hider,cover_manager); + } + + template < class InputIterator > + std::ptrdiff_t insert(InputIterator first, InputIterator last, + bool is_large_point_set = false) + { + if(first == last) + return 0; + + CGAL_triangulation_precondition_code + ( + bool precondition_is_satisfied = true; + FT upper_bound = FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()); + for(InputIterator pc_first = first, pc_last = last; pc_first != pc_last; ++pc_first) + { + if(pc_first->weight() < FT(0) || pc_first->weight() >= upper_bound) + { + precondition_is_satisfied = false; + break; + } + } + ) + + CGAL_triangulation_precondition_msg + ( + precondition_is_satisfied, + "0 <= point.weight() < 1/64 * domain_size * domain_size" + ); + + size_type n = number_of_vertices(); + // The heuristic discards the existing triangulation so it can only be + // applied to empty triangulations. + if(n != 0) + is_large_point_set = false; + + std::vector points(first, last); + std::random_shuffle(points.begin(), points.end()); + Cell_handle hint; + std::vector dummy_points_vhs, double_vertices; + std::vector dummy_points; + typename std::vector::iterator pbegin = points.begin(); + if(is_large_point_set) + { + dummy_points_vhs = insert_dummy_points(); + dummy_points.reserve(dummy_points_vhs.size()); + for(typename std::vector::iterator iter = dummy_points_vhs.begin(), end_iter = dummy_points_vhs.end(); iter != end_iter; ++iter) + dummy_points.push_back((*iter)->point()); + } + else + { + while(!is_1_cover()) + { + insert(*pbegin); + ++pbegin; + if(pbegin == points.end()) + return number_of_vertices() - n; + } + } + + // Spatial sorting can only be applied to bare points, so we need an adaptor + typedef typename Geom_traits::Construct_point_3 Construct_point_3; + typedef typename boost::result_of::type Ret; + typedef boost::function_property_map fpmap; + typedef CGAL::Spatial_sort_traits_adapter_3 Search_traits_3; + + spatial_sort(pbegin, points.end(), + Search_traits_3( + boost::make_function_property_map( + geom_traits().construct_point_3_object()), geom_traits())); + + Conflict_tester tester(*pbegin, this); + Point_hider hider(this); + Cover_manager cover_manager(*this); + double_vertices = Tr_Base::insert_in_conflict(pbegin, points.end(), hint, tester, hider, cover_manager); + + if(is_large_point_set) + { + for(unsigned int i = 0; i < dummy_points_vhs.size(); ++i) + { + bool is_hidden = false; + for(Cell_iterator iter = this->cells_begin(); iter != this->cells_end(); ++iter) + { + typename Cell::Point_iterator it = std::find(iter->hidden_points_begin(), iter->hidden_points_end(), dummy_points[i]); + if(it != iter->hidden_points_end()) + { + is_hidden = true; + iter->unhide_point(it); + } + } + if(!is_hidden) + if(std::find(double_vertices.begin(), double_vertices.end(), dummy_points_vhs[i]) == double_vertices.end()) + remove(dummy_points_vhs[i]); + } + } + + return number_of_vertices() - n; + } +//@} + + void remove(Vertex_handle v) + { + typedef CGAL::Periodic_3_regular_triangulation_remove_traits_3< Gt > P3removeT; + typedef CGAL::Regular_triangulation_3< P3removeT > Euclidean_triangulation; + typedef Vertex_remover< Euclidean_triangulation > Remover; + P3removeT remove_traits(domain()); + Euclidean_triangulation tmp(remove_traits); + Remover remover(this, tmp); + Conflict_tester ct(this); + Cover_manager cover_manager(*this); + + Tr_Base::remove(v, remover, ct, cover_manager); + + // Re-insert the points that v was hiding. + for(typename Remover::Hidden_points_iterator hi = remover.hidden_points_begin(); + hi != remover.hidden_points_end(); ++hi) + { + insert(*hi); + } + + CGAL_triangulation_expensive_assertion(is_valid()); + } + +public: + /** @name Wrapping the traits */ //@{ + bool less_power_distance (const Bare_point &p, const Weighted_point &q, const Weighted_point &r) const + { + return geom_traits().compare_power_distance_3_object()(p, q, r) == SMALLER; + } + + bool less_power_distance (const Bare_point &p, const Weighted_point &q, const Weighted_point &r, + const Offset &o1, const Offset &o2, const Offset &o3) const + { + return geom_traits().compare_power_distance_3_object()(p, q, r, o1, o2, o3) == SMALLER; + } + + Bare_point construct_weighted_circumcenter(const Weighted_point &p, const Weighted_point &q, + const Weighted_point &r) const + { + return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r); + } + Bare_point construct_weighted_circumcenter(const Weighted_point &p, const Weighted_point &q, + const Weighted_point &r, + const Offset& o1, const Offset& o2, + const Offset& o3) const + { + return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r,o1,o2,o3); + } + Bare_point construct_weighted_circumcenter (const Weighted_point &p, const Weighted_point &q, + const Weighted_point &r, const Weighted_point &s) const + { + return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r,s); + } + Bare_point construct_weighted_circumcenter (const Weighted_point &p, const Weighted_point &q, + const Weighted_point &r, const Weighted_point &s, + const Offset& o1, const Offset& o2, + const Offset& o3, const Offset& o4) const + { + return geom_traits().construct_weighted_circumcenter_3_object()(p,q,r,s, o1,o2,o3,o4); + } + + Comparison_result compare_distance(const Bare_point &p, const Weighted_point &q, + const Weighted_point &r) const { + return geom_traits().compare_power_distance_3_object()(p, q, r); + } + Comparison_result compare_distance(const Bare_point& p, const Weighted_point& q, + const Weighted_point& r, + const Offset &o_p, const Offset &o_q, + const Offset &o_r) const { + return geom_traits().compare_power_distance_3_object()(p, q, r, o_p, o_q, o_r); + } + + Oriented_side power_test(const Weighted_point &p, const Weighted_point &q) const + { + CGAL_triangulation_precondition(this->equal(p, q)); + return geom_traits().power_side_of_oriented_power_sphere_3_object()(p, q); + } + Oriented_side power_test(const Weighted_point &p, const Weighted_point &q, + const Weighted_point &r, const Weighted_point &s, + const Weighted_point &t, + const Offset &o_p, const Offset &o_q, + const Offset &o_r, const Offset &o_s, + const Offset &o_t) const + { + return geom_traits().power_side_of_oriented_power_sphere_3_object()( + p, q, r, s, t, o_p, o_q, o_r, o_s, o_t); + } + + Oriented_side side_of_oriented_power_sphere(const Weighted_point &p, const Weighted_point &q, + const Weighted_point &r, const Weighted_point &s, + const Weighted_point &t, + const Offset &o_p, const Offset &o_q, + const Offset &o_r, const Offset &o_s, + const Offset &o_t) const + { + return power_test(p,q,r,s,t,o_p,o_q,o_r,o_s,o_t); + } + + Bounded_side side_of_power_sphere(const Cell_handle& c, const Weighted_point& p, + const Offset & offset = Offset(), + bool perturb = false) const + { + Bounded_side bs = ON_UNBOUNDED_SIDE; + int i = 0; + // TODO: optimize which copies to check depending on the offsets in + // the cell. + while(bs == ON_UNBOUNDED_SIDE && i<8) { + bs = _side_of_power_sphere(c,p,combine_offsets(offset,int_to_off(i)),perturb); + i++; + } + return bs; + } + + Bounded_side _side_of_power_sphere(const Cell_handle& c, const Weighted_point& p, + const Offset & offset = Offset(), + bool perturb = false) const; + + Weighted_point construct_weighted_point(const Weighted_point& p, const Offset &o) const + { + return geom_traits().construct_weighted_point_3_object()(p, o); + } + Weighted_point construct_weighted_point(const Periodic_weighted_point& pp) const + { + return construct_weighted_point(pp.first, pp.second); + } + +public: + /** @name Geometric access functions */ + /// @{ + + // The following point() functions return canonical points, that is points + // within the base domain. + + Weighted_point point(const Periodic_weighted_point& pp) const + { + return point(pp, geom_traits().construct_weighted_point_3_object()); + } + + Weighted_point point(Vertex_handle v) const + { + return point(v, geom_traits().construct_weighted_point_3_object()); + } + + Weighted_point point(Cell_handle c, int idx) const + { + return point(c, idx, geom_traits().construct_weighted_point_3_object()); + } + + // end of geometric functions + /// @} + +#define CGAL_INCLUDE_FROM_PERIODIC_3_REGULAR_TRIANGULATION_3_H +#include +#undef CGAL_INCLUDE_FROM_PERIODIC_3_REGULAR_TRIANGULATION_3_H + + Vertex_handle nearest_power_vertex(const Bare_point& p, Cell_handle start) const + { + if(number_of_vertices() == 0) + return Vertex_handle(); + + Locate_type lt; + int li, lj; + + typename Gt::Construct_weighted_point_3 p2wp = + geom_traits().construct_weighted_point_3_object(); + Cell_handle c = locate(p2wp(p), lt, li, lj, start); + if(lt == Tr_Base::VERTEX) + return c->vertex(li); + const Conflict_tester tester(p2wp(p), this); + Offset o = combine_offsets(Offset(), get_location_offset(tester, c)); + + // - start with the closest vertex from the located cell. + // - repeatedly take the nearest of its incident vertices if any + // - if not, we're done. + Vertex_handle nearest = nearest_vertex_in_cell(c, p, o); + std::vector vs; + vs.reserve(32); + while(true) + { + Vertex_handle tmp = nearest; + Offset tmp_off = get_min_dist_offset(p, o, tmp); + adjacent_vertices(nearest, std::back_inserter(vs)); + for(typename std::vector::const_iterator vsit = vs.begin(); vsit != vs.end(); ++vsit) + tmp = (compare_distance(p, tmp->point(), (*vsit)->point(), + o, tmp_off, get_min_dist_offset(p, o, *vsit)) + == SMALLER) ? tmp : *vsit; + if(tmp == nearest) + break; + vs.clear(); + nearest = tmp; + } + + return get_original_vertex(nearest); + } + + Offset get_min_dist_offset(const Bare_point& p, const Offset & o, + const Vertex_handle vh) const { + Offset mdo = get_offset(vh); + Offset min_off = Offset(0,0,0); + min_off = (compare_distance(p,vh->point(),vh->point(), + o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,0,1))) + == SMALLER ? min_off : Offset(0,0,1) ); + min_off = (compare_distance(p,vh->point(),vh->point(), + o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,0))) + == SMALLER ? min_off : Offset(0,1,0) ); + min_off = (compare_distance(p,vh->point(),vh->point(), + o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(0,1,1))) + == SMALLER ? min_off : Offset(0,1,1) ); + min_off = (compare_distance(p,vh->point(),vh->point(), + o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,0))) + == SMALLER ? min_off : Offset(1,0,0) ); + min_off = (compare_distance(p,vh->point(),vh->point(), + o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,0,1))) + == SMALLER ? min_off : Offset(1,0,1) ); + min_off = (compare_distance(p,vh->point(),vh->point(), + o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,0))) + == SMALLER ? min_off : Offset(1,1,0) ); + min_off = (compare_distance(p,vh->point(),vh->point(), + o,combine_offsets(mdo,min_off),combine_offsets(mdo,Offset(1,1,1))) + == SMALLER ? min_off : Offset(1,1,1) ); + return combine_offsets(mdo,min_off); + } + + Vertex_handle nearest_vertex_in_cell(const Cell_handle& c, const Bare_point& p, + const Offset & o) const + { + CGAL_triangulation_precondition(number_of_vertices() != 0); + Vertex_handle nearest = c->vertex(0); + for(int i=1; i<4; i++) { + nearest = (compare_distance(p,nearest->point(),c->vertex(i)->point(), + o,get_offset(c,c->index(nearest)),get_offset(c,i)) == SMALLER) ? + nearest : c->vertex(i); + } + return nearest; + } + + size_type number_of_hidden_points () const + { + size_type count = 0; + for(Cell_iterator iter = cells_begin(), end_iter = cells_end(); iter != end_iter; ++iter) + count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + return count; + } + + bool is_valid(bool verbose = false, int level = 0) const; + bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const; + +protected: + // Protected, because inheritors(e.g. periodic triangulation for meshing) + // of the class Periodic_3_Delaunay_triangulation_3 use this class + class Conflict_tester; + +private: + class Point_hider; + +#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG + template struct Vertex_remover; +#else + template + struct Vertex_remover + { + typedef TriangulationR3 Triangulation_R3; + + typedef typename std::vector::iterator Hidden_points_iterator; + + typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple; + + typedef typename Triangulation_R3::Triangulation_data_structure TDSE; + typedef typename Triangulation_R3::Cell_handle CellE_handle; + typedef typename Triangulation_R3::Vertex_handle VertexE_handle; + typedef typename Triangulation_R3::Facet FacetE; + typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator; + + typedef Triple< VertexE_handle, VertexE_handle, VertexE_handle > + VertexE_triple; + + typedef std::map Vertex_triple_Facet_map; + typedef std::map Vertex_triple_FacetE_map; + typedef typename Vertex_triple_FacetE_map::iterator + Vertex_triple_FacetE_map_it; + + Vertex_remover(const Self *t, Triangulation_R3 &tmp_) : _t(t),tmp(tmp_) {} + + const Self *_t; + Triangulation_R3 &tmp; + + void add_hidden_points(Cell_handle ch) { + std::copy(ch->hidden_points_begin(), ch->hidden_points_end(), + std::back_inserter(hidden)); + } + + Hidden_points_iterator hidden_points_begin() { + return hidden.begin(); + } + Hidden_points_iterator hidden_points_end() { + return hidden.end(); + } + //private: + // The removal of v may un-hide some points, + // Space functions output them. + std::vector hidden; + }; +#endif //CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG + +public: + Periodic_bare_point periodic_weighted_circumcenter(Cell_handle c) const { + return Tr_Base::periodic_circumcenter(c, + geom_traits().construct_weighted_circumcenter_3_object()); + } + + /** @name Voronoi diagram */ //@{ + Bare_point dual(Cell_handle c) const { + return Tr_Base::construct_point(periodic_weighted_circumcenter(c)); + } + + bool canonical_dual_segment(Cell_handle c, int i, Periodic_segment_3& ps) const { + return Tr_Base::canonical_dual_segment(c, i, ps, + geom_traits().construct_weighted_circumcenter_3_object()); + } + + Periodic_segment_3 dual(const Facet & f) const { + return dual( f.first, f.second ); + } + + Periodic_segment_3 dual(Cell_handle c, int i) const{ + Periodic_segment_3 ps; + canonical_dual_segment(c,i,ps); + return ps; + } + + template + OutputIterator dual(const Edge & e, OutputIterator points) const { + return Tr_Base::dual(e.first, e.second, e.third, points); + } + + template + OutputIterator dual(Cell_handle c, int i, int j, + OutputIterator points) const { + Tr_Base::dual(c, i, j, points, geom_traits().construct_weighted_circumcenter_3_object()); + return points; + } + + template + OutputIterator dual(Vertex_handle v, OutputIterator points) const { + Tr_Base::dual(v, points, geom_traits().construct_weighted_circumcenter_3_object()); + return points; + } + + template + Stream& draw_dual(Stream& os) const { + return Tr_Base::draw_dual(os, geom_traits().construct_weighted_circumcenter_3_object()); + } + + /// Volume computations + FT dual_volume(Vertex_handle v) const { + return Tr_Base::dual_volume(v, geom_traits().construct_weighted_circumcenter_3_object()); + } + + /// Centroid computations + Bare_point dual_centroid(Vertex_handle v) const { + return Tr_Base::dual_centroid( + v, geom_traits().construct_weighted_circumcenter_3_object()); + } +//@} + + template + std::pair + find_conflicts(const Weighted_point &p, Cell_handle c, + OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit) const + { + Triple + t = find_conflicts(p, c, bfit, cit, Emptyset_iterator()); + return std::make_pair(t.first, t.second); + } + + template + Triple + find_conflicts(const Weighted_point &p, Cell_handle c, + OutputIteratorBoundaryFacets bfit, OutputIteratorCells cit, + OutputIteratorInternalFacets ifit) const; + + /// Returns the vertices on the boundary of the conflict hole. + template + OutputIterator vertices_in_conflict(const Weighted_point&p, Cell_handle c, + OutputIterator res) const; + + inline bool + is_extensible_triangulation_in_1_sheet_h1() const + { + if(!is_1_cover()) + return can_be_converted_to_1_sheet(); + return is_extensible_triangulation_in_1_sheet_h2(); + } + + inline bool + is_extensible_triangulation_in_1_sheet_h2() const + { + FT threshold = FT(0.015625) * (domain().xmax()-domain().xmin()) * (domain().xmax()-domain().xmin()); + + for(Periodic_tetrahedron_iterator tit = this->periodic_tetrahedra_begin(Tr_Base::UNIQUE); + tit != this->periodic_tetrahedra_end(Tr_Base::UNIQUE); ++tit) + { + if(compare_orthsphere_radius_to_threshold(tit->at(0), tit->at(1), + tit->at(2), tit->at(3), + threshold) != CGAL::SMALLER) + return false; + } + return true; + } +}; + +template < class Gt, class Tds > +template +OutputIterator +Periodic_3_regular_triangulation_3::vertices_in_conflict( + const Weighted_point&p, Cell_handle c, OutputIterator res) const +{ + if(number_of_vertices() == 0) + return res; + + // Get the facets on the boundary of the hole. + std::vector facets; + find_conflicts(p, c, std::back_inserter(facets), Emptyset_iterator()); + + // Then extract uniquely the vertices. + std::set vertices; + for(typename std::vector::const_iterator i = facets.begin(); + i != facets.end(); ++i) { + vertices.insert(i->first->vertex((i->second+1)&3)); + vertices.insert(i->first->vertex((i->second+2)&3)); + vertices.insert(i->first->vertex((i->second+3)&3)); + } + + return std::copy(vertices.begin(), vertices.end(), res); +} + +template < class Gt, class Tds > +template +Triple +Periodic_3_regular_triangulation_3::find_conflicts( + const Weighted_point& p, Cell_handle c, + OutputIteratorBoundaryFacets bfit, + OutputIteratorCells cit, + OutputIteratorInternalFacets ifit) const +{ + CGAL_triangulation_precondition(number_of_vertices() != 0); + + std::vector facets; + facets.reserve(64); + std::vector cells; + cells.reserve(32); + + Conflict_tester tester(p, this); + Triple >, + typename std::back_insert_iterator >, + OutputIteratorInternalFacets> tit = + Tr_Base::find_conflicts(c, tester, + make_triple(std::back_inserter(facets), + std::back_inserter(cells), + ifit)); + ifit = tit.third; + + // Reset the conflict flag on the boundary. + for(typename std::vector::iterator fit=facets.begin(); + fit != facets.end(); ++fit) { + fit->first->neighbor(fit->second)->tds_data().clear(); + *bfit++ = *fit; + } + + // Reset the conflict flag in the conflict cells. + for(typename std::vector::iterator ccit=cells.begin(); + ccit != cells.end(); ++ccit) { + (*ccit)->tds_data().clear(); + *cit++ = *ccit; + } + + for(typename std::vector::iterator + voit = this->v_offsets.begin(); voit != this->v_offsets.end(); ++voit) { + (*voit)->clear_offset(); + } + + this->v_offsets.clear(); + + return make_triple(bfit, cit, ifit); +} + +template < class Gt, class Tds > +Bounded_side Periodic_3_regular_triangulation_3:: +_side_of_power_sphere(const Cell_handle &c, const Weighted_point &q, + const Offset &offset, bool perturb ) const +{ + Weighted_point p0 = c->vertex(0)->point(), + p1 = c->vertex(1)->point(), + p2 = c->vertex(2)->point(), + p3 = c->vertex(3)->point(); + Offset o0 = this->get_offset(c,0), + o1 = this->get_offset(c,1), + o2 = this->get_offset(c,2), + o3 = this->get_offset(c,3), + oq = offset; + + CGAL_triangulation_precondition( orientation(p0, p1, p2, p3, o0, o1, o2, o3) == POSITIVE ); + + Oriented_side os = ON_NEGATIVE_SIDE; + os = side_of_oriented_power_sphere(p0, p1, p2, p3, q, o0, o1, o2, o3, oq); + + if(os != ON_ORIENTED_BOUNDARY || !perturb) + return (Bounded_side) os; + + // We are now in a degenerate case => we do a symbolic perturbation. + // We sort the points lexicographically. + Periodic_weighted_point pts[5] = {std::make_pair(p0,o0), std::make_pair(p1,o1), + std::make_pair(p2,o2), std::make_pair(p3,o3), + std::make_pair(q,oq)}; + const Periodic_weighted_point *points[5] ={&pts[0],&pts[1],&pts[2],&pts[3],&pts[4]}; + + std::sort(points, points+5, typename Tr_Base::Perturbation_order(this)); + + // We successively look whether the leading monomial, then 2nd monomial + // of the determinant has non null coefficient. + for(int i=4; i>1; --i) { + if(points[i] == &pts[4]) { + CGAL_triangulation_assertion(orientation(p0, p1, p2, p3, o0, o1, o2, o3) + == POSITIVE); + // since p0 p1 p2 p3 are non coplanar and positively oriented + return ON_UNBOUNDED_SIDE; + } + Orientation o; + if(points[i] == &pts[3] && + (o = orientation(p0, p1, p2, q, o0, o1, o2, oq)) != COPLANAR ) { + return (Bounded_side) o; + } + if(points[i] == &pts[2] && + (o = orientation(p0, p1, q, p3, o0, o1, oq, o3)) != COPLANAR ) { + return (Bounded_side) o; + } + if(points[i] == &pts[1] && + (o = orientation(p0, q, p2, p3, o0, oq, o2, o3)) != COPLANAR ) { + return (Bounded_side) o; + } + if(points[i] == &pts[0] && + (o = orientation(q, p1, p2 ,p3, oq, o1, o2, o3)) != COPLANAR ) { + return (Bounded_side) o; + } + } + + CGAL_triangulation_assertion(false); + return ON_UNBOUNDED_SIDE; +} + +template < class Gt, class Tds > +bool +Periodic_3_regular_triangulation_3:: +is_valid(bool verbose, int level) const +{ + if(!Tr_Base::is_valid(verbose, level)) { + if(verbose) + std::cerr << "Regular: invalid base" << std::endl; + return false; + } + + Conflict_tester tester(this); + if(!is_valid_conflict(tester, verbose, level)) { + if(verbose) + std::cerr << "Regular: conflict problems" << std::endl; + return false; + } + + if(verbose) + std::cerr << "Regular valid triangulation" << std::endl; + return true; +} + +template < class GT, class TDS > +bool +Periodic_3_regular_triangulation_3:: +is_valid(Cell_handle ch, bool verbose, int level) const +{ + bool error = false; + if(!Tr_Base::is_valid(ch, verbose, level)) { + error = true; + if(verbose) { + std::cerr << "geometrically invalid cell" << std::endl; + for(int i=0; i<4; i++ ) + std::cerr << ch->vertex(i)->point() << ", "; + std::cerr << std::endl; + } + } + + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++ vit) { + const Periodic_weighted_point& pwp = periodic_point(vit); + for(int i=-1; i<=1; i++) { + for(int j=-1; j<=1; j++) { + for(int k=-1; k<=1; k++) { + const Periodic_weighted_point& ofpwp = std::make_pair(pwp.first, + pwp.second + Offset(i,j,k)); + if(periodic_point(ch,0) == ofpwp + || periodic_point(ch,1) == ofpwp + || periodic_point(ch,2) == ofpwp + || periodic_point(ch,3) == ofpwp) + continue; + if(_side_of_power_sphere(ch, ofpwp.first, ofpwp.second, true) + != ON_UNBOUNDED_SIDE) { + error = true; + if(verbose) { + std::cerr << "Regular invalid cell" << std::endl; + for(int i=0; i<4; i++) { + Periodic_weighted_point pp = periodic_point(ch, i); + std::cerr <<"("< +class Periodic_3_regular_triangulation_3::Conflict_tester +{ + // stores a pointer to the triangulation, + // a point, and an offset + const Self* t; + Weighted_point p; + // stores the offset of a point in 27-cover + mutable Offset o; + +public: + /// Constructor + Conflict_tester(const Self* _t) : t(_t), p(Weighted_point()) { } + Conflict_tester(const Weighted_point& pt, const Self *_t) : t(_t), p(pt) { } + + /** The functor + * + * gives true if the circumcircle of c contains p + */ + bool operator()(const Cell_handle c, const Offset& off) const { + return (t->_side_of_power_sphere(c, p, t->combine_offsets(o, off), true) + == ON_BOUNDED_SIDE); + } + + bool operator()(const Cell_handle c, const Weighted_point& pt, + const Offset& off) const { + return (t->_side_of_power_sphere(c, pt, o + off, true) == ON_BOUNDED_SIDE); + } + + int compare_weight(const Weighted_point& p, const Weighted_point& q) const { + return t->power_test(p, q); + } + + bool test_initial_cell(Cell_handle c, const Offset& off) const { + return (operator()(c, off)); + } + + void set_point(const Weighted_point& _p) { + p = _p; + } + + void set_offset(const Offset& off) const { + o = off; + } + + const Offset& get_offset() const { + return o; + } + + const Weighted_point& point() const { + return p; + } + +}; + +template < class GT, class Tds> +class Periodic_3_regular_triangulation_3::Point_hider +{ + Self* t; + mutable std::vector vertices; + mutable std::vector hidden_points; + mutable bool is_original_cube; + +public: + Point_hider(Self* tr) : t(tr), is_original_cube(false) { } + + void set_original_cube (bool b) const { + is_original_cube = b; + } + + template + inline void set_vertices(InputIterator start, InputIterator end) const + { + while(start != end) { + std::copy((*start)->hidden_points_begin(), + (*start)->hidden_points_end(), + std::back_inserter(hidden_points)); + + for(int i=0; i<=3; i++) { + Vertex_handle v = (*start)->vertex(i); + if(v->cell() != Cell_handle()) { + vertices.push_back(v); + v->set_cell(Cell_handle()); + } + } + start ++; + } + } + + inline void reinsert_vertices(Vertex_handle v) + { + Locate_type lt = Locate_type(); + int li=0, lj=0; + + Cell_handle hc = v->cell(); + for(typename std::vector::iterator + vi = vertices.begin(); vi != vertices.end(); ++vi) { + if((*vi)->cell() != Cell_handle()) + continue; + if(is_original_cube) { + hc = t->locate((*vi)->point(), lt, li, lj, hc); + hc->hide_point((*vi)->point()); + } + t->delete_vertex(*vi); + } + vertices.clear(); + for(typename std::vector::iterator + hp = hidden_points.begin(); hp != hidden_points.end(); ++hp) { + hc = t->locate(*hp, lt, li, lj, hc); + hc->hide_point(*hp); + } + hidden_points.clear(); + } + + inline Vertex_handle replace_vertex(Cell_handle c, int index, const Weighted_point& p) + { + Vertex_handle v = c->vertex(index); + c->hide_point(v->point()); + v->set_point(p); + return v; + } + + inline void hide_point(Cell_handle c, const Weighted_point& p) + { + if(is_original_cube) + c->hide_point(p); + } + +// inline void hide(Weighted_point&, Cell_handle ) const // useless? +// { +// CGAL_triangulation_assertion(false); +// } +// +// inline void do_hide(const Weighted_point&, Cell_handle ) const // useless? +// { +// CGAL_triangulation_assertion(false); +// } + +// template < class Tester > +// inline bool replace_vertex(const Weighted_point&, Vertex_handle, const Tester&) const // useless? +// { +// return true; +// } +// +// template +// inline void hide_points(Vertex_handle, +// const Conflict_tester &) +// { +// // No points to hide in the Delaunay triangulation. +// } +}; + +#ifndef CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG +template +template +struct Periodic_3_regular_triangulation_3::Vertex_remover +{ + typedef TriangulationR3 Triangulation_R3; + + typedef typename std::vector::iterator Hidden_points_iterator; + + typedef Triple < Vertex_handle, Vertex_handle, Vertex_handle > Vertex_triple; + + typedef typename Triangulation_R3::Triangulation_data_structure TDSE; + typedef typename Triangulation_R3::Cell_handle CellE_handle; + typedef typename Triangulation_R3::Vertex_handle VertexE_handle; + typedef typename Triangulation_R3::Facet FacetE; + typedef typename Triangulation_R3::Finite_cells_iterator Finite_cellsE_iterator; + + typedef Triple VertexE_triple; + + typedef std::map Vertex_triple_Facet_map; + typedef std::map Vertex_triple_FacetE_map; + typedef typename Vertex_triple_FacetE_map::iterator + Vertex_triple_FacetE_map_it; + + Vertex_remover(const Self* t, Triangulation_R3& tmp_) : _t(t),tmp(tmp_) {} + + const Self* _t; + Triangulation_R3 &tmp; + + void add_hidden_points(Cell_handle ch) { + std::copy(ch->hidden_points_begin(), ch->hidden_points_end(), + std::back_inserter(hidden)); + } + + Hidden_points_iterator hidden_points_begin() { + return hidden.begin(); + } + Hidden_points_iterator hidden_points_end() { + return hidden.end(); + } + private: + // The removal of v may un-hide some points, + // Space functions output them. + std::vector hidden; +}; +#endif //CGAL_CFG_OUTOFLINE_TEMPLATE_MEMBER_DEFINITION_BUG + +template < class GT, class TDS > +std::istream & +operator>> (std::istream& is, Periodic_3_regular_triangulation_3& tr) +{ + typedef Periodic_3_regular_triangulation_3 P3RT3; + typedef typename P3RT3::Tr_Base Tr_Base; + + is >> static_cast(tr); + + tr.insert_cells_with_too_big_orthoball(tr.cells_begin(), tr.cells_end()); + + CGAL_triangulation_expensive_assertion( tr.is_valid() ); + return is; +} + +} // namespace CGAL + +#endif diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_traits_3.h new file mode 100644 index 00000000000..d7381b89bbc --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_traits_3.h @@ -0,0 +1,167 @@ +// Copyright (c) 1999-2004,2006-2009,2013-2015,2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Monique Teillaud +// Aymeric Pelle +// Mael Rouxel-Labbé + +#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_TRAITS_3_H +#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_TRAITS_3_H + +#include + +#include +#include +#include +#include + +#include +#include + +namespace CGAL { + +template +class Periodic_3_regular_triangulation_traits_base_3 + : public Periodic_3_triangulation_traits_3 +{ + typedef Periodic_3_regular_triangulation_traits_base_3 Self; + typedef Periodic_3_triangulation_traits_3 Base; + +public: + typedef K Kernel; + typedef Off Offset; + + typedef typename Base::RT RT; + typedef typename Base::FT FT; + typedef typename Base::Point_3 Point_3; + typedef typename Base::Weighted_point_3 Weighted_point_3; + + typedef typename Base::Periodic_3_offset_3 Periodic_3_offset_3; + typedef typename Base::Iso_cuboid_3 Iso_cuboid_3; + + typedef typename Base::Segment_3 Segment_3; + typedef typename Base::Triangle_3 Triangle_3; + typedef typename Base::Tetrahedron_3 Tetrahedron_3; + +public: + Periodic_3_regular_triangulation_traits_base_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } + + // Construct_weighted_point_3 with offset + typedef Periodic_3_construct_weighted_point_3 + Construct_weighted_point_3; + + typedef Functor_with_offset_weighted_points_adaptor + Power_side_of_oriented_power_sphere_3; + typedef Functor_with_offset_weighted_points_adaptor + Compare_weighted_squared_radius_3; + typedef Functor_with_offset_weighted_points_adaptor + Compare_power_distance_3; + + // Required for Periodic_3_regular_remove_traits + typedef Functor_with_offset_weighted_points_adaptor + Coplanar_orientation_3; + + // When dual operations are used + typedef Functor_with_offset_weighted_points_adaptor + Construct_weighted_circumcenter_3; + + // Operations + using Base::construct_point_3_object; + + Construct_weighted_point_3 construct_weighted_point_3_object() const { + return Construct_weighted_point_3(&this->_domain, + this->Base::construct_weighted_point_3_object()); + } + + // construction + Construct_weighted_circumcenter_3 construct_weighted_circumcenter_3_object() const { + return Construct_weighted_circumcenter_3( + this->Base::construct_weighted_circumcenter_3_object(), + construct_point_3_object(), construct_weighted_point_3_object()); + } + + // predicates + Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere_3_object() const { + return Power_side_of_oriented_power_sphere_3( + this->Base::power_side_of_oriented_power_sphere_3_object(), + construct_point_3_object(), construct_weighted_point_3_object()); + } + Compare_power_distance_3 compare_power_distance_3_object() const { + return Compare_power_distance_3( + this->Base::compare_power_distance_3_object(), + construct_point_3_object(), construct_weighted_point_3_object()); + } + Compare_weighted_squared_radius_3 compare_weighted_squared_radius_3_object() const { + return Compare_weighted_squared_radius_3( + this->Base::compare_weighted_squared_radius_3_object(), + construct_point_3_object(), construct_weighted_point_3_object()); + } + Coplanar_orientation_3 coplanar_orientation_3_object() const { + return Coplanar_orientation_3( + this->Base::coplanar_orientation_3_object(), + construct_point_3_object(), construct_weighted_point_3_object()); + } +}; + +template +class Periodic_3_regular_triangulation_traits_3; + +} // namespace CGAL + +#include + +namespace CGAL +{ +template +class Periodic_3_regular_triangulation_traits_3 + : public Periodic_3_regular_triangulation_traits_base_3 +{ + typedef Periodic_3_regular_triangulation_traits_base_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_regular_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1), + const K& k = K()) + : Base(domain, k) + { } +}; + +template +class Periodic_3_regular_triangulation_traits_3 + : public Periodic_3_regular_triangulation_filtered_traits_3 +{ + typedef Periodic_3_regular_triangulation_filtered_traits_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_regular_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1), + const K& k = K()) + : Base(domain, k) + { } +}; + +} //namespace CGAL + +#endif diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index ca95b748b93..64eb74d77e5 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2003,2006-2009 INRIA Sophia-Antipolis (France). +// Copyright (c) 1999-2003,2006-2009,2014-2015,2017 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -12,29 +12,20 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Monique Teillaud // Sylvain Pion // Nico Kruithof // Manuel Caroli +// Aymeric Pelle +// Mael Rouxel-Labbé #ifndef CGAL_PERIODIC_3_TRIANGULATION_3_H #define CGAL_PERIODIC_3_TRIANGULATION_3_H #include - #include -#include -#include -#include -#include -#include - #include #include #include @@ -49,26 +40,35 @@ #include #include -#include +#include #include +#include #include #include #ifndef CGAL_NO_STRUCTURAL_FILTERING +#include #include #include #endif // no CGAL_NO_STRUCTURAL_FILTERING +#include +#include +#include +#include +#include +#include + namespace CGAL { template < class GT, class TDS > class Periodic_3_triangulation_3; -template < class GT, class TDS > std::istream& operator>> - (std::istream& is, Periodic_3_triangulation_3 &tr); -template < class GT, class TDS > std::ostream& operator<< - (std::ostream& os, const Periodic_3_triangulation_3 &tr); +template < class GT, class TDS > std::istream& operator>> + (std::istream& is, Periodic_3_triangulation_3& tr); +template < class GT, class TDS > std::ostream& operator<< + (std::ostream& os, const Periodic_3_triangulation_3& tr); #ifndef CGAL_NO_STRUCTURAL_FILTERING namespace internal { @@ -77,7 +77,8 @@ struct Periodic_structural_filtering_3_tag {}; struct No_periodic_structural_filtering_3_tag {}; template -struct Periodic_structural_filtering_selector_3 { +struct Periodic_structural_filtering_selector_3 +{ #ifdef FORCE_STRUCTURAL_FILTERING typedef Periodic_structural_filtering_3_tag Tag; #else @@ -86,14 +87,15 @@ struct Periodic_structural_filtering_selector_3 { }; template <> -struct Periodic_structural_filtering_selector_3 { +struct Periodic_structural_filtering_selector_3 +{ typedef Periodic_structural_filtering_3_tag Tag; }; } #endif // no CGAL_NO_STRUCTURAL_FILTERING /**\class Periodic_3_triangulation_3 - * + * * \brief Implements functionality for computing in periodic space. * * There are several things that are special to computing in $\mathbb{T}^3$ @@ -101,26 +103,22 @@ struct Periodic_structural_filtering_selector_3 { * - periodicity --> offsets * - no infinite vertex * - no degenerate dimensions - * All functions that are affected can be found in this class. In case it is + * All functions that are affected can be found in this class. When it is * necessary to provide different implementations for Delaunay and regular - * triangulation, we work with visitors. + * triangulation, we work with visitors. */ template < class GT, - class TDS = Triangulation_data_structure_3 < - Triangulation_vertex_base_3< - GT, Periodic_3_triangulation_ds_vertex_base_3<> - >, - Triangulation_cell_base_3< - GT, Periodic_3_triangulation_ds_cell_base_3<> - > - > - > -class Periodic_3_triangulation_3 + class TDS = Triangulation_data_structure_3 < + Triangulation_vertex_base_3 >, + Triangulation_cell_base_3 > > > +class Periodic_3_triangulation_3 : public Triangulation_utils_3 { friend std::istream& operator>> <> - (std::istream& is, Periodic_3_triangulation_3 &tr); + (std::istream& is, Periodic_3_triangulation_3& tr); typedef Periodic_3_triangulation_3 Self; @@ -130,17 +128,25 @@ public: typedef typename GT::Periodic_3_offset_3 Offset; typedef typename GT::Iso_cuboid_3 Iso_cuboid; - typedef array Covering_sheets; - - typedef typename GT::Point_3 Point; + typedef CGAL::cpp11::array Covering_sheets; + + // point types + typedef typename TDS::Vertex::Point Point; + typedef typename GT::Point_3 Point_3; + typedef std::pair Periodic_point; + typedef std::pair Periodic_point_3; + typedef typename GT::Segment_3 Segment; typedef typename GT::Triangle_3 Triangle; typedef typename GT::Tetrahedron_3 Tetrahedron; - typedef std::pair Periodic_point; - typedef array< std::pair, 2> Periodic_segment; - typedef array< std::pair, 3> Periodic_triangle; - typedef array< std::pair, 4> Periodic_tetrahedron; + typedef CGAL::cpp11::array Periodic_segment; + typedef CGAL::cpp11::array Periodic_triangle; + typedef CGAL::cpp11::array Periodic_tetrahedron; + + typedef CGAL::cpp11::array Periodic_segment_3; + typedef CGAL::cpp11::array Periodic_triangle_3; + typedef CGAL::cpp11::array Periodic_tetrahedron_3; typedef typename TDS::Vertex Vertex; typedef typename TDS::Cell Cell; @@ -149,7 +155,7 @@ public: typedef typename TDS::Vertex_handle Vertex_handle; typedef typename TDS::Cell_handle Cell_handle; - + typedef typename TDS::size_type size_type; typedef typename TDS::difference_type difference_type; @@ -205,7 +211,7 @@ public: UNIQUE_COVER_DOMAIN };//3 enum Locate_type { - VERTEX=0, + VERTEX=0, EDGE, //1 FACET, //2 CELL, //3 @@ -215,17 +221,9 @@ public: private: Geometric_traits _gt; - Triangulation_data_structure _tds; - Iso_cuboid _domain; - /// This threshold should be chosen such that if all edges are shorter, - /// we can be sure that there are no self-edges anymore. - FT edge_length_threshold; - - /// This adjacency list stores all edges that are longer than - /// edge_length_threshold. - std::map< Vertex_handle, std::list > too_long_edges; - unsigned int too_long_edge_counter; - + Triangulation_data_structure _tds; + +protected: /// map of offsets for periodic copies of vertices Virtual_vertex_map virtual_vertices; Virtual_vertex_reverse_map virtual_vertices_reverse; @@ -235,86 +233,77 @@ protected: /// conflict region. mutable std::vector v_offsets; -private: +public: /// Determines if we currently compute in 3-cover or 1-cover. Covering_sheets _cover; public: /** @name Creation */ //@{ - Periodic_3_triangulation_3( - const Iso_cuboid & domain = Iso_cuboid(0,0,0,1,1,1), - const Geometric_traits & gt = Geometric_traits()) - : _gt(gt), _tds(), _domain(domain), too_long_edge_counter(0) { - _gt.set_domain(_domain); + Periodic_3_triangulation_3(const Iso_cuboid& domain, + const Geometric_traits& gt) + : _gt(gt), _tds() + { + set_domain(domain); typedef typename internal::Exact_field_selector::Type EFT; typedef NT_converter NTC; CGAL_USE_TYPE(NTC); CGAL_triangulation_precondition_code( NTC ntc; ) - CGAL_triangulation_precondition(ntc(_domain.xmax())-ntc(_domain.xmin()) - == ntc(_domain.ymax())-ntc(_domain.ymin())); - CGAL_triangulation_precondition(ntc(_domain.ymax())-ntc(_domain.ymin()) - == ntc(_domain.zmax())-ntc(_domain.zmin())); - CGAL_triangulation_precondition(ntc(_domain.zmax())-ntc(_domain.zmin()) - == ntc(_domain.xmax())-ntc(_domain.xmin())); - _cover = make_array(3,3,3); + CGAL_triangulation_precondition(ntc(domain.xmax())-ntc(domain.xmin()) + == ntc(domain.ymax())-ntc(domain.ymin())); + CGAL_triangulation_precondition(ntc(domain.ymax())-ntc(domain.ymin()) + == ntc(domain.zmax())-ntc(domain.zmin())); + CGAL_triangulation_precondition(ntc(domain.zmax())-ntc(domain.zmin()) + == ntc(domain.xmax())-ntc(domain.xmin())); + _cover = CGAL::make_array(3,3,3); init_tds(); - edge_length_threshold = FT(0.166) * (_domain.xmax()-_domain.xmin()) - * (_domain.xmax()-_domain.xmin()); } -private: +protected: // Copy constructor helpers class Finder; - void copy_multiple_covering(const Periodic_3_triangulation_3 & tr); public: // Copy constructor duplicates vertices and cells - Periodic_3_triangulation_3(const Periodic_3_triangulation_3 & tr) + Periodic_3_triangulation_3(const Periodic_3_triangulation_3& tr) : _gt(tr.geom_traits()), - _domain(tr._domain), - edge_length_threshold(tr.edge_length_threshold), - _cover(tr._cover) { - if (is_1_cover()) { - _tds = tr.tds(); - } else { - copy_multiple_covering(tr); - } - CGAL_triangulation_expensive_postcondition(*this == tr); - } - + _cover(tr._cover) + { } + + virtual ~Periodic_3_triangulation_3() {} + /** @name Assignment */ //@{ - Periodic_3_triangulation_3 & operator=(Periodic_3_triangulation_3 tr) { + Periodic_3_triangulation_3& operator=(Periodic_3_triangulation_3& tr) + { swap(tr); return *this; } - - void swap(Periodic_3_triangulation_3 &tr) { + + void swap(Periodic_3_triangulation_3& tr) + { std::swap(tr._gt, _gt); _tds.swap(tr._tds); - std::swap(_domain,tr._domain); - std::swap(edge_length_threshold,tr.edge_length_threshold); - std::swap(too_long_edges,tr.too_long_edges); - std::swap(too_long_edge_counter,tr.too_long_edge_counter); std::swap(virtual_vertices,tr.virtual_vertices); std::swap(virtual_vertices_reverse,tr.virtual_vertices_reverse); std::swap(_cover, tr._cover); } /// Clears the triangulation and initializes it again. - void clear() { + virtual void clear_covering_data() {}//= 0; + void clear() + { _tds.clear(); init_tds(); - too_long_edges.clear(); - too_long_edge_counter = 0; + clear_covering_data(); virtual_vertices.clear(); virtual_vertices_reverse.clear(); - _cover = make_array(3,3,3); + _cover = CGAL::make_array(3,3,3); v_offsets.clear(); } //@} private: /// Initializes the triangulation data structure - void init_tds() { + void init_tds() + { _tds.set_dimension(-2); v_offsets.reserve(48); } @@ -322,59 +311,71 @@ private: public: /** @name Access functions */ //@{ const Geometric_traits& geom_traits() const { return _gt; } - const TDS & tds() const { return _tds; } - TDS & tds() { return _tds; } + const TDS& tds() const { return _tds; } + TDS& tds() { return _tds; } - const Iso_cuboid & domain() const { return _domain; } - // TODO: Documentation and tests - void set_domain(const Iso_cuboid & domain) { + virtual void gather_cell_hidden_points(const Cell_handle /*cit*/, std::vector& /* hidden_points*/) { } + virtual void reinsert_hidden_points_after_converting_to_1_sheeted(const std::vector& /* hidden_points*/) { } + + const Iso_cuboid& domain() const { return _gt.get_domain(); } + + virtual void update_cover_data_after_setting_domain() {} + + void set_domain(const Iso_cuboid& domain) + { clear(); - _domain = domain; _gt.set_domain(domain); - edge_length_threshold = FT(0.166) * (_domain.xmax()-_domain.xmin()) - * (_domain.xmax()-_domain.xmin()); + update_cover_data_after_setting_domain(); } - const Covering_sheets & number_of_sheets() const { return _cover; } - const std::pair original_vertex( - const Vertex_handle v) const { + const Covering_sheets& number_of_sheets() const { return _cover; } + const std::pair original_vertex(const Vertex_handle v) const + { return (virtual_vertices.find(v) == virtual_vertices.end()) ? std::make_pair(v,Offset()) : virtual_vertices.find(v)->second; } - const std::vector& periodic_copies( - const Vertex_handle v) const { - CGAL_triangulation_precondition(number_of_sheets() != make_array(1,1,1) ); - CGAL_triangulation_precondition( - virtual_vertices.find(v) == virtual_vertices.end()); + const std::vector& periodic_copies(const Vertex_handle v) const + { + CGAL_triangulation_precondition(number_of_sheets() != CGAL::make_array(1,1,1)); + CGAL_triangulation_precondition(virtual_vertices.find(v) == virtual_vertices.end()); CGAL_triangulation_assertion( - virtual_vertices_reverse.find(v) != virtual_vertices_reverse.end()); + virtual_vertices_reverse.find(v) != virtual_vertices_reverse.end()); return virtual_vertices_reverse.find(v)->second; } - bool is_extensible_triangulation_in_1_sheet_h1() const; - bool is_extensible_triangulation_in_1_sheet_h2() const; bool is_triangulation_in_1_sheet() const; void convert_to_1_sheeted_covering(); + virtual void update_cover_data_after_converting_to_27_sheeted_covering() { } void convert_to_27_sheeted_covering(); size_type number_of_cells() const { - if (is_1_cover()) return _tds.number_of_cells(); + if(is_1_cover()) return _tds.number_of_cells(); else return _tds.number_of_cells()/27; } size_type number_of_facets() const { - if (is_1_cover()) return _tds.number_of_facets(); + if(is_1_cover()) return _tds.number_of_facets(); else return _tds.number_of_facets()/27; } size_type number_of_edges() const { - if (is_1_cover()) return _tds.number_of_edges(); + if(is_1_cover()) return _tds.number_of_edges(); else return _tds.number_of_edges()/27; } size_type number_of_vertices() const { - if (is_1_cover()) return _tds.number_of_vertices(); + if(is_1_cover()) return _tds.number_of_vertices(); else return _tds.number_of_vertices()/27; } + size_type number_of_finite_cells() const { + return number_of_cells(); + } + size_type number_of_finite_facets() const { + return number_of_facets(); + } + size_type number_of_finite_edges() const { + return number_of_finite_edges(); + } + size_type number_of_stored_cells() const { return _tds.number_of_cells(); } @@ -389,43 +390,54 @@ public: } protected: - bool is_1_cover() const { + bool is_1_cover() const + { bool flag; flag = ((_cover[0] == 1) && (_cover[1] == 1) && (_cover[2] == 1)); return flag; } + void set_cover(const Covering_sheets& cover) + { + _cover = cover; + } + public: - bool is_virtual(Vertex_handle v) { - if (is_1_cover()) return false; + bool is_virtual(Vertex_handle v) + { + if(is_1_cover()) + return false; return (virtual_vertices.find(v) != virtual_vertices.end()); } public: // Offset converters - int off_to_int(const Offset & off) const { + int off_to_int(const Offset& off) const + { CGAL_triangulation_assertion( off.x()==0 || off.x() ==1 ); CGAL_triangulation_assertion( off.y()==0 || off.y() ==1 ); CGAL_triangulation_assertion( off.z()==0 || off.z() ==1 ); int i = ((off.x()&1)<<2) + ((off.y()&1)<<1) + ((off.z()&1)); return i; } - Offset int_to_off(int i) const { + + Offset int_to_off(int i) const + { return Offset((i>>2)&1,(i>>1)&1,i&1); } - - void set_offsets(Cell_handle c, int o0,int o1,int o2,int o3) { + void set_offsets(Cell_handle c, int o0,int o1,int o2,int o3) + { int off0[3] = {(o0>>2)&1,(o0>>1)&1,(o0&1)}; int off1[3] = {(o1>>2)&1,(o1>>1)&1,(o1&1)}; int off2[3] = {(o2>>2)&1,(o2>>1)&1,(o2&1)}; int off3[3] = {(o3>>2)&1,(o3>>1)&1,(o3&1)}; - for (int i=0; i<3; i++) { + for(int i=0; i<3; i++) { int min_off = (std::min)((std::min)(off0[i],off1[i]), - (std::min)(off2[i],off3[i])); - if (min_off != 0) { - off0[i] -= min_off; off1[i] -= min_off; - off2[i] -= min_off; off3[i] -= min_off; + (std::min)(off2[i],off3[i])); + if(min_off != 0) { + off0[i] -= min_off; off1[i] -= min_off; + off2[i] -= min_off; off3[i] -= min_off; } } o0 = ((off0[0]&1)<<2)+((off0[1]&1)<<1)+(off0[2]&1); @@ -434,28 +446,29 @@ public: o3 = ((off3[0]&1)<<2)+((off3[1]&1)<<1)+(off3[2]&1); c->set_offsets(o0,o1,o2,o3); } - - template - void set_offsets(Cell_handle c, Offset o0,Offset o1,Offset o2,Offset o3) { + + template + void set_offsets(Cell_handle c, Offset o0,Offset o1,Offset o2,Offset o3) + { int off0[3] = {o0.x(),o0.y(),o0.z()}; int off1[3] = {o1.x(),o1.y(),o1.z()}; int off2[3] = {o2.x(),o2.y(),o2.z()}; int off3[3] = {o3.x(),o3.y(),o3.z()}; - for (int i=0; i<3; i++) { + for(int i=0; i<3; i++) { int min_off = (std::min)((std::min)(off0[i],off1[i]), - (std::min)(off2[i],off3[i])); - if (min_off != 0) { - off0[i] -= min_off; off1[i] -= min_off; - off2[i] -= min_off; off3[i] -= min_off; + (std::min)(off2[i],off3[i])); + if(min_off != 0) { + off0[i] -= min_off; off1[i] -= min_off; + off2[i] -= min_off; off3[i] -= min_off; } } CGAL_triangulation_assertion((std::min)((std::min)(off0[0],off1[0]), - (std::min)(off2[0],off3[0])) == 0); + (std::min)(off2[0],off3[0])) == 0); CGAL_triangulation_assertion((std::min)((std::min)(off0[1],off1[1]), - (std::min)(off2[1],off3[1])) == 0); + (std::min)(off2[1],off3[1])) == 0); CGAL_triangulation_assertion((std::min)((std::min)(off0[2],off1[2]), - (std::min)(off2[2],off3[2])) == 0); + (std::min)(off2[2],off3[2])) == 0); CGAL_triangulation_assertion((0 <= off0[0]) && (off0[0] < 2)); CGAL_triangulation_assertion((0 <= off1[0]) && (off1[0] < 2)); CGAL_triangulation_assertion((0 <= off2[0]) && (off2[0] < 2)); @@ -477,141 +490,260 @@ public: } public: - /** @name Wrapping the traits */ //@{ - Comparison_result compare_xyz(const Point &p1, const Point &p2) const { - return geom_traits().compare_xyz_3_object()(p1,p2); + /** @name Wrapping the traits */ + // Note that calling functors with "construct_point(p), offset" and not + // construct_point(p, offset) is done on purpose. Indeed, construct_point(p) + // is not a real construction: it's either the identity (when `Point` is `Point_3`) + // or getting the bare point within a weighted point. However, construct_point(p, offset) + // is a real construction. When using filters, construct_point() must be done + // within the filtered predicates with the appropriate construct_point_3_object. + + template // can be Point or Point_3 + Comparison_result compare_xyz(const P& p1, const P& p2) const { + return geom_traits().compare_xyz_3_object()(construct_point(p1), + construct_point(p2)); } - Comparison_result compare_xyz(const Point &p1, const Point&p2, - const Offset &o1, const Offset &o2) const { - return geom_traits().compare_xyz_3_object()(p1,p2,o1,o2); + template // can be Point or Point_3 + Comparison_result compare_xyz(const P& p1, const P& p2, + const Offset& o1, const Offset& o2) const { + return geom_traits().compare_xyz_3_object()( + construct_point(p1), construct_point(p2), o1, o2); + } + template // can be Point or Point_3 + Comparison_result compare_xyz(const std::pair& pp1, + const std::pair& pp2) const { + return geom_traits().compare_xyz_3_object()( + construct_point(pp1.first), construct_point(pp2.first), pp1.second, pp2.second); } - Orientation orientation( - const Point &p1, const Point &p2, const Point &p3, const Point &p4) - const { - return geom_traits().orientation_3_object()(p1,p2,p3,p4); + template // can be Point or Point_3 + Orientation orientation(const P& p1, const P& p2, const P& p3, const P& p4) const { + return geom_traits().orientation_3_object()(construct_point(p1), construct_point(p2), + construct_point(p3), construct_point(p4)); } - Orientation orientation( - const Point &p1, const Point &p2, const Point &p3, const Point &p4, - const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4) - const { - return geom_traits().orientation_3_object()(p1,p2,p3,p4,o1,o2,o3,o4); + template // can be Point or Point_3 + Orientation orientation(const P& p1, const P& p2, const P& p3, const P& p4, + const Offset& o1, const Offset& o2, + const Offset& o3, const Offset& o4) const { + return geom_traits().orientation_3_object()( + construct_point(p1), construct_point(p2), construct_point(p3), construct_point(p4), + o1, o2, o3, o4); + } + template // can be Point or Point_3 + Orientation orientation(const std::pair& pp1, const std::pair& pp2, + const std::pair& pp3, const std::pair& pp4) const { + return geom_traits().orientation_3_object()( + construct_point(pp1.first), construct_point(pp2.first), + construct_point(pp3.first), construct_point(pp4.first), + pp1.second, pp2.second, pp3.second, pp4.second); } - bool equal(const Point &p1, const Point &p2) const { - return compare_xyz(p1,p2) == EQUAL; + template // can be Point or Point_3 + bool equal(const P& p1, const P& p2) const { + return compare_xyz(construct_point(p1), construct_point(p2)) == EQUAL; } - bool equal(const Point &p1, const Point &p2, - const Offset &o1, const Offset &o2) const { - return compare_xyz(p1,p2,o1,o2) == EQUAL; + template // can be Point or Point_3 + bool equal(const P& p1, const P& p2, const Offset& o1, const Offset& o2) const { + return compare_xyz(construct_point(p1), construct_point(p2), o1, o2) == EQUAL; + } + template // can be Point or Point_3 + bool equal(const std::pair& pp1, const std::pair& pp2) const { + return compare_xyz(construct_point(pp1.first), construct_point(pp1.second), + pp2.first, pp2.second) == EQUAL; } - bool coplanar( - const Point &p1, const Point &p2, const Point &p3, const Point &p4) - const { - return orientation(p1,p2,p3,p4) == COPLANAR; + template // can be Point or Point_3 + bool coplanar(const P& p1, const P& p2, const P& p3, const P& p4) const { + return orientation(construct_point(p1), construct_point(p2), + construct_point(p3), construct_point(p4)) == COPLANAR; } - bool coplanar( - const Point &p1, const Point &p2, const Point &p3, const Point &p4, - const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4) - const { - return orientation(p1,p2,p3,p4,o1,o2,o3,o4) == COPLANAR; + template // can be Point or Point_3 + bool coplanar(const P& p1, const P& p2, const P& p3, const P& p4, + const Offset& o1, const Offset& o2, const Offset& o3, const Offset& o4) const { + return orientation(construct_point(p1), construct_point(p2), + construct_point(p3), construct_point(p4), + o1, o2, o3, o4) == COPLANAR; } - - Periodic_tetrahedron construct_periodic_3_tetrahedron( - const Point &p1, const Point &p2, const Point &p3, const Point &p4) - const { - return make_array(std::make_pair(p1,Offset()), std::make_pair(p2,Offset()), - std::make_pair(p3,Offset()), std::make_pair(p4,Offset())); + template // can be Point or Point_3 + bool coplanar(const std::pair& pp1, const std::pair& pp2, + const std::pair& pp3, const std::pair& pp4) const { + return orientation(construct_point(pp1.first), construct_point(pp2.first), + construct_point(pp3.first), construct_point(pp4.first), + pp1.second, pp2.second, pp3.second, pp4.second) == COPLANAR; } - Periodic_tetrahedron construct_periodic_3_tetrahedron( - const Point &p1, const Point &p2, const Point &p3, const Point &p4, - const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4) - const { - return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2), - std::make_pair(p3,o3), std::make_pair(p4,o4)); - } - - Periodic_triangle construct_periodic_3_triangle( - const Point &p1, const Point &p2, const Point &p3) const { - return make_array(std::make_pair(p1,Offset()), - std::make_pair(p2,Offset()), std::make_pair(p3,Offset())); - } - Periodic_triangle construct_periodic_3_triangle( - const Point &p1, const Point &p2, const Point &p3, - const Offset &o1, const Offset &o2, const Offset &o3) const { - return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2), - std::make_pair(p3,o3)); - } - - Periodic_segment construct_periodic_3_segment( - const Point &p1, const Point &p2) const { - return make_array(std::make_pair(p1,Offset()), std::make_pair(p2,Offset())); - } - Periodic_segment construct_periodic_3_segment( - const Point &p1, const Point &p2, - const Offset &o1, const Offset &o2) const { - return make_array(std::make_pair(p1,o1), std::make_pair(p2,o2)); - } - - Tetrahedron construct_tetrahedron( - const Point &p1, const Point &p2, const Point &p3, const Point &p4) - const { - return geom_traits().construct_tetrahedron_3_object()(p1,p2,p3,p4); - } - Tetrahedron construct_tetrahedron( - const Point &p1, const Point &p2, const Point &p3, const Point &p4, - const Offset &o1, const Offset &o2, const Offset &o3, const Offset &o4) - const { - return geom_traits().construct_tetrahedron_3_object()(p1,p2,p3,p4, - o1,o2,o3,o4); - } - Tetrahedron construct_tetrahedron(const Periodic_tetrahedron& tet) { - return construct_tetrahedron( - tet[0].first, tet[1].first, tet[2].first, tet[3].first, - tet[0].second, tet[1].second, tet[2].second, tet[3].second); - } - - Triangle construct_triangle( - const Point &p1, const Point &p2, const Point &p3) const { - return geom_traits().construct_triangle_3_object()(p1,p2,p3); - } - Triangle construct_triangle( - const Point &p1, const Point &p2, const Point &p3, - const Offset &o1, const Offset &o2, const Offset &o3) const { - return geom_traits().construct_triangle_3_object()(p1,p2,p3,o1,o2,o3); - } - Triangle construct_triangle(const Periodic_triangle& tri) { - return construct_triangle(tri[0].first, tri[1].first, tri[2].first, - tri[0].second, tri[1].second, tri[2].second); - } - - Segment construct_segment(const Point &p1, const Point &p2) const { - return geom_traits().construct_segment_3_object()(p1, p2); - } - Segment construct_segment(const Point &p1, const Point &p2, - const Offset &o1, const Offset &o2) const { - return geom_traits().construct_segment_3_object()(p1,p2,o1,o2); - } - Segment construct_segment(const Periodic_segment& seg) const { - return construct_segment(seg[0].first, seg[1].first, - seg[0].second, seg[1].second); - } - - Point construct_point(const Point& p, const Offset &o) const { - return geom_traits().construct_point_3_object()(p,o); - } - Point construct_point(const Periodic_point& pp) const { - return construct_point(pp.first, pp.second); - } - //@} public: - /** @name Geometric access functions */ //@{ - Periodic_point periodic_point( const Vertex_handle v ) const { - if (is_1_cover()) return std::make_pair(v->point(), Offset(0,0,0)); + /** @name Geometric access functions */ + /// @{ + + // ************************************************************************* + // -*-*-*-*-*-*-*-*-*-*-*-*-*-* POINT -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + // ************************************************************************* + + // Note that construct_point()-like functions have return type Point_3, + // but point() -like functions have return type Point + + template // can be Point or Point_3 + Point_3 construct_point(const P& p) const { + return geom_traits().construct_point_3_object()(p); + } + + template // can be Point or Point_3 + Point_3 construct_point(const P& p, const Offset& o) const { + return geom_traits().construct_point_3_object()(p, o); + } + template // can be Point or Point_3 + Point_3 construct_point(const std::pair& pp) const { + return construct_point(pp.first, pp.second); + } + + // Given a point `p` in space, compute its offset `o` with respect + // to the canonical domain and returns (p, o) + Periodic_point_3 construct_periodic_point(const Point_3& p) const + { + // Check if p lies within the domain. If not, translate. + const Iso_cuboid& dom = domain(); + if(!(p.x() < dom.xmin()) && p.x() < dom.xmax() && + !(p.y() < dom.ymin()) && p.y() < dom.ymax() && + !(p.z() < dom.zmin()) && p.z() < dom.zmax()) + return std::make_pair(p, Offset()); + + int ox = -1, oy = -1, oz = -1; + if(p.x() < dom.xmin()) + ox = 1; + else if(p.x() < dom.xmax()) + ox = 0; + + if(p.y() < dom.ymin()) + oy = 1; + else if(p.y() < dom.ymax()) + oy = 0; + + if(p.z() < dom.zmin()) + oz = 1; + else if(p.z() < dom.zmax()) + oz = 0; + + Offset transl_offx(0, 0, 0); + Offset transl_offy(0, 0, 0); + Offset transl_offz(0, 0, 0); + Point_3 dp(p); + + // Find the right offset such that the translation will yield a + // point inside the original domain. + while(dp.x() < dom.xmin() || !(dp.x() < dom.xmax())) + { + transl_offx.x() += ox; + dp = construct_point(std::make_pair(p, transl_offx)); + } + while(dp.y() < dom.ymin() || !(dp.y() < dom.ymax())) + { + transl_offy.y() += oy; + dp = construct_point(std::make_pair(p, transl_offy)); + } + while(dp.z() < dom.zmin() || !(dp.z() < dom.zmax())) + { + transl_offz.z() += oz; + dp = construct_point(std::make_pair(p, transl_offz)); + } + + Offset transl_off(transl_offx.x(), transl_offy.y(), transl_offz.z()); + Periodic_point_3 pp(std::make_pair(p, transl_off)); + + CGAL_triangulation_assertion_code( + Point_3 rp = construct_point(pp.first, pp.second); + ) + CGAL_triangulation_assertion(!(rp.x() < dom.xmin()) && rp.x() < dom.xmax()); + CGAL_triangulation_assertion(!(rp.y() < dom.ymin()) && rp.y() < dom.ymax()); + CGAL_triangulation_assertion(!(rp.z() < dom.zmin()) && rp.z() < dom.zmax()); + + return pp; + } + + // --------------------------------------------------------------------------- + // The following functions return objects of type Point and Periodic_point, + // _not_ Point_3 and Periodic_point_3. + // --------------------------------------------------------------------------- + + // The following point() functions return canonical points, that is points + // within the base domain. They are templated by `construct_point` to distingush + // between Delaunay and regular triangulations + + template + Point point(const Periodic_point& pp, ConstructPoint cp) const + { + return cp(pp.first, pp.second); + } + + template + Point point(Vertex_handle v, ConstructPoint cp) const { + return point(periodic_point(v), cp); + } + + template + Point point(Cell_handle c, int idx, ConstructPoint cp) const + { +// if(is_1_cover()) + return point(periodic_point(c, idx), cp); + + Offset vec_off[4]; + for(int i=0; i<4; i++) + vec_off[i] = periodic_point(c,i).second; + + int ox = vec_off[0].x(); + int oy = vec_off[0].y(); + int oz = vec_off[0].z(); + for(int i=1; i<4; i++) { + ox = (std::min)(ox, vec_off[i].x()); + oy = (std::min)(oy, vec_off[i].y()); + oz = (std::min)(oz, vec_off[i].z()); + } + Offset diff_off(-ox, -oy, -oz); + if(diff_off.is_null()) + return point(periodic_point(c, idx), cp); + + for(unsigned int i=0; i<4; i++) + vec_off[i] += diff_off; + Vertex_handle canonic_vh[4]; + for(int i=0; i<4; i++) { + Virtual_vertex_map_it vvmit = virtual_vertices.find(c->vertex(i)); + Vertex_handle orig_vh; + if(vvmit == virtual_vertices.end()) + orig_vh = c->vertex(i); + else + orig_vh = vvmit->second.first; + + if(vec_off[i].is_null()) { + canonic_vh[i] = orig_vh; + } + else { + CGAL_assertion(virtual_vertices_reverse.find(orig_vh) + != virtual_vertices_reverse.end()); + canonic_vh[i] = virtual_vertices_reverse.find(orig_vh)-> + second[9*vec_off[i][0]+3*vec_off[i][1]+vec_off[i][2]-1]; + } + } + + std::vector cells; + incident_cells(canonic_vh[0], std::back_inserter(cells)); + for(unsigned int i=0; ihas_vertex(canonic_vh[0])); + if(cells[i]->has_vertex(canonic_vh[1]) + && cells[i]->has_vertex(canonic_vh[2]) + && cells[i]->has_vertex(canonic_vh[3]) ) + return point(periodic_point(cells[i], cells[i]->index(canonic_vh[idx])), cp); + } + CGAL_assertion(false); + return Point(); + } + + Periodic_point periodic_point(const Vertex_handle v) const + { + if(is_1_cover()) + return std::make_pair(v->point(), Offset(0,0,0)); + Virtual_vertex_map_it it = virtual_vertices.find(v); - if (it == virtual_vertices.end()) { + if(it == virtual_vertices.end()) { // if v is not contained in virtual_vertices, then it is in the // original domain. return std::make_pair(v->point(), Offset(0,0,0)); @@ -620,111 +752,262 @@ public: return std::make_pair(it->second.first->point(), it->second.second); } } - Periodic_point periodic_point( const Cell_handle c, int i) const { - if (is_1_cover()) return std::make_pair(c->vertex(i)->point(), - int_to_off(c->offset(i))); + + Periodic_point periodic_point(const Cell_handle c, int i) const + { + if(is_1_cover()) + return std::make_pair(c->vertex(i)->point(), int_to_off(c->offset(i))); + Virtual_vertex_map_it it = virtual_vertices.find(c->vertex(i)); - if (it == virtual_vertices.end()) { + if(it == virtual_vertices.end()) { // if c->vertex(i) is not contained in virtual_vertices, then it // is in the original domain. - return std::make_pair(c->vertex(i)->point(), - combine_offsets(Offset(),int_to_off(c->offset(i))) ); + return std::make_pair(c->vertex(i)->point(), + combine_offsets(Offset(),int_to_off(c->offset(i))) ); } else { // otherwise it has to be looked up as well as its offset. return std::make_pair(it->second.first->point(), - combine_offsets(it->second.second, int_to_off(c->offset(i))) ); + combine_offsets(it->second.second, int_to_off(c->offset(i))) ); } } + // ************************************************************************* + // -*-*-*-*-*-*-*-*-*-*-*-*-*-* SEGMENT -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + // ************************************************************************* + + // Note that an object of type `Segment` is constructed from two objects of type `Point_3` + // while an object of type `Periodic_segment` is constructed from two objects of type `Point` + + template // can be Point or Point_3 + Segment construct_segment(const P& p1, const P& p2) const { + return geom_traits().construct_segment_3_object()(construct_point(p1), + construct_point(p2)); + } + template // can be Point or Point_3 + Segment construct_segment(const P& p1, const P& p2, + const Offset& o1, const Offset& o2) const { + return geom_traits().construct_segment_3_object()(construct_point(p1, o1), + construct_point(p2, o2)); + } + template // can be Periodic_segment or Periodic_segment_3 + Segment construct_segment(const PS& ps) const { + return geom_traits().construct_segment_3_object()( + construct_point(ps[0].first, ps[0].second), + construct_point(ps[1].first, ps[1].second)); + } + template // can be Point or Point_3 + Periodic_segment construct_periodic_segment(const P& p1, const P& p2, + const Offset& o1 = Offset(), + const Offset& o2 = Offset()) const { + return CGAL::make_array(std::make_pair(construct_point(p1), o1), + std::make_pair(construct_point(p2), o2)); + } + Periodic_segment periodic_segment(const Cell_handle c, int i, int j) const { CGAL_triangulation_precondition( i != j ); CGAL_triangulation_precondition( number_of_vertices() != 0 ); - CGAL_triangulation_precondition( i >= 0 && i <= 3 - && j >= 0 && j <= 3 ); - return make_array( std::make_pair(c->vertex(i)->point(), - get_offset(c,i)), - std::make_pair(c->vertex(j)->point(), - get_offset(c,j)) ); + CGAL_triangulation_precondition( i >= 0 && i <= 3 && j >= 0 && j <= 3 ); + return CGAL::make_array(std::make_pair(c->vertex(i)->point(), get_offset(c,i)), + std::make_pair(c->vertex(j)->point(), get_offset(c,j))); } - Periodic_segment periodic_segment(const Edge & e) const { + Periodic_segment periodic_segment(const Edge& e) const { return periodic_segment(e.first,e.second,e.third); } + Periodic_segment periodic_segment(const Cell_handle c, Offset offset, int i, int j) const { + Periodic_segment result = periodic_segment(c,i,j); + offset.x() *= _cover[0]; + offset.y() *= _cover[1]; + offset.z() *= _cover[2]; + result[0].second += offset; + result[1].second += offset; + return result; + } - Periodic_triangle periodic_triangle(const Cell_handle c, int i) const; - Periodic_triangle periodic_triangle(const Facet & f) const { + // ************************************************************************* + // -*-*-*-*-*-*-*-*-*-*-*-*-*-* TRIANGLE -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + // ************************************************************************* + + // Note that an object of type `Triangle` is constructed from three objects of type `Point_3` + // while an object of type `Periodic_triangle` is constructed from three objects of type `Point` + + template // can be Point or Point_3 + Triangle construct_triangle(const P& p1, const P& p2, const P& p3) const { + return geom_traits().construct_triangle_3_object()(construct_point(p1), + construct_point(p2), + construct_point(p3)); + } + template // can be Point or Point_3 + Triangle construct_triangle(const P& p1, const P& p2, const P& p3, + const Offset& o1, const Offset& o2, const Offset& o3) const { + return geom_traits().construct_triangle_3_object()(construct_point(p1, o1), + construct_point(p2, o2), + construct_point(p3, o3)); + } + template // can be Periodic_triangle or Periodic_triangle_3 + Triangle construct_triangle(const PT& tri) const { + return geom_traits().construct_triangle_3_object()( + construct_point(tri[0].first, tri[0].second), + construct_point(tri[1].first, tri[1].second), + construct_point(tri[2].first, tri[2].second)); + } + template // can be Point or Point_3 + Periodic_triangle construct_periodic_triangle(const P& p1, const P& p2, + const P& p3, + const Offset& o1 = Offset(), + const Offset& o2 = Offset(), + const Offset& o3 = Offset()) const { + return CGAL::make_array(std::make_pair(construct_point(p1), o1), + std::make_pair(construct_point(p2), o2), + std::make_pair(construct_point(p3), o3)); + } + + Periodic_triangle periodic_triangle(const Cell_handle c, int i) const { + CGAL_triangulation_precondition( number_of_vertices() != 0 ); + CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + if( (i&1)==0 ) + return CGAL::make_array(std::make_pair(c->vertex((i+2)&3)->point(), get_offset(c,(i+2)&3)), + std::make_pair(c->vertex((i+1)&3)->point(), get_offset(c,(i+1)&3)), + std::make_pair(c->vertex((i+3)&3)->point(), get_offset(c,(i+3)&3)) ); + + return CGAL::make_array(std::make_pair(c->vertex((i+1)&3)->point(), get_offset(c,(i+1)&3)), + std::make_pair(c->vertex((i+2)&3)->point(), get_offset(c,(i+2)&3)), + std::make_pair(c->vertex((i+3)&3)->point(), get_offset(c,(i+3)&3)) ); + } + Periodic_triangle periodic_triangle(const Facet& f) const { return periodic_triangle(f.first, f.second); } + Periodic_triangle periodic_triangle(const Cell_handle c, Offset offset, int i) const { + Periodic_triangle result = periodic_triangle(c,i); + offset.x() *= _cover[0]; + offset.y() *= _cover[1]; + offset.z() *= _cover[2]; + result[0].second += offset; + result[1].second += offset; + result[2].second += offset; + return result; + } - Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c) const { + // ************************************************************************* + // -*-*-*-*-*-*-*-*-*-*-*-*-*-* TETRAHEDRON -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* + // ************************************************************************* + + // Note that an object of type `Tetrahedron` is constructed from four objects of type `Point_3` + // while an object of type `Periodic_tetrahedron` is constructed from four objects of type `Point` + + template // can be Point or Point_3 + Tetrahedron construct_tetrahedron(const P& p1, const P& p2, + const P& p3, const P& p4) const { + return geom_traits().construct_tetrahedron_3_object()(construct_point(p1), + construct_point(p2), + construct_point(p3), + construct_point(p4)); + } + template // can be Point or Point_3 + Tetrahedron construct_tetrahedron(const P& p1, const P& p2, + const P& p3, const P& p4, + const Offset& o1, const Offset& o2, + const Offset& o3, const Offset& o4) const { + return geom_traits().construct_tetrahedron_3_object()( + construct_point(p1, o1), construct_point(p2, o2), + construct_point(p3, o3), construct_point(p4, o4)); + } + template // can be Periodic_tetrahedron or Periodic_tetrahedron_3 + Tetrahedron construct_tetrahedron(const PT& tet) const { + return geom_traits().construct_tetrahedron_3_object()( + construct_point(tet[0].first, tet[0].second), + construct_point(tet[1].first, tet[1].second), + construct_point(tet[2].first, tet[2].second), + construct_point(tet[3].first, tet[3].second)); + } + template // can be Point or Point_3 + Periodic_tetrahedron construct_periodic_tetrahedron(const P& p1, const P& p2, + const P& p3, const P& p4, + const Offset& o1 = Offset(), + const Offset& o2 = Offset(), + const Offset& o3 = Offset(), + const Offset& o4 = Offset()) const { + return CGAL::make_array(std::make_pair(construct_point(p1), o1), + std::make_pair(construct_point(p2), o2), + std::make_pair(construct_point(p3), o3), + std::make_pair(construct_point(p4), o4)); + } + + Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c) const + { CGAL_triangulation_precondition( number_of_vertices() != 0 ); - return make_array( - std::make_pair(c->vertex(0)->point(), get_offset(c,0)), - std::make_pair(c->vertex(1)->point(), get_offset(c,1)), - std::make_pair(c->vertex(2)->point(), get_offset(c,2)), - std::make_pair(c->vertex(3)->point(), get_offset(c,3)) ); + return CGAL::make_array(std::make_pair(c->vertex(0)->point(), get_offset(c,0)), + std::make_pair(c->vertex(1)->point(), get_offset(c,1)), + std::make_pair(c->vertex(2)->point(), get_offset(c,2)), + std::make_pair(c->vertex(3)->point(), get_offset(c,3)) ); + } + Periodic_tetrahedron periodic_tetrahedron(const Cell_handle c, Offset offset) const + { + Periodic_tetrahedron result = periodic_tetrahedron(c); + offset.x() *= _cover[0]; + offset.y() *= _cover[1]; + offset.z() *= _cover[2]; + result[0].second += offset; + result[1].second += offset; + result[2].second += offset; + result[3].second += offset; + return result; } - Point point(const Periodic_point & pp) const { - return construct_point(pp.first, pp.second); - } - Segment segment(const Periodic_segment & ps) const { - return construct_segment(ps[0].first,ps[1].first,ps[0].second,ps[1].second); - } - Triangle triangle(const Periodic_triangle & pt) const { - return construct_triangle(pt[0].first, pt[1].first, pt[2].first, - pt[0].second,pt[1].second,pt[2].second); - } - Tetrahedron tetrahedron(const Periodic_tetrahedron & pt) const { - return construct_tetrahedron(pt[0].first, pt[1].first, - pt[2].first, pt[3].first, - pt[0].second,pt[1].second, - pt[2].second,pt[3].second); - } - // @} + // end of geometric functions + /// @} +public: /** @name Queries */ //@{ - bool is_vertex(const Point & p, Vertex_handle & v) const; + bool is_vertex(const Point& p, Vertex_handle& v) const; bool is_vertex(Vertex_handle v) const { return _tds.is_vertex(v); } - bool is_edge(Vertex_handle u, Vertex_handle v, - Cell_handle & c, int & i, int & j) const { + + bool is_edge(Vertex_handle u, Vertex_handle v, Cell_handle& c, int& i, int& j) const { return _tds.is_edge(u, v, c, i, j); } - bool is_edge(Vertex_handle u, const Offset & off_u, - Vertex_handle v, const Offset & off_v, - Cell_handle & c, int & i, int & j) const { - if (!_tds.is_edge(u,v,c,i,j)) return false; - if ((get_offset(c,i) == off_u) && (get_offset(c,j) == off_v)) + + bool is_edge(Vertex_handle u, const Offset& off_u, + Vertex_handle v, const Offset& off_v, + Cell_handle& c, int& i, int& j) const + { + if(!_tds.is_edge(u,v,c,i,j)) + return false; + + if((get_offset(c,i) == off_u) && (get_offset(c,j) == off_v)) return true; + // it might be that different cells containing (u,v) yield // different offsets, which forces us to test for all possibilities. else { Cell_circulator ccirc = incident_cells(c,i,j,c); - while (++ccirc != c) { - i = ccirc->index(u); - j = ccirc->index(v); - if ((get_offset(ccirc,i) == off_u) && (get_offset(ccirc,j) == off_v)) { - c = ccirc; - return true; - } + while(++ccirc != c) { + i = ccirc->index(u); + j = ccirc->index(v); + if((get_offset(ccirc,i) == off_u) && (get_offset(ccirc,j) == off_v)) { + c = ccirc; + return true; + } } return false; } } + bool is_facet(Vertex_handle u, Vertex_handle v, Vertex_handle w, - Cell_handle & c, int & i, int & j, int & k) const { + Cell_handle& c, int& i, int& j, int& k) const { return _tds.is_facet(u, v, w, c, i, j, k); } - bool is_facet(Vertex_handle u, const Offset & off_u, - Vertex_handle v, const Offset & off_v, - Vertex_handle w, const Offset & off_w, - Cell_handle & c, int & i, int & j, int & k) const { - if (!_tds.is_facet(u,v,w,c,i,j,k)) return false; - if ((get_offset(c,i) == off_u) - && (get_offset(c,j) == off_v) - && (get_offset(c,k) == off_w) ) + + bool is_facet(Vertex_handle u, const Offset& off_u, + Vertex_handle v, const Offset& off_v, + Vertex_handle w, const Offset& off_w, + Cell_handle& c, int& i, int& j, int& k) const + { + if(!_tds.is_facet(u,v,w,c,i,j,k)) return false; + if((get_offset(c,i) == off_u) + && (get_offset(c,j) == off_v) + && (get_offset(c,k) == off_w) ) return true; // it might be that c and c->neighbor(l) yield different offsets // which forces us to test for both possibilities. @@ -733,126 +1016,143 @@ public: c = c->neighbor(l); i = c->index(u); j = c->index(v); - k = c->index(w); + k = c->index(w); return ((get_offset(c,i) == off_u) - && (get_offset(c,j) == off_v) - && (get_offset(c,k) == off_w) ); + && (get_offset(c,j) == off_v) + && (get_offset(c,k) == off_w) ); } } + bool is_cell(Cell_handle c) const { return _tds.is_cell(c); } + bool is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w, Vertex_handle t, - Cell_handle & c, int & i, int & j, int & k, int & l) const { + Cell_handle& c, int& i, int& j, int& k, int& l) const { return _tds.is_cell(u, v, w, t, c, i, j, k, l); } + bool is_cell(Vertex_handle u, Vertex_handle v, Vertex_handle w, - Vertex_handle t, Cell_handle & c) const { + Vertex_handle t, Cell_handle& c) const + { int i,j,k,l; return _tds.is_cell(u, v, w, t, c, i, j, k, l); } - bool is_cell(Vertex_handle u, const Offset & off_u, - Vertex_handle v, const Offset & off_v, - Vertex_handle w, const Offset & off_w, - Vertex_handle t, const Offset & off_t, - Cell_handle & c, int & i, int & j, int & k, int & l) const { - if (!_tds.is_cell(u,v,w,t,c,i,j,k,l)) return false; + + bool is_cell(Vertex_handle u, const Offset& off_u, + Vertex_handle v, const Offset& off_v, + Vertex_handle w, const Offset& off_w, + Vertex_handle t, const Offset& off_t, + Cell_handle& c, int& i, int& j, int& k, int& l) const + { + if(!_tds.is_cell(u,v,w,t,c,i,j,k,l)) return false; return ((get_offset(c,i) == off_u) - && (get_offset(c,j) == off_v) - && (get_offset(c,k) == off_w) - && (get_offset(c,l) == off_t) ); + && (get_offset(c,j) == off_v) + && (get_offset(c,k) == off_w) + && (get_offset(c,l) == off_t) ); return false; } - bool is_cell(Vertex_handle u, const Offset & off_u, - Vertex_handle v, const Offset & off_v, - Vertex_handle w, const Offset & off_w, - Vertex_handle t, const Offset & off_t, - Cell_handle & c) const { + + bool is_cell(Vertex_handle u, const Offset& off_u, + Vertex_handle v, const Offset& off_v, + Vertex_handle w, const Offset& off_w, + Vertex_handle t, const Offset& off_t, + Cell_handle& c) const + { int i, j, k, l; return is_cell(u,off_u,v,off_v,w,off_w,t,off_t,c,i,j,k,l); } - bool has_vertex(const Facet & f, Vertex_handle v, int & j) const { + bool has_vertex(const Facet& f, Vertex_handle v, int& j) const { return _tds.has_vertex(f.first, f.second, v, j); } - bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const { + bool has_vertex(Cell_handle c, int i, Vertex_handle v, int& j) const { return _tds.has_vertex(c, i, v, j); } - bool has_vertex(const Facet & f, Vertex_handle v) const { + bool has_vertex(const Facet& f, Vertex_handle v) const { return _tds.has_vertex(f.first, f.second, v); } bool has_vertex(Cell_handle c, int i, Vertex_handle v) const { return _tds.has_vertex(c, i, v); } - + bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const { return _tds.are_equal(c, i, n, j); } - bool are_equal(const Facet & f, const Facet & g) const { + bool are_equal(const Facet& f, const Facet& g) const { return _tds.are_equal(f.first, f.second, g.first, g.second); } - bool are_equal(const Facet & f, Cell_handle n, int j) const { + bool are_equal(const Facet& f, Cell_handle n, int j) const { return _tds.are_equal(f.first, f.second, n, j); } //@} #ifdef CGAL_NO_STRUCTURAL_FILTERING Cell_handle - periodic_locate(const Point & p, const Offset &o_p, - Locate_type & lt, int & li, int & lj, - Cell_handle start = Cell_handle()) const; + periodic_locate(const Point& p, const Offset& o_p, Offset& lo, + Locate_type& lt, int& li, int& lj, + Cell_handle start = Cell_handle()) const; #else // no CGAL_NO_STRUCTURAL_FILTERING -# ifndef CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS -# define CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS 2500 -# endif // no CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS +# ifndef CGAL_P3T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS +# define CGAL_P3T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS 2500 +# endif // no CGAL_P3T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS public: Cell_handle - inexact_periodic_locate(const Point& p, const Offset &o_p, + inexact_periodic_locate(const Point& p, const Offset& o_p, Cell_handle start = Cell_handle(), - int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const; + int max_num_cells = CGAL_P3T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const; protected: Cell_handle - exact_periodic_locate(const Point& p, const Offset &o_p, - Locate_type& lt, - int& li, int & lj, - Cell_handle start) const; + exact_periodic_locate(const Point& p, const Offset& o_p, Offset& lo, + Locate_type& lt, + int& li, int& lj, + Cell_handle start) const; Cell_handle - generic_periodic_locate(const Point& p, const Offset &o_p, - Locate_type& lt, - int& li, int & lj, - Cell_handle start, - internal::Periodic_structural_filtering_3_tag) const { - return exact_periodic_locate(p, o_p, lt, li, lj, inexact_periodic_locate(p, o_p, start)); + generic_periodic_locate(const Point& p, const Offset& o_p, Offset& lo, + Locate_type& lt, + int& li, int& lj, + Cell_handle start, + internal::Periodic_structural_filtering_3_tag) const { + return exact_periodic_locate(p, o_p, lo, lt, li, lj, inexact_periodic_locate(p, o_p, start)); } Cell_handle - generic_periodic_locate(const Point& p, const Offset &o_p, - Locate_type& lt, - int& li, int & lj, - Cell_handle start, - internal::No_periodic_structural_filtering_3_tag) const { - return exact_periodic_locate(p, o_p, lt, li, lj, start); + generic_periodic_locate(const Point& p, const Offset& o_p, Offset& lo, + Locate_type& lt, + int& li, int& lj, + Cell_handle start, + internal::No_periodic_structural_filtering_3_tag) const { + return exact_periodic_locate(p, o_p, lo, lt, li, lj, start); } Orientation - inexact_orientation(const Point &p, const Point &q, - const Point &r, const Point &s) const + inexact_orientation(const Point& p, const Point& q, + const Point& r, const Point& s, + const Offset& o_p = Offset(), const Offset& o_q = Offset(), + const Offset& o_r = Offset(), const Offset& o_s = Offset()) const { - const double px = to_double(p.x()); - const double py = to_double(p.y()); - const double pz = to_double(p.z()); - const double qx = to_double(q.x()); - const double qy = to_double(q.y()); - const double qz = to_double(q.z()); - const double rx = to_double(r.x()); - const double ry = to_double(r.y()); - const double rz = to_double(r.z()); - const double sx = to_double(s.x()); - const double sy = to_double(s.y()); - const double sz = to_double(s.z()); + const Point_3 bp = construct_point(p, o_p); + const Point_3 bq = construct_point(q, o_q); + const Point_3 br = construct_point(r, o_r); + const Point_3 bs = construct_point(s, o_s); + + // So that this code works well with Lazy_kernel + internal::Static_filters_predicates::Get_approx get_approx; + const double px = to_double(get_approx(bp).x()); + const double py = to_double(get_approx(bp).y()); + const double pz = to_double(get_approx(bp).z()); + const double qx = to_double(get_approx(bq).x()); + const double qy = to_double(get_approx(bq).y()); + const double qz = to_double(get_approx(bq).z()); + const double rx = to_double(get_approx(br).x()); + const double ry = to_double(get_approx(br).y()); + const double rz = to_double(get_approx(br).z()); + const double sx = to_double(get_approx(bs).x()); + const double sy = to_double(get_approx(bs).y()); + const double sz = to_double(get_approx(bs).z()); const double pqx = qx - px; const double pqy = qy - py; @@ -867,76 +1167,87 @@ protected: const double det = determinant(pqx, pqy, pqz, prx, pry, prz, psx, psy, psz); - if (det > 0) return POSITIVE; - if (det < 0) return NEGATIVE; + if(det > 0) return POSITIVE; + if(det < 0) return NEGATIVE; return ZERO; } - Orientation - inexact_orientation(const Point &p, const Point &q, - const Point &r, const Point &s, - const Offset& o_p, const Offset& o_q, - const Offset& o_r, const Offset& o_s) const - { - return inexact_orientation(construct_point(p, o_p), - construct_point(q, o_q), - construct_point(r, o_r), - construct_point(s, o_s)); - } - public: - Cell_handle - periodic_locate(const Point & p, const Offset &o_p, - Locate_type & lt, int & li, int & lj, - Cell_handle start = Cell_handle()) const + periodic_locate(const Point& p, const Offset& o_p, Offset& lo, + Locate_type& lt, int& li, int& lj, + Cell_handle start = Cell_handle()) const { typedef Triangulation_structural_filtering_traits TSFT; typedef typename internal::Periodic_structural_filtering_selector_3< TSFT::Use_structural_filtering_tag::value >::Tag Should_filter_tag; - return generic_periodic_locate(p, o_p, lt, li, lj, start, Should_filter_tag()); + return generic_periodic_locate(p, o_p, lo, lt, li, lj, start, Should_filter_tag()); } Cell_handle inexact_locate(const Point& p, Cell_handle start = Cell_handle(), - int max_num_cells = CGAL_PT3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const + int max_num_cells = CGAL_P3T3_STRUCTURAL_FILTERING_MAX_VISITED_CELLS) const { - return inexact_periodic_locate(p, Offset(), start, max_num_cells); + return inexact_periodic_locate(p, Offset(), start, max_num_cells); } #endif // no CGAL_NO_STRUCTURAL_FILTERING protected: /** @name Location helpers */ //@{ -// Cell_handle periodic_locate(const Point & p, const Offset &o_p, -// Locate_type & lt, int & li, int & lj, Cell_handle start) const; +// Cell_handle periodic_locate(const Point& p, const Offset& o_p, +// Locate_type& lt, int& li, int& lj, Cell_handle start) const; - Bounded_side side_of_cell(const Point & p, const Offset &off, - Cell_handle c, Locate_type & lt, int & i, int & j) const; + Bounded_side side_of_cell(const Point& p, const Offset& off, Cell_handle c, + Locate_type& lt, int& i, int& j) const; //@} - + public: /** @name Point Location */ //@{ /** Wrapper function for locate if only the request point is given. */ - Cell_handle locate(const Point & p, Cell_handle start=Cell_handle()) const { + Cell_handle locate(const Point& p, Cell_handle start = Cell_handle()) const + { Locate_type lt; int li, lj; return locate( p, lt, li, lj, start); } - + /** Wrapper function calling locate with an empty offset if there was no * offset given. */ - Cell_handle locate(const Point & p, Locate_type & lt, int & li, int & lj, - Cell_handle start = Cell_handle()) const { - return periodic_locate(p, Offset(), lt, li, lj, start); + Cell_handle locate(const Point& p, + Locate_type& lt, int& li, int& lj, + Cell_handle start = Cell_handle()) const + { + Offset lo; + return locate( p, lo, lt, li, lj, start); } - Bounded_side side_of_cell(const Point & p, - Cell_handle c, Locate_type & lt, int & i, int & j) const { - if (number_of_vertices() == 0) { + Cell_handle locate(const Point& p, Offset& lo, + Cell_handle start = Cell_handle()) const + { + Locate_type lt; + int li, lj; + return locate( p, lo, lt, li, lj, start); + } + + Cell_handle locate(const Point& p, Offset& lo, + Locate_type& lt, int& li, int& lj, + Cell_handle start = Cell_handle()) const + { + Cell_handle ch = periodic_locate(p, Offset(), lo, lt, li, lj, start); + for(unsigned i = 0; i < 3; ++i) + if(lo[i] >= 1) + lo[i] = -1; + return ch; + } + + Bounded_side side_of_cell(const Point& p, Cell_handle c, + Locate_type& lt, int& i, int& j) const + { + if(number_of_vertices() == 0) { lt = EMPTY; return ON_UNBOUNDED_SIDE; } @@ -946,17 +1257,11 @@ public: private: /** @name Insertion helpers */ //@{ - template - void insert_too_long_edges(Vertex_handle v, - const CellIt begin, const CellIt end); - - template - void delete_too_long_edges(const CellIt begin, const CellIt end); - - template < class Conflict_tester, class Point_hider > + template < class Conflict_tester, class Point_hider, class CoverManager > Vertex_handle periodic_insert(const Point& p, const Offset& o, Locate_type lt, - Cell_handle c, const Conflict_tester &tester, - Point_hider &hider, Vertex_handle vh = Vertex_handle()); + Cell_handle c, const Conflict_tester& tester, + Point_hider& hider, CoverManager& cover_manager, + Vertex_handle vh = Vertex_handle()); template void periodic_sort(Point_iterator /*p_begin*/, Point_iterator /*p_end*/, @@ -964,55 +1269,69 @@ private: std::cout << "Periodic_sort not yet implemented" << std::endl; } - Vertex_handle create_initial_triangulation(const Point &p); + Vertex_handle create_initial_triangulation(const Point& p); + public: std::vector insert_dummy_points(); - + protected: // this is needed for compatibility reasons template + class OutputIteratorCells, class OutputIteratorInternalFacets> Triple find_conflicts(Cell_handle c, - const Conflict_test &tester, - Triple it) const { - Offset off = get_location_offset(tester, c); - return find_conflicts(c,off,tester,it); + const Conflict_test& tester, + Triple it) const + { + bool b = false; + Offset off = get_location_offset(tester, c, b); + if(b) + return find_conflicts(c,off,tester,it); + return it; } template + class OutputIteratorCells, class OutputIteratorInternalFacets> Triple - find_conflicts(Cell_handle c, const Offset ¤t_off, - const Conflict_test &tester, - Triple it) const; + find_conflicts(Cell_handle c, const Offset& current_off, + const Conflict_test& tester, + Triple it) const; //@} - + protected: + // COMMON INSERTION for DELAUNAY and REGULAR TRIANGULATION - template < class Conflict_tester, class Point_hider > - Vertex_handle insert_in_conflict(const Point & p, Cell_handle start, - const Conflict_tester &tester, Point_hider &hider) { + template < class Conflict_tester, class Point_hider, class CoverManager > + Vertex_handle insert_in_conflict(const Point& p, Cell_handle start, + const Conflict_tester& tester, + Point_hider& hider, + CoverManager& cover_manager) + { Locate_type lt = Locate_type(); int li=0, lj=0; - Cell_handle c = periodic_locate(p, Offset(), lt, li, lj, start); - return insert_in_conflict(p,lt,c,li,lj,tester,hider); + Offset lo; + Cell_handle c = periodic_locate(p, Offset(), lo, lt, li, lj, start); + return insert_in_conflict(p,lt,c,li,lj,tester,hider, cover_manager); } - template < class Conflict_tester, class Point_hider > - Vertex_handle insert_in_conflict(const Point & p, Locate_type lt, - Cell_handle c, int li, int lj, const Conflict_tester &tester, - Point_hider &hider); + template < class Conflict_tester, class Point_hider, class CoverManager > + Vertex_handle insert_in_conflict(const Point& p, Locate_type lt, + Cell_handle c, int li, int lj, + const Conflict_tester& tester, + Point_hider& hider, + CoverManager& cover_manager); template < class InputIterator, class Conflict_tester, - class Point_hider> + class Point_hider, class CoverManager> std::vector insert_in_conflict( InputIterator begin, InputIterator end, Cell_handle start, - Conflict_tester &tester, Point_hider &hider) { + Conflict_tester& tester, Point_hider& hider, CoverManager& cover_manager) + { Vertex_handle new_vertex; std::vector double_vertices; Locate_type lt = Locate_type(); @@ -1021,20 +1340,24 @@ protected: CGAL_triangulation_assertion_code( int ia = 0; ) CGAL_triangulation_assertion_code( int ja = 0; ) Cell_handle hint; - while (begin!=end) { + while(begin!=end) { tester.set_point(*begin); - hint = periodic_locate(*begin, Offset(), lt, li, lj, start); - CGAL_triangulation_assertion_code( if (number_of_vertices() != 0) { ); - CGAL_triangulation_assertion(side_of_cell( - *begin,Offset(), hint, lta, ia, ja) != ON_UNBOUNDED_SIDE); - CGAL_triangulation_assertion(lta == lt); - CGAL_triangulation_assertion(ia == li); - CGAL_triangulation_assertion(ja == lj); - CGAL_triangulation_assertion_code( } ); + Offset lo; + hint = periodic_locate(*begin, Offset(), lo, lt, li, lj, start); + CGAL_triangulation_assertion_code( if(number_of_vertices() != 0) { ); + CGAL_triangulation_assertion(side_of_cell( + *begin,Offset(), hint, lta, ia, ja) != ON_UNBOUNDED_SIDE); + CGAL_triangulation_assertion(lta == lt); + CGAL_triangulation_assertion(ia == li); + CGAL_triangulation_assertion(ja == lj); + CGAL_triangulation_assertion_code( } + ); - new_vertex = insert_in_conflict(*begin,lt,hint,li,lj,tester,hider); - if (lt == VERTEX) double_vertices.push_back(new_vertex); - start = new_vertex->cell(); + new_vertex = insert_in_conflict(*begin,lt,hint,li,lj,tester,hider, cover_manager); + if(lt == VERTEX) + double_vertices.push_back(new_vertex); + if(new_vertex != Vertex_handle()) + start = new_vertex->cell(); begin++; } return double_vertices; @@ -1043,29 +1366,56 @@ protected: private: /** @name Removal helpers */ //@{ - Vertex_triple make_vertex_triple(const Facet& f) const { + Vertex_triple make_vertex_triple(const Facet& f) const + { Cell_handle ch = f.first; int i = f.second; return Vertex_triple(ch->vertex(vertex_triple_index(i,0)), - ch->vertex(vertex_triple_index(i,1)), - ch->vertex(vertex_triple_index(i,2))); + ch->vertex(vertex_triple_index(i,1)), + ch->vertex(vertex_triple_index(i,2))); } void make_canonical(Vertex_triple& t) const; - void make_hole(Vertex_handle v, std::map &outer_map, - std::vector &hole); + void make_hole(Vertex_handle v, std::map& outer_map, + std::vector& hole); - template < class PointRemover > - void periodic_remove(Vertex_handle v, PointRemover &remover); + template < class PointRemover, class CoverManager > + void periodic_remove(Vertex_handle v, PointRemover& remover, CoverManager& cover_manager); //@} - + protected: /** @name Removal */ //@{ - template < class PointRemover, class CT > - void remove(Vertex_handle v, PointRemover &remover, CT &ct); + template < class PointRemover, class CT, class CoverManager > + void remove(Vertex_handle v, PointRemover& remover, CT& ct, CoverManager& cover_manager); //@} + void delete_vertex(Vertex_handle vertex_handle) + { + tds().delete_vertex(vertex_handle); + + if(!is_1_cover()) + { + typename Virtual_vertex_map::iterator iter = this->virtual_vertices.find(vertex_handle); + if(iter != this->virtual_vertices.end()) + { + this->virtual_vertices.erase(iter); + + typename Virtual_vertex_reverse_map::iterator origin_it = this->virtual_vertices_reverse.find(iter->second.first); + std::vector& copies = origin_it->second; + typename std::vector::iterator copy_iter = std::find(copies.begin(), copies.end(), vertex_handle); + CGAL_triangulation_assertion(copy_iter != copies.end()); + copies.erase(copy_iter); + if(copies.empty()) + virtual_vertices_reverse.erase(origin_it); + } + return; + } + + CGAL_triangulation_assertion(this->virtual_vertices.find(vertex_handle) == this->virtual_vertices.end()); + CGAL_triangulation_assertion(this->virtual_vertices_reverse.find(vertex_handle) == this->virtual_vertices_reverse.end()); + } + public: /** @name Traversal */ //@{ Cell_iterator cells_begin() const { @@ -1151,10 +1501,10 @@ public: All_facets_iterator all_facets_end() const { return _tds.facets_end(); } - + Unique_vertex_iterator unique_vertices_begin() const { return CGAL::filter_iterator(vertices_end(), Domain_tester(this), - vertices_begin()); + vertices_begin()); } Unique_vertex_iterator unique_vertices_end() const { return CGAL::filter_iterator(vertices_end(), Domain_tester(this)); @@ -1198,38 +1548,38 @@ public: } // Circulators - Cell_circulator incident_cells(const Edge & e) const { + Cell_circulator incident_cells(const Edge& e) const { return _tds.incident_cells(e); } Cell_circulator incident_cells(Cell_handle c, int i, int j) const { return _tds.incident_cells(c, i, j); } - Cell_circulator incident_cells(const Edge & e, Cell_handle start) const { + Cell_circulator incident_cells(const Edge& e, Cell_handle start) const { return _tds.incident_cells(e, start); } - Cell_circulator incident_cells(Cell_handle c, int i, int j, + Cell_circulator incident_cells(Cell_handle c, int i, int j, Cell_handle start) const { return _tds.incident_cells(c, i, j, start); } - Facet_circulator incident_facets(const Edge & e) const { + Facet_circulator incident_facets(const Edge& e) const { return _tds.incident_facets(e); } Facet_circulator incident_facets(Cell_handle c, int i, int j) const { return _tds.incident_facets(c, i, j); } - Facet_circulator incident_facets(const Edge & e, const Facet & start) const { + Facet_circulator incident_facets(const Edge& e, const Facet& start) const { return _tds.incident_facets(e, start); } - Facet_circulator incident_facets(Cell_handle c, int i, int j, - const Facet & start) const { + Facet_circulator incident_facets(Cell_handle c, int i, int j, + const Facet& start) const { return _tds.incident_facets(c, i, j, start); } - Facet_circulator incident_facets(const Edge & e, + Facet_circulator incident_facets(const Edge& e, Cell_handle start, int f) const { return _tds.incident_facets(e, start, f); } - Facet_circulator incident_facets(Cell_handle c, int i, int j, + Facet_circulator incident_facets(Cell_handle c, int i, int j, Cell_handle start, int f) const { return _tds.incident_facets(c, i, j, start, f); } @@ -1281,282 +1631,384 @@ public: return _tds.mirror_facet(f); } //@} - + private: /** @name Checking helpers */ //@{ /// calls has_self_edges for every cell of the triangulation - bool has_self_edges() const { + bool has_self_edges() const + { Cell_iterator it; - for ( it = all_cells_begin(); it != all_cells_end(); ++it ) - if (has_self_edges(it)) return true; + for( it = all_cells_begin(); it != all_cells_end(); ++it ) + if(has_self_edges(it)) return true; return false; } + bool has_self_edges(Cell_handle c) const; //@} - + public: /** @name Checking */ //@{ bool is_valid(bool verbose = false, int level = 0) const; bool is_valid(Cell_handle c, bool verbose = false, int level = 0) const; -protected: - template - bool is_valid_conflict(ConflictTester &tester, bool verbose = false, - int level = 0) const; - //@} protected: - /** @name Functors */ //@{ - template < class Cmp > - class Perturbation_order; + template + bool is_valid_conflict(ConflictTester& tester, bool verbose = false, + int level = 0) const; //@} +public: + /** @name Functors */ + class Perturbation_order + { + const Self *t; + + public: + Perturbation_order(const Self *tr) + : t(tr) {} + + template + bool operator()(const P* p, const P* q) const { + return t->compare_xyz(*p, *q) == SMALLER; + } + }; + public: // undocumented access functions - Offset get_offset(Cell_handle ch, int i) const { - if (is_1_cover()) return int_to_off(ch->offset(i)); + Offset get_offset(Cell_handle ch, int i) const + { + if(is_1_cover()) + return int_to_off(ch->offset(i)); + Virtual_vertex_map_it it = virtual_vertices.find(ch->vertex(i)); - if (it != virtual_vertices.end()) + if(it != virtual_vertices.end()) return combine_offsets(it->second.second, int_to_off(ch->offset(i))); - else return combine_offsets(Offset(), int_to_off(ch->offset(i))); + else + return combine_offsets(Offset(), int_to_off(ch->offset(i))); } - Offset get_offset(Vertex_handle vh) const { - if (is_1_cover()) return Offset(); + + Offset get_offset(Vertex_handle vh) const + { + if(is_1_cover()) + return Offset(); + Virtual_vertex_map_it it = virtual_vertices.find(vh); - if (it != virtual_vertices.end()) return it->second.second; - else return Offset(); + if(it != virtual_vertices.end()) + return it->second.second; + else + return Offset(); } - Vertex_handle get_original_vertex(Vertex_handle vh) const { - if (is_1_cover()) return vh; + + Vertex_handle get_original_vertex(Vertex_handle vh) const + { + if(is_1_cover()) + return vh; + Virtual_vertex_map_it it = virtual_vertices.find(vh); - if (it != virtual_vertices.end()) return it->second.first; - else return vh; + if(it != virtual_vertices.end()) + return it->second.first; + else + return vh; } - Offset combine_offsets(const Offset& o_c, const Offset& o_t) const { + + Offset combine_offsets(const Offset& o_c, const Offset& o_t) const + { Offset o_ct(_cover[0]*o_t.x(),_cover[1]*o_t.y(),_cover[2]*o_t.z()); return o_c + o_ct; } // These functions give the pair (vertex, offset) that corresponds to the // i-th vertex of cell ch or vertex vh, respectively. - void get_vertex(Cell_handle ch, int i, Vertex_handle &vh, Offset &off) const; - void get_vertex(Vertex_handle vh_i, Vertex_handle &vh, Offset &off) const; + void get_vertex(Cell_handle ch, int i, Vertex_handle& vh, Offset& off) const; + void get_vertex(Vertex_handle vh_i, Vertex_handle& vh, Offset& off) const; protected: // Auxiliary functions - int find_too_long_edges(std::map >& edges) const; Cell_handle get_cell(const Vertex_handle* vh) const; + template Offset get_location_offset(const Conflict_tester& tester, - Cell_handle c) const; + Cell_handle c) const; - Offset get_neighbor_offset(Cell_handle ch, int i, Cell_handle nb) const; - + template + Offset get_location_offset(const Conflict_tester& tester, + Cell_handle c, bool& found) const; + + Offset neighbor_offset(Cell_handle ch, int i, Cell_handle nb) const; + +public: + Offset neighbor_offset(Cell_handle ch, int i) const + { + return neighbor_offset(ch, i, ch->neighbor(i)); + } + +protected: /** @name Friends */ //@{ - friend class Perturbation_order; friend std::istream& operator>> <> - (std::istream& is, Periodic_3_triangulation_3 &tr); + (std::istream& is, Periodic_3_triangulation_3& tr); friend std::ostream& operator<< <> - (std::ostream& os, const Periodic_3_triangulation_3 &tr); + (std::ostream& os, const Periodic_3_triangulation_3& tr); //@} - // unused and undocumented function required to be compatible to - // Alpha_shape_3 +protected: + template + Periodic_point_3 periodic_circumcenter(Cell_handle c, + ConstructCircumcenter construct_circumcenter) const + { + CGAL_triangulation_precondition(c != Cell_handle()); + + Point_3 p = construct_circumcenter(c->vertex(0)->point(), c->vertex(1)->point(), + c->vertex(2)->point(), c->vertex(3)->point(), + get_offset(c, 0), get_offset(c, 1), + get_offset(c, 2), get_offset(c, 3)); + + return construct_periodic_point(p); + } + public: - Point point(Cell_handle c, int idx) const { - // if (is_1_cover()) - return point(periodic_point(c,idx)); + bool is_canonical(const Facet& f) const + { + if(number_of_sheets() == CGAL::make_array(1,1,1)) + return true; - Offset vec_off[4]; - for (int i=0 ; i<4 ; i++) vec_off[i] = periodic_point(c,i).second; - int ox = vec_off[0].x(); - int oy = vec_off[0].y(); - int oz = vec_off[0].z(); - for (int i=1 ; i<4 ; i++) { - ox = (std::min)(ox,vec_off[i].x()); - oy = (std::min)(oy,vec_off[i].y()); - oz = (std::min)(oz,vec_off[i].z()); + Offset cell_off0 = int_to_off(f.first->offset((f.second+1)&3)); + Offset cell_off1 = int_to_off(f.first->offset((f.second+2)&3)); + Offset cell_off2 = int_to_off(f.first->offset((f.second+3)&3)); + Offset diff_off((cell_off0.x() == 1 + && cell_off1.x() == 1 + && cell_off2.x() == 1) ? -1 : 0, + (cell_off0.y() == 1 + && cell_off1.y() == 1 + && cell_off2.y() == 1) ? -1 : 0, + (cell_off0.z() == 1 + && cell_off1.z() == 1 + && cell_off2.z() == 1) ? -1 : 0); + Offset off0 = combine_offsets(get_offset(f.first, (f.second+1)&3), diff_off); + Offset off1 = combine_offsets(get_offset(f.first, (f.second+2)&3), diff_off); + Offset off2 = combine_offsets(get_offset(f.first, (f.second+3)&3), diff_off); + + // If there is one offset with entries larger than 1 then we are + // talking about a vertex that is too far away from the original + // domain to belong to a canonical triangle. + if(off0.x() > 1) return false; + if(off0.y() > 1) return false; + if(off0.z() > 1) return false; + if(off1.x() > 1) return false; + if(off1.y() > 1) return false; + if(off1.z() > 1) return false; + if(off2.x() > 1) return false; + if(off2.y() > 1) return false; + if(off2.z() > 1) return false; + + // If there is one direction of space for which all offsets are + // non-zero then the edge is not canonical because we can + // take the copy closer towards the origin in that direction. + int offx = off0.x() & off1.x() & off2.x(); + int offy = off0.y() & off1.y() & off2.y(); + int offz = off0.z() & off1.z() & off2.z(); + + return (offx == 0 && offy == 0 && offz == 0); + } + +protected: + template + bool canonical_dual_segment(Cell_handle c, int i, Periodic_segment_3& ps, + ConstructCircumcenter construct_circumcenter) const + { + CGAL_triangulation_precondition(c != Cell_handle()); + Offset off = neighbor_offset(c,i,c->neighbor(i)); + Periodic_point_3 p1 = periodic_circumcenter(c, construct_circumcenter); + Periodic_point_3 p2 = periodic_circumcenter(c->neighbor(i), construct_circumcenter); + Offset o1 = -p1.second; + Offset o2 = combine_offsets(-p2.second,-off); + Offset cumm_off((std::min)(o1.x(),o2.x()), + (std::min)(o1.y(),o2.y()),(std::min)(o1.z(),o2.z())); + const Periodic_point_3 pp1 = std::make_pair(construct_point(p1), o1-cumm_off); + const Periodic_point_3 pp2 = std::make_pair(construct_point(p2), o2-cumm_off); + ps = CGAL::make_array(pp1, pp2); + return (cumm_off == Offset(0,0,0)); + } + + template + OutputIterator dual(Cell_handle c, int i, int j, + OutputIterator points, + ConstructCircumcenter construct_circumcenter) const + { + Cell_circulator cstart = incident_cells(c, i, j); + + Offset offv = periodic_point(c,i).second; + Vertex_handle v = c->vertex(i); + + Cell_circulator ccit = cstart; + do { + Point_3 dual_orig = periodic_circumcenter(ccit, construct_circumcenter).first; + int idx = ccit->index(v); + Offset off = periodic_point(ccit,idx).second; + Point_3 dual = construct_point(std::make_pair(dual_orig, -off+offv)); + *points++ = dual; + ++ccit; + } while(ccit != cstart); + return points; + } + + template + OutputIterator dual(Vertex_handle v, OutputIterator points, + ConstructCircumcenter construct_circumcenter) const + { + std::vector cells; + incident_cells(v,std::back_inserter(cells)); + + for(unsigned int i=0; iindex(v); + Offset off = periodic_point(cells[i],idx).second; + Point_3 dual = construct_point(std::make_pair(dual_orig, -off)); + *points++ = dual; } - Offset diff_off(-ox,-oy,-oz); - if (diff_off.is_null()) return point(periodic_point(c,idx)); + return points; + } - for (unsigned int i=0 ; i<4 ; i++) vec_off[i] += diff_off; - Vertex_handle canonic_vh[4]; - for (int i=0 ; i<4 ; i++) { - Virtual_vertex_map_it vvmit = virtual_vertices.find(c->vertex(i)); - Vertex_handle orig_vh; - if (vvmit == virtual_vertices.end()) orig_vh = c->vertex(i); - else orig_vh = vvmit->second.first; - if (vec_off[i].is_null()) canonic_vh[i] = orig_vh; - else { - CGAL_assertion(virtual_vertices_reverse.find(orig_vh) - != virtual_vertices_reverse.end()); - canonic_vh[i] = virtual_vertices_reverse.find(orig_vh) - ->second[9*vec_off[i][0]+3*vec_off[i][1]+vec_off[i][2]-1]; + template + Stream& draw_dual(Stream& os, ConstructCircumcenter construct_circumcenter) const + { + CGAL_triangulation_assertion_code( unsigned int i = 0; ) + for(Facet_iterator fit = facets_begin(), end = facets_end(); + fit != end; ++fit) { + if(!is_canonical(*fit)) + continue; + + Periodic_segment_3 pso; + canonical_dual_segment(fit->first, fit->second, pso, construct_circumcenter); + Segment so = construct_segment(pso); + CGAL_triangulation_assertion_code ( ++i; ) + os << so.source() << '\n'; + os << so.target() << '\n'; + } + CGAL_triangulation_assertion( i == number_of_facets() ); + return os; + } + + /// Volume computations + + // Note: Polygon area computation requires to evaluate square roots + // and thus cannot be done without changing the Traits concept. + + template + FT dual_volume(Vertex_handle v, ConstructCircumcenter construct_circumcenter) const + { + std::list edges; + incident_edges(v, std::back_inserter(edges)); + + FT vol(0); + for(typename std::list::iterator eit = edges.begin(); + eit != edges.end(); ++eit) { + + // compute the dual of the edge *eit but handle the translations + // with respect to the dual of v. That is why we cannot use one + // of the existing dual functions here. + Facet_circulator fstart = incident_facets(*eit); + Facet_circulator fcit = fstart; + std::vector pts; + do { + // TODO: possible speed-up by caching the circumcenters + Point_3 dual_orig = periodic_circumcenter(fcit->first, construct_circumcenter).first; + int idx = fcit->first->index(v); + Offset off = periodic_point(fcit->first,idx).second; + pts.push_back(construct_point(std::make_pair(dual_orig,-off))); + ++fcit; + } while(fcit != fstart); + + Point_3 orig(0,0,0); + for(unsigned int i=1; i + Point_3 dual_centroid(Vertex_handle v, ConstructCircumcenter construct_circumcenter) const + { + std::list edges; + incident_edges(v, std::back_inserter(edges)); + + FT vol(0); + FT x(0), y(0), z(0); + for(typename std::list::iterator eit = edges.begin(); + eit != edges.end(); ++eit) { + + // compute the dual of the edge *eit but handle the translations + // with respect to the dual of v. That is why we cannot use one + // of the existing dual functions here. + Facet_circulator fstart = incident_facets(*eit); + Facet_circulator fcit = fstart; + std::vector pts; + do { + // TODO: possible speed-up by caching the circumcenters + Point_3 dual_orig = periodic_circumcenter(fcit->first, construct_circumcenter).first; + int idx = fcit->first->index(v); + Offset off = periodic_point(fcit->first,idx).second; + pts.push_back(construct_point(std::make_pair(dual_orig,-off))); + ++fcit; + } while(fcit != fstart); + + Point_3 orig(0,0,0); + FT tetvol; + for(unsigned int i=1; i cells; - incident_cells(canonic_vh[0], std::back_inserter(cells)); - for (unsigned int i=0 ; ihas_vertex(canonic_vh[0])); - if (cells[i]->has_vertex(canonic_vh[1]) - && cells[i]->has_vertex(canonic_vh[2]) - && cells[i]->has_vertex(canonic_vh[3]) ) - return point(periodic_point(cells[i],cells[i]->index(canonic_vh[idx]))); - } - CGAL_assertion(false); - return Point(); + x /= ( 4 * vol ); + y /= ( 4 * vol ); + z /= ( 4 * vol ); + + Iso_cuboid d = domain(); + x = (x < d.xmin() ? x+d.xmax()-d.xmin() + : (x >= d.xmax() ? x-d.xmax()+d.xmin() : x)); + y = (y < d.ymin() ? y+d.ymax()-d.ymin() + : (y >= d.ymax() ? y-d.ymax()+d.ymin() : y)); + z = (z < d.zmin() ? z+d.zmax()-d.zmin() + : (z >= d.zmax() ? z-d.zmax()+d.zmin() : z)); + + CGAL_triangulation_postcondition((d.xmin()<=x)&&(x -inline void -Periodic_3_triangulation_3:: -copy_multiple_covering(const Periodic_3_triangulation_3 & tr) { - // Write the respective offsets in the vertices to make them - // automatically copy with the tds. - for (Vertex_iterator vit = tr.vertices_begin() ; - vit != tr.vertices_end() ; ++vit) { - vit->set_offset(tr.get_offset(vit)); - } - // copy the tds - _tds = tr.tds(); - // make a list of all vertices that belong to the original - // domain and initialize the basic structure of - // virtual_vertices_reverse - std::list vlist; - for (Vertex_iterator vit = vertices_begin() ; - vit != vertices_end() ; ++vit) { - if (vit->offset() == Offset()) { - vlist.push_back(vit); - virtual_vertices_reverse.insert( - std::make_pair(vit,std::vector(26))); - CGAL_triangulation_assertion(virtual_vertices_reverse.find(vit) - ->second.size() == 26); - } - } - // Iterate over all vertices that are not in the original domain - // and construct the respective entries to virtual_vertices and - // virtual_vertices_reverse - for (Vertex_iterator vit2 = vertices_begin() ; - vit2 != vertices_end() ; ++vit2) { - if (vit2->offset() != Offset()) { - //TODO: use some binding, maybe boost instead of the Finder. - typename std::list::iterator vlist_it - = std::find_if(vlist.begin(), vlist.end(), - Finder(this,vit2->point())); - Offset off = vit2->offset(); - virtual_vertices.insert(std::make_pair(vit2, - std::make_pair(*vlist_it,off))); - virtual_vertices_reverse.find(*vlist_it) - ->second[9*off[0]+3*off[1]+off[2]-1]=vit2; - CGAL_triangulation_assertion(get_offset(vit2) == off); - } - } - // Cleanup vertex offsets - for (Vertex_iterator vit = vertices_begin() ; - vit != vertices_end() ; ++vit) - vit->clear_offset(); - for (Vertex_iterator vit = tr.vertices_begin() ; - vit != tr.vertices_end() ; ++vit) - vit->clear_offset(); - // Build up the too_long_edges container - too_long_edge_counter = 0; - too_long_edges.clear(); - for (Vertex_iterator vit = vertices_begin() ; - vit != vertices_end() ; ++vit) - too_long_edges[vit] = std::list(); - std::pair edge_to_add; - Point p1,p2; - int i,j; - for (Edge_iterator eit = edges_begin() ; - eit != edges_end() ; ++eit) { - if (&*(eit->first->vertex(eit->second)) - < &*(eit->first->vertex(eit->third))) { - i = eit->second; j = eit->third; - } else { - i = eit->third; j = eit->second; - } - edge_to_add = std::make_pair(eit->first->vertex(i), - eit->first->vertex(j)); - p1 = construct_point(eit->first->vertex(i)->point(), - get_offset(eit->first, i)); - p2 = construct_point(eit->first->vertex(j)->point(), - get_offset(eit->first, j)); - Vertex_handle v_no = eit->first->vertex(i); - if (squared_distance(p1,p2) > edge_length_threshold) { - CGAL_triangulation_assertion( - find(too_long_edges[v_no].begin(), - too_long_edges[v_no].end(), - edge_to_add.second) == too_long_edges[v_no].end()); - too_long_edges[v_no].push_back(edge_to_add.second); - too_long_edge_counter++; - } - } -} - template < class GT, class TDS > inline bool Periodic_3_triangulation_3:: -is_extensible_triangulation_in_1_sheet_h1() const { - if (!is_1_cover()) { - if (too_long_edge_counter == 0) return true; - else return false; - } else { - typename Geometric_traits::FT longest_edge_squared_length(0); - Segment s; - for (Periodic_segment_iterator psit = periodic_segments_begin(UNIQUE); - psit != periodic_segments_end(UNIQUE) ; ++psit) { - s = construct_segment(*psit); - longest_edge_squared_length = (std::max)(longest_edge_squared_length, - s.squared_length()); - } - return (longest_edge_squared_length < edge_length_threshold); - } -} +is_triangulation_in_1_sheet() const +{ + if(is_1_cover()) + return true; -template < class GT, class TDS > -inline bool -Periodic_3_triangulation_3:: -is_extensible_triangulation_in_1_sheet_h2() const { - typedef typename Geometric_traits::Construct_circumcenter_3 - Construct_circumcenter; - typedef typename Geometric_traits::FT FT; - Construct_circumcenter construct_circumcenter - = _gt.construct_circumcenter_3_object(); - for (Periodic_tetrahedron_iterator tit = periodic_tetrahedra_begin(UNIQUE) ; - tit != periodic_tetrahedra_end(UNIQUE) ; ++tit) { - Point cc = construct_circumcenter( - tit->at(0).first, tit->at(1).first, - tit->at(2).first, tit->at(3).first, - tit->at(0).second, tit->at(1).second, - tit->at(2).second, tit->at(3).second); + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { + if(virtual_vertices.find(vit) == virtual_vertices.end()) + continue; - if ( !(FT(16)*squared_distance(cc,point(tit->at(0))) - < (_domain.xmax()-_domain.xmin())*(_domain.xmax()-_domain.xmin())) ) - return false; - } - return true; -} - -template < class GT, class TDS > -inline bool -Periodic_3_triangulation_3:: -is_triangulation_in_1_sheet() const { - if (is_1_cover()) return true; - for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { - if (virtual_vertices.find(vit) == virtual_vertices.end()) continue; std::vector nb_v; std::set nb_v_odom; Vertex_handle vh; Offset off; adjacent_vertices(vit, std::back_inserter(nb_v)); - for (unsigned int i=0; i inline bool Periodic_3_triangulation_3:: -is_vertex(const Point & p, Vertex_handle & v) const +is_vertex(const Point& p, Vertex_handle& v) const { Locate_type lt; int li, lj; Cell_handle c = locate( p, lt, li, lj ); - if ( lt != VERTEX ) + if( lt != VERTEX ) return false; v = c->vertex(li); return true; @@ -1587,8 +2039,8 @@ make_canonical(Vertex_triple& t) const } else { i = (&*(t.second) < &*(t.third))? 1 : 2; } - Vertex_handle tmp; - switch(i){ + Vertex_handle tmp; + switch(i) { case 0: return; case 1: tmp = t.first; @@ -1604,28 +2056,6 @@ make_canonical(Vertex_triple& t) const } } -template < class GT, class TDS > -inline typename Periodic_3_triangulation_3::Periodic_triangle -Periodic_3_triangulation_3:: -periodic_triangle(const Cell_handle c, int i) const -{ - CGAL_triangulation_precondition( number_of_vertices() != 0 ); - CGAL_triangulation_precondition( i >= 0 && i <= 3 ); - if ( (i&1)==0 ) - return make_array(std::make_pair(c->vertex( (i+2)&3 )->point(), - get_offset(c,(i+2)&3)), - std::make_pair(c->vertex( (i+1)&3 )->point(), - get_offset(c,(i+1)&3)), - std::make_pair(c->vertex( (i+3)&3 )->point(), - get_offset(c,(i+3)&3)) ); - return make_array(std::make_pair(c->vertex( (i+1)&3 )->point(), - get_offset(c,(i+1)&3)), - std::make_pair(c->vertex( (i+2)&3 )->point(), - get_offset(c,(i+2)&3)), - std::make_pair(c->vertex( (i+3)&3 )->point(), - get_offset(c,(i+3)&3)) ); -} - /** Assumes a point, an offset, and a cell to start from. * Gives the locate type and the simplex (cell and indices) containing p. * @@ -1647,28 +2077,30 @@ periodic_locate #else exact_periodic_locate #endif -(const Point & p, const Offset &o_p, - Locate_type & lt, int & li, int & lj, Cell_handle start) const { +(const Point& p, const Offset& o_p, Offset& lo, + Locate_type& lt, int& li, int& lj, Cell_handle start) const +{ int cumm_off = 0; Offset off_query = o_p; - if (number_of_vertices() == 0) { + if(number_of_vertices() == 0) { + lo = Offset(); lt = EMPTY; return Cell_handle(); } CGAL_triangulation_assertion(number_of_vertices() != 0); - if (start == Cell_handle()) { + if(start == Cell_handle()) { start = cells_begin(); } cumm_off = start->offset(0) | start->offset(1) - | start->offset(2) | start->offset(3); - if (is_1_cover() && cumm_off != 0) { - if (((cumm_off & 4) == 4) && (FT(2)*p.x()<(_domain.xmax()+_domain.xmin()))) + | start->offset(2) | start->offset(3); + if(is_1_cover() && cumm_off != 0) { + if(((cumm_off & 4) == 4) && (FT(2)*p.x()<(domain().xmax()+domain().xmin()))) off_query += Offset(1,0,0); - if (((cumm_off & 2) == 2) && (FT(2)*p.y()<(_domain.ymax()+_domain.ymin()))) + if(((cumm_off & 2) == 2) && (FT(2)*p.y()<(domain().ymax()+domain().ymin()))) off_query += Offset(0,1,0); - if (((cumm_off & 1) == 1) && (FT(2)*p.z()<(_domain.zmax()+_domain.zmin()))) + if(((cumm_off & 1) == 1) && (FT(2)*p.z()<(domain().zmax()+domain().zmin()))) off_query += Offset(0,0,1); } @@ -1683,20 +2115,19 @@ exact_periodic_locate start->neighbor(3)->index(start))==start); // We implement the remembering visibility/stochastic walk. - + // Remembers the previous cell to avoid useless orientation tests. Cell_handle previous = Cell_handle(); Cell_handle c = start; - + // Stores the results of the 4 orientation tests. It will be used // at the end to decide if p lies on a face/edge/vertex/interior. Orientation o[4]; - - boost::rand48 rng; + + boost::rand48 rng; boost::uniform_smallint<> four(0, 3); boost::variate_generator > die4(rng, four); - // Now treat the cell c. try_next_cell: // For the remembering stochastic walk, @@ -1705,8 +2136,7 @@ try_next_cell: // For the remembering visibility walk (Delaunay only), we don't : // int i = 0; - cumm_off = - c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); + cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null()); @@ -1717,54 +2147,54 @@ try_next_cell: Offset off[4]; const Point* pts[4] = { &(c->vertex(0)->point()), - &(c->vertex(1)->point()), - &(c->vertex(2)->point()), - &(c->vertex(3)->point()) }; + &(c->vertex(1)->point()), + &(c->vertex(2)->point()), + &(c->vertex(3)->point()) }; - if (!simplicity_criterion && is_1_cover() ) { - for (int i=0; i<4; i++) { + if(!simplicity_criterion && is_1_cover() ) { + for(int i=0; i<4; i++) { off[i] = int_to_off(c->offset(i)); } } - - if (!is_1_cover()) { + + if(!is_1_cover()) { // Just fetch the vertices of c as points with offsets - for (int i=0; i<4; i++) { + for(int i=0; i<4; i++) { pts[i] = &(c->vertex(i)->point()); off[i] = get_offset(c,i); } } - - for (int j=0; j != 4; ++j, i = (i+1)&3) { + + for(int j=0; j != 4; ++j, i = (i+1)&3) { Cell_handle next = c->neighbor(i); - if (previous == next) { + if(previous == next) { o[i] = POSITIVE; continue; } - + CGAL_triangulation_assertion(next->neighbor(next->index(c)) == c); - + // We temporarily put p at i's place in pts. const Point* backup = pts[i]; pts[i] = &p; - - if (simplicity_criterion && is_1_cover() ) { + + if(simplicity_criterion && is_1_cover() ) { o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3]); - - if ( o[i] != NEGATIVE ) { + + if( o[i] != NEGATIVE ) { pts[i] = backup; continue; } } else { Offset backup_off; - + backup_off = off[i]; off[i] = off_query; o[i] = orientation(*pts[0], *pts[1], *pts[2], *pts[3], off[0], off[1], off[2], off[3]); - if ( o[i] != NEGATIVE ) { + if( o[i] != NEGATIVE ) { pts[i] = backup; off[i] = backup_off; continue; @@ -1773,47 +2203,48 @@ try_next_cell: // Test whether we need to adapt the offset of the query point. // This means, if we get out of the current cover. - off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next)); + off_query = combine_offsets(off_query, neighbor_offset(c,i,next)); previous = c; c = next; goto try_next_cell; } - + // Ok, now we have found the cell. It remains to find the dimension of the // intersected simplex. // now p is in c or on its boundary int sum = ( o[0] == COPLANAR ) - + ( o[1] == COPLANAR ) - + ( o[2] == COPLANAR ) - + ( o[3] == COPLANAR ); - switch (sum) { + + ( o[1] == COPLANAR ) + + ( o[2] == COPLANAR ) + + ( o[3] == COPLANAR ); + switch(sum) { case 0: lt = CELL; break; case 1: lt = FACET; li = ( o[0] == COPLANAR ) ? 0 : - ( o[1] == COPLANAR ) ? 1 : - ( o[2] == COPLANAR ) ? 2 : 3; + ( o[1] == COPLANAR ) ? 1 : + ( o[2] == COPLANAR ) ? 2 : 3; break; case 2: lt = EDGE; li = ( o[0] != COPLANAR ) ? 0 : - ( o[1] != COPLANAR ) ? 1 : 2; + ( o[1] != COPLANAR ) ? 1 : 2; lj = ( o[li+1] != COPLANAR ) ? li+1 : - ( o[li+2] != COPLANAR ) ? li+2 : li+3; + ( o[li+2] != COPLANAR ) ? li+2 : li+3; break; case 3: lt = VERTEX; li = ( o[0] != COPLANAR ) ? 0 : - ( o[1] != COPLANAR ) ? 1 : - ( o[2] != COPLANAR ) ? 2 : 3; + ( o[1] != COPLANAR ) ? 1 : + ( o[2] != COPLANAR ) ? 2 : 3; break; default: // Vertex can not lie on four facets CGAL_triangulation_assertion(false); } + lo = off_query; return c; } @@ -1823,120 +2254,119 @@ template < class GT, class TDS > typename Periodic_3_triangulation_3::Cell_handle Periodic_3_triangulation_3:: inexact_periodic_locate(const Point& p, const Offset& o_p, - Cell_handle start, - int n_of_turns) const + Cell_handle start, + int n_of_turns) const { - int cumm_off = 0; - Offset off_query = o_p; - if (number_of_vertices() == 0) { - return Cell_handle(); - } - CGAL_triangulation_assertion(number_of_vertices() != 0); + int cumm_off = 0; + Offset off_query = o_p; + if(number_of_vertices() == 0) { + return Cell_handle(); + } + CGAL_triangulation_assertion(number_of_vertices() != 0); - if (start == Cell_handle()) { - start = cells_begin(); - } + if(start == Cell_handle()) { + start = cells_begin(); + } - cumm_off = start->offset(0) | start->offset(1) - | start->offset(2) | start->offset(3); - if (is_1_cover() && cumm_off != 0) { - if (((cumm_off & 4) == 4) && (FT(2)*p.x()<(_domain.xmax()+_domain.xmin()))) - off_query += Offset(1,0,0); - if (((cumm_off & 2) == 2) && (FT(2)*p.y()<(_domain.ymax()+_domain.ymin()))) - off_query += Offset(0,1,0); - if (((cumm_off & 1) == 1) && (FT(2)*p.z()<(_domain.zmax()+_domain.zmin()))) - off_query += Offset(0,0,1); - } + cumm_off = start->offset(0) | start->offset(1) + | start->offset(2) | start->offset(3); + if(is_1_cover() && cumm_off != 0) { + if(((cumm_off & 4) == 4) && (FT(2)*p.x()<(domain().xmax()+domain().xmin()))) + off_query += Offset(1,0,0); + if(((cumm_off & 2) == 2) && (FT(2)*p.y()<(domain().ymax()+domain().ymin()))) + off_query += Offset(0,1,0); + if(((cumm_off & 1) == 1) && (FT(2)*p.z()<(domain().zmax()+domain().zmin()))) + off_query += Offset(0,0,1); + } - CGAL_triangulation_postcondition(start!=Cell_handle()); - CGAL_triangulation_assertion(start->neighbor(0)->neighbor( - start->neighbor(0)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(1)->neighbor( - start->neighbor(1)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(2)->neighbor( - start->neighbor(2)->index(start))==start); - CGAL_triangulation_assertion(start->neighbor(3)->neighbor( - start->neighbor(3)->index(start))==start); + CGAL_triangulation_postcondition(start!=Cell_handle()); + CGAL_triangulation_assertion(start->neighbor(0)->neighbor( + start->neighbor(0)->index(start))==start); + CGAL_triangulation_assertion(start->neighbor(1)->neighbor( + start->neighbor(1)->index(start))==start); + CGAL_triangulation_assertion(start->neighbor(2)->neighbor( + start->neighbor(2)->index(start))==start); + CGAL_triangulation_assertion(start->neighbor(3)->neighbor( + start->neighbor(3)->index(start))==start); - // We implement the remembering visibility/stochastic walk. + // We implement the remembering visibility/stochastic walk. - // Remembers the previous cell to avoid useless orientation tests. - Cell_handle previous = Cell_handle(); - Cell_handle c = start; + // Remembers the previous cell to avoid useless orientation tests. + Cell_handle previous = Cell_handle(); + Cell_handle c = start; - // Now treat the cell c. + // Now treat the cell c. try_next_cell: --n_of_turns; - cumm_off = - c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); + cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); - bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null()); + bool simplicity_criterion = (cumm_off == 0) && (off_query.is_null()); - // We know that the 4 vertices of c are positively oriented. - // So, in order to test if p is seen outside from one of c's facets, - // we just replace the corresponding point by p in the orientation - // test. We do this using the arrays below. + // We know that the 4 vertices of c are positively oriented. + // So, in order to test if p is seen outside from one of c's facets, + // we just replace the corresponding point by p in the orientation + // test. We do this using the arrays below. - Offset off[4]; - const Point* pts[4] = { &(c->vertex(0)->point()), - &(c->vertex(1)->point()), - &(c->vertex(2)->point()), - &(c->vertex(3)->point()) }; + Offset off[4]; + const Point* pts[4] = { &(c->vertex(0)->point()), + &(c->vertex(1)->point()), + &(c->vertex(2)->point()), + &(c->vertex(3)->point()) }; - if (!simplicity_criterion && is_1_cover() ) { - for (int i=0; i<4; i++) { - off[i] = int_to_off(c->offset(i)); - } - } + if(!simplicity_criterion && is_1_cover() ) { + for(int i=0; i<4; i++) { + off[i] = int_to_off(c->offset(i)); + } + } - if (!is_1_cover()) { - // Just fetch the vertices of c as points with offsets - for (int i=0; i<4; i++) { - pts[i] = &(c->vertex(i)->point()); - off[i] = get_offset(c,i); - } - } + if(!is_1_cover()) { + // Just fetch the vertices of c as points with offsets + for(int i=0; i<4; i++) { + pts[i] = &(c->vertex(i)->point()); + off[i] = get_offset(c,i); + } + } - for (int i=0; i != 4; ++i) { - Cell_handle next = c->neighbor(i); - if (previous == next) { - continue; - } + for(int i=0; i != 4; ++i) { + Cell_handle next = c->neighbor(i); + if(previous == next) { + continue; + } - // We temporarily put p at i's place in pts. - const Point* backup = pts[i]; - pts[i] = &p; + // We temporarily put p at i's place in pts. + const Point* backup = pts[i]; + pts[i] = &p; - if (simplicity_criterion && is_1_cover() ) { - if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3]) != NEGATIVE ) { - pts[i] = backup; - continue; - } - } - else { - Offset backup_off; + if(simplicity_criterion && is_1_cover() ) { + if( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3]) != NEGATIVE ) { + pts[i] = backup; + continue; + } + } + else { + Offset backup_off; - backup_off = off[i]; - off[i] = off_query; + backup_off = off[i]; + off[i] = off_query; - if ( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3], - off[0], off[1], off[2], off[3]) != NEGATIVE ) { - pts[i] = backup; - off[i] = backup_off; - continue; - } - } + if( inexact_orientation(*pts[0], *pts[1], *pts[2], *pts[3], + off[0], off[1], off[2], off[3]) != NEGATIVE ) { + pts[i] = backup; + off[i] = backup_off; + continue; + } + } - // Test whether we need to adapt the offset of the query point. - // This means, if we get out of the current cover. - off_query = combine_offsets(off_query, get_neighbor_offset(c,i,next)); - previous = c; - c = next; - if (n_of_turns) - goto try_next_cell; - } + // Test whether we need to adapt the offset of the query point. + // This means, if we get out of the current cover. + off_query = combine_offsets(off_query, neighbor_offset(c,i,next)); + previous = c; + c = next; + if(n_of_turns) + goto try_next_cell; + } - return c; + return c; } #endif @@ -1951,15 +2381,15 @@ try_next_cell: * ON_UNBOUNDED_SIDE if p lies outside the cell * (for an infinite cell this means that p is not in the preceding * two cases) - * + * * lt has a meaning only when ON_BOUNDED_SIDE or ON_BOUNDARY */ // TODO: currently off is not used. It could probably be optimized // using off. template < class GT, class TDS > inline Bounded_side Periodic_3_triangulation_3::side_of_cell( - const Point & q, const Offset &off, Cell_handle c, - Locate_type & lt, int & i, int & j) const + const Point& q, const Offset& off, Cell_handle c, + Locate_type& lt, int& i, int& j) const { CGAL_triangulation_precondition( number_of_vertices() != 0 ); @@ -1967,14 +2397,14 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( o0 = o1 = o2 = o3 = ZERO; int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); - if ((cumm_off == 0) && (is_1_cover())) { + if((cumm_off == 0) && (is_1_cover())) { CGAL_triangulation_assertion(off == Offset()); - const Point &p0 = c->vertex(0)->point(); - const Point &p1 = c->vertex(1)->point(); - const Point &p2 = c->vertex(2)->point(); - const Point &p3 = c->vertex(3)->point(); - - if (((o0 = orientation(q ,p1,p2,p3)) == NEGATIVE) || + const Point& p0 = c->vertex(0)->point(); + const Point& p1 = c->vertex(1)->point(); + const Point& p2 = c->vertex(2)->point(); + const Point& p3 = c->vertex(3)->point(); + + if(((o0 = orientation(q ,p1,p2,p3)) == NEGATIVE) || ((o1 = orientation(p0,q ,p2,p3)) == NEGATIVE) || ((o2 = orientation(p0,p1,q ,p3)) == NEGATIVE) || ((o3 = orientation(p0,p1,p2,q )) == NEGATIVE) ) { @@ -1984,41 +2414,41 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( Offset off_q; Offset offs[4]; const Point *p[4]; - for (int i=0; i<4; i++) { + for(int i=0; i<4; i++) { p[i] = &(c->vertex(i)->point()); offs[i] = get_offset(c,i); } CGAL_triangulation_assertion(orientation(*p[0], *p[1], *p[2], *p[3], - offs[0], offs[1], offs[2], offs[3]) == POSITIVE); + offs[0], offs[1], offs[2], offs[3]) == POSITIVE); bool found=false; - for (int i=0; (i<8)&&(!found); i++) { - if ((cumm_off | ((~i)&7)) == 7) { + for(int i=0; (i<8)&&(!found); i++) { + if((cumm_off | ((~i)&7)) == 7) { o0 = o1 = o2 = o3 = NEGATIVE; off_q = combine_offsets(off, int_to_off(i)); - if (((o0 = orientation( q, *p[1], *p[2], *p[3], - off_q ,offs[1],offs[2],offs[3])) != NEGATIVE)&& - ((o1 = orientation( *p[0], q, *p[2], *p[3], - offs[0], off_q,offs[2],offs[3])) != NEGATIVE)&& - ((o2 = orientation( *p[0], *p[1], q, *p[3], - offs[0],offs[1], off_q,offs[3])) != NEGATIVE)&& - ((o3 = orientation( *p[0], *p[1], *p[2], q, - offs[0],offs[1],offs[2], off_q)) != NEGATIVE)) { + if(((o0 = orientation(q, *p[1], *p[2], *p[3], + off_q ,offs[1],offs[2],offs[3])) != NEGATIVE)&& + ((o1 = orientation(*p[0], q, *p[2], *p[3], + offs[0], off_q,offs[2],offs[3])) != NEGATIVE)&& + ((o2 = orientation(*p[0], *p[1], q, *p[3], + offs[0],offs[1], off_q,offs[3])) != NEGATIVE)&& + ((o3 = orientation(*p[0], *p[1], *p[2], q, + offs[0],offs[1],offs[2], off_q)) != NEGATIVE)) { found = true; } } } - if (!found) return ON_UNBOUNDED_SIDE; + if(!found) return ON_UNBOUNDED_SIDE; } // now all the oi's are >=0 // sum gives the number of facets p lies on - int sum = ( (o0 == ZERO) ? 1 : 0 ) - + ( (o1 == ZERO) ? 1 : 0 ) - + ( (o2 == ZERO) ? 1 : 0 ) - + ( (o3 == ZERO) ? 1 : 0 ); + int sum = ( (o0 == ZERO) ? 1 : 0 ) + + ( (o1 == ZERO) ? 1 : 0 ) + + ( (o2 == ZERO) ? 1 : 0 ) + + ( (o3 == ZERO) ? 1 : 0 ); - switch (sum) { + switch(sum) { case 0: { lt = CELL; @@ -2029,9 +2459,8 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( lt = FACET; // i = index such that p lies on facet(i) i = ( o0 == ZERO ) ? 0 : - ( o1 == ZERO ) ? 1 : - ( o2 == ZERO ) ? 2 : - 3; + ( o1 == ZERO ) ? 1 : + ( o2 == ZERO ) ? 2 : 3; return ON_BOUNDARY; } case 2: @@ -2040,13 +2469,11 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( // i = smallest index such that p does not lie on facet(i) // i must be < 3 since p lies on 2 facets i = ( o0 == POSITIVE ) ? 0 : - ( o1 == POSITIVE ) ? 1 : - 2; + ( o1 == POSITIVE ) ? 1 : 2; // j = larger index such that p not on facet(j) // j must be > 0 since p lies on 2 facets j = ( o3 == POSITIVE ) ? 3 : - ( o2 == POSITIVE ) ? 2 : - 1; + ( o2 == POSITIVE ) ? 2 : 1; return ON_BOUNDARY; } case 3: @@ -2054,9 +2481,8 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( lt = VERTEX; // i = index such that p does not lie on facet(i) i = ( o0 == POSITIVE ) ? 0 : - ( o1 == POSITIVE ) ? 1 : - ( o2 == POSITIVE ) ? 2 : - 3; + ( o1 == POSITIVE ) ? 1 : + ( o2 == POSITIVE ) ? 2 : 3; return ON_BOUNDARY; } default: @@ -2068,79 +2494,6 @@ inline Bounded_side Periodic_3_triangulation_3::side_of_cell( } } // side_of_cell -template< class GT, class TDS > -template< class CellIt > -inline void Periodic_3_triangulation_3:: - insert_too_long_edges(Vertex_handle v, - const CellIt begin, const CellIt end) { - CGAL_triangulation_precondition(number_of_vertices() != 0); - // add newly added edges to too_long_edges, if necessary. - Point p1,p2; - Offset omin; - std::pair< Vertex_handle, Vertex_handle > edge_to_add; - std::pair< Offset, Offset > edge_to_add_off; - std::list empty_list; - too_long_edges[v] = empty_list; - // Iterate over all cells of the new star. - for (CellIt it = begin ; it != end ; ++it) { - // Consider all possible vertex pairs. - for (int k=0; k<4 ; k++) { - for (int j=0; j<4 ; j++) { - if (j==k) continue; - if (&*((*it)->vertex(j)) > &*((*it)->vertex(k))) continue; - // make the offsets canonical (wrt. to some notion) - // add to too_long_edges, if not yet added and if "too long" - CGAL_triangulation_precondition( - &*((*it)->vertex(j))< &*((*it)->vertex(k))); - - edge_to_add = std::make_pair((*it)->vertex(j), (*it)->vertex(k)); - - p1 = construct_point((*it)->vertex(j)->point(), get_offset(*it, j)); - p2 = construct_point((*it)->vertex(k)->point(), get_offset(*it, k)); - - if ((squared_distance(p1,p2) > edge_length_threshold) - && (find(too_long_edges[(*it)->vertex(j)].begin(), - too_long_edges[(*it)->vertex(j)].end(), - edge_to_add.second) - == too_long_edges[(*it)->vertex(j)].end()) - ){ - too_long_edges[(*it)->vertex(j)].push_back(edge_to_add.second); - too_long_edge_counter++; - } - } } - } -} - -template < class GT, class TDS > -template < class CellIt > -inline void Periodic_3_triangulation_3:: - delete_too_long_edges(const CellIt begin, const CellIt end) { - std::pair< Vertex_handle, Vertex_handle > edge_to_delete, edge_to_delete2; - typename std::list< Vertex_handle >::iterator sit; - // Iterate over all cells that are in the star. That means that those cells - // are going to be deleted. Therefore, all of them have to be deleted from - // too_long_edges, if they are contained in it. - for (CellIt it = begin ; it != end ; ++it) { - for (int j=0; j<4 ; j++) { - for (int k=0; k<4; k++) { - if (&*((*it)->vertex(j)) < &*((*it)->vertex(k))) { - edge_to_delete = std::make_pair((*it)->vertex(j),(*it)->vertex(k)); - } else { - edge_to_delete = std::make_pair((*it)->vertex(k),(*it)->vertex(j)); - } - Vertex_handle v_no = edge_to_delete.first; - sit = find(too_long_edges[v_no].begin(), - too_long_edges[v_no].end(), - edge_to_delete.second); - if (sit != too_long_edges[v_no].end()) { - too_long_edges[v_no].erase(sit); - too_long_edge_counter--; - } - } - } - } -} - /*! \brief Insert point. * * Inserts the point p into the triangulation. It assumes that @@ -2153,19 +2506,19 @@ inline void Periodic_3_triangulation_3:: * - backup hidden points * - Delete the edges of the marked cells from too_long_edges * - Insert the new vertex in the hole obtained by removing the -* conflicting cells (star-approach) --> _tds._insert_in_hole +* conflicting cells (star-approach) --> _tds._insert_in_hole * - find out about offsets * - Insert the newly added edges that are "too long" * to too_long_edges * - reinsert hidden points */ template < class GT, class TDS > -template < class Conflict_tester, class Point_hider > +template < class Conflict_tester, class Point_hider, class CoverManager > inline typename Periodic_3_triangulation_3::Vertex_handle Periodic_3_triangulation_3::periodic_insert( - const Point & p, const Offset& o, - Locate_type lt, Cell_handle c, const Conflict_tester &tester, - Point_hider &hider, Vertex_handle vh) + const Point& p, const Offset& o, + Locate_type /*lt*/, Cell_handle c, const Conflict_tester& tester, + Point_hider& hider, CoverManager& cover_manager, Vertex_handle vh) { Vertex_handle v; CGAL_triangulation_precondition(number_of_vertices() != 0); @@ -2176,21 +2529,19 @@ Periodic_3_triangulation_3::periodic_insert( tester.set_offset(o); - // This only holds for Delaunay - CGAL_triangulation_assertion(lt != VERTEX); - CGAL_USE(lt); - // Choose the periodic copy of tester.point() that is inside c. - Offset current_off = get_location_offset(tester, c); + bool found = false; + Offset current_off = get_location_offset(tester, c, found); CGAL_triangulation_assertion(side_of_cell(tester.point(), combine_offsets(o,current_off),c,lt_assert,i_assert,j_assert) != ON_UNBOUNDED_SIDE); // If the new point is not in conflict with its cell, it is hidden. - if (!tester.test_initial_cell(c, current_off)) { + if(!found || !tester.test_initial_cell(c, current_off)) { hider.hide_point(c,p); return Vertex_handle(); } + // Ok, we really insert the point now. // First, find the conflict region. std::vector cells; @@ -2199,22 +2550,21 @@ Periodic_3_triangulation_3::periodic_insert( Facet facet; find_conflicts(c, current_off, tester, - make_triple(Oneset_iterator(facet), - std::back_inserter(cells), - Emptyset_iterator())); + make_triple(Oneset_iterator(facet), + std::back_inserter(cells), + Emptyset_iterator())); // Remember the points that are hidden by the conflicting cells, // as they will be deleted during the insertion. hider.set_vertices(cells.begin(), cells.end()); - - if (!is_1_cover()) - delete_too_long_edges(cells.begin(), cells.end()); - + + if(!is_1_cover()) + cover_manager.delete_unsatisfying_elements(cells.begin(), cells.end()); + // Insertion. Attention: facets[0].first MUST be in conflict! // Compute the star and put it into the data structure. // Store the new cells from the star in nbs. - v = _tds._insert_in_hole(cells.begin(), cells.end(), - facet.first, facet.second); + v = _tds._insert_in_hole(cells.begin(), cells.end(), facet.first, facet.second); v->set_point(p); //TODO: this could be done within the _insert_in_hole without losing any @@ -2225,28 +2575,29 @@ Periodic_3_triangulation_3::periodic_insert( incident_cells(v, std::back_inserter(nbs)); // For all neighbors of the newly added vertex v: fetch their offsets from // the tester and reset them in the triangulation data structure. - for (typename std::vector::iterator cit = nbs.begin(); + for(typename std::vector::iterator cit = nbs.begin(); cit != nbs.end(); cit++) { Offset off[4]; - for (int i=0 ; i<4 ; i++) { + for(int i=0; i<4; i++) { off[i] = (*cit)->vertex(i)->offset(); } set_offsets(*cit, off[0], off[1], off[2], off[3]); } - - for (typename std::vector::iterator voit = v_offsets.begin(); - voit != v_offsets.end() ; ++voit) { + + for(typename std::vector::iterator voit = v_offsets.begin(); + voit != v_offsets.end(); ++voit) { (*voit)->clear_offset(); } v_offsets.clear(); - if (vh != Vertex_handle()) { + if(vh != Vertex_handle()) { +// CGAL_triangulation_assertion(virtual_vertices.find(v) == virtual_vertices.end()); virtual_vertices[v] = Virtual_vertex(vh,o); virtual_vertices_reverse[vh].push_back(v); } - if (!is_1_cover()) - insert_too_long_edges(v, nbs.begin(), nbs.end()); + if(!is_1_cover()) + cover_manager.insert_unsatisfying_elements(v, nbs.begin(), nbs.end()); // Store the hidden points in their new cells. hider.reinsert_vertices(v); @@ -2262,8 +2613,8 @@ Periodic_3_triangulation_3::periodic_insert( */ template < class GT, class TDS > inline typename Periodic_3_triangulation_3::Vertex_handle -Periodic_3_triangulation_3::create_initial_triangulation( - const Point &p) { +Periodic_3_triangulation_3::create_initial_triangulation(const Point& p) +{ /// Virtual vertices, one per periodic domain Vertex_handle vir_vertices[3][3][3]; /// Virtual cells, 6 per periodic domain @@ -2272,12 +2623,11 @@ Periodic_3_triangulation_3::create_initial_triangulation( // Initialise vertices: vir_vertices[0][0][0] = _tds.create_vertex(); vir_vertices[0][0][0]->set_point(p); - virtual_vertices_reverse[vir_vertices[0][0][0]] = -std::vector(); - for (int i=0; i<_cover[0]; i++) { - for (int j=0; j<_cover[1]; j++) { - for (int k=0; k<_cover[2]; k++) { - if ((i!=0)||(j!=0)||(k!=0)) { + virtual_vertices_reverse[vir_vertices[0][0][0]] = std::vector(); + for(int i=0; i<_cover[0]; i++) { + for(int j=0; j<_cover[1]; j++) { + for(int k=0; k<_cover[2]; k++) { + if((i!=0)||(j!=0)||(k!=0)) { // Initialise virtual vertices out of the domain for debugging vir_vertices[i][j][k] = _tds.create_vertex(); @@ -2294,13 +2644,13 @@ std::vector(); } // Create cells: - for (int i=0; i<_cover[0]; i++) { - for (int j=0; j<_cover[1]; j++) { - for (int k=0; k<_cover[2]; k++) { - for (int l=0; l<6; l++) { + for(int i=0; i<_cover[0]; i++) { + for(int j=0; j<_cover[1]; j++) { + for(int k=0; k<_cover[2]; k++) { + for(int l=0; l<6; l++) { // 6 cells per 'cube' cells[i][j][k][l] = _tds.create_cell(); - for (int n=0; n<4; n++) + for(int n=0; n<4; n++) CGAL_triangulation_assertion(cells[i][j][k][l] != Cell_handle()); } } @@ -2324,14 +2674,13 @@ std::vector(); { { 0, 0, 0, 1}, { 1, 0, 0, 0}, { 0, 0, 0, 5}, { 0, 0, 0, 3} }, { { 0, 1, 0, 0}, { 0, 0,-1, 1}, { 0, 0, 0, 2}, { 0, 0, 0, 4} } }; - for (int i=0; i<_cover[0]; i++) { - for (int j=0; j<_cover[1]; j++) { - for (int k=0; k<_cover[2]; k++) { - int offset = - (i==_cover[0]-1 ? 4 : 0) | - (j==_cover[1]-1 ? 2 : 0) | - (k==_cover[2]-1 ? 1 : 0); - for (int l=0; l<6; l++) { + for(int i=0; i<_cover[0]; i++) { + for(int j=0; j<_cover[1]; j++) { + for(int k=0; k<_cover[2]; k++) { + int offset = (i==_cover[0]-1 ? 4 : 0) | + (j==_cover[1]-1 ? 2 : 0) | + (k==_cover[2]-1 ? 1 : 0); + for(int l=0; l<6; l++) { // cell 0: cells[i][j][k][l]->set_vertices( vir_vertices @@ -2386,49 +2735,20 @@ std::vector(); } } // set pointers from the vertices to incident cells. - for (int i=0; i<_cover[0]; i++) { - for (int j=0; j<_cover[1]; j++) { - for (int k=0; k<_cover[2]; k++) { + for(int i=0; i<_cover[0]; i++) { + for(int j=0; j<_cover[1]; j++) { + for(int k=0; k<_cover[2]; k++) { vir_vertices[i][j][k]->set_cell(cells[i][j][k][0]); } } } - + _tds.set_dimension(3); - // create the base for too_long_edges; - CGAL_triangulation_assertion( too_long_edges.empty() ); - CGAL_triangulation_assertion(too_long_edge_counter == 0); - - for (Vertex_iterator vit = vertices_begin() ; - vit !=vertices_end() ; ++vit ) - too_long_edges[vit] = std::list();; - - std::vector temp_inc_cells; - for (Vertex_iterator vit = vertices_begin() ; - vit !=vertices_end() ; ++vit ) { - temp_inc_cells.clear(); - incident_cells(vit, std::back_inserter(temp_inc_cells)); - for (unsigned int i=0 ; iindex(vit); - for (int j=0; j<4 ; j++) { - if (j==k) continue; - if (&*vit > &*(temp_inc_cells[i]->vertex(j))) continue; - if ((find(too_long_edges[vit].begin(), - too_long_edges[vit].end(), - temp_inc_cells[i]->vertex(j)) == - too_long_edges[vit].end()) - ){ - too_long_edges[vit].push_back(temp_inc_cells[i]->vertex(j)); - too_long_edge_counter++; - } - } - } - } return vir_vertices[0][0][0]; } #define CGAL_INCLUDE_FROM_PERIODIC_3_TRIANGULATION_3_H -#include +#include #undef CGAL_INCLUDE_FROM_PERIODIC_3_TRIANGULATION_3_H /** finds all cells that are in conflict with the currently added point @@ -2444,24 +2764,25 @@ std::vector(); */ template template + class OutputIteratorInternalFacets> Triple Periodic_3_triangulation_3:: -find_conflicts(Cell_handle d, const Offset ¤t_off, - const Conflict_test &tester, - Triple it) const { +find_conflicts(Cell_handle d, const Offset& current_off, + const Conflict_test& tester, + Triple it) const +{ CGAL_triangulation_precondition( number_of_vertices() != 0 ); CGAL_triangulation_precondition( tester(d, current_off) ); std::stack > cell_stack; cell_stack.push(std::make_pair(d,current_off)); - d->tds_data().mark_in_conflict(); + d->tds_data().mark_in_conflict(); *it.second++ = d; do { @@ -2469,37 +2790,37 @@ find_conflicts(Cell_handle d, const Offset ¤t_off, Offset current_off2 = cell_stack.top().second; cell_stack.pop(); - for (int i=0; i< 4; ++i) { + for(int i=0; i< 4; ++i) { Cell_handle test = c->neighbor(i); - if (test->tds_data().is_in_conflict()) { - if (c < test) { - *it.third++ = Facet(c, i); // Internal facet. - } - continue; // test was already in conflict. + if(test->tds_data().is_in_conflict()) { + if(c < test) { + *it.third++ = Facet(c, i); // Internal facet. + } + continue; // test was already in conflict. } - if (test->tds_data().is_clear()) { - Offset o_test = current_off2 + get_neighbor_offset(c, i, test); - if (tester(test,o_test)) { - if (c < test) - *it.third++ = Facet(c, i); // Internal facet. - - cell_stack.push(std::make_pair(test,o_test)); - test->tds_data().mark_in_conflict(); - *it.second++ = test; - continue; - } - test->tds_data().mark_on_boundary(); // test is on the boundary. + if(test->tds_data().is_clear()) { + Offset o_test = current_off2 + neighbor_offset(c, i, test); + if(tester(test,o_test)) { + if(c < test) + *it.third++ = Facet(c, i); // Internal facet. + + cell_stack.push(std::make_pair(test,o_test)); + test->tds_data().mark_in_conflict(); + *it.second++ = test; + continue; + } + test->tds_data().mark_on_boundary(); // test is on the boundary. } *it.first++ = Facet(c, i); - for (int j = 0 ; j<4 ; j++){ - if (j==i) continue; - if (!c->vertex(j)->get_offset_flag()) { - c->vertex(j)->set_offset(int_to_off(c->offset(j))-current_off2); - v_offsets.push_back(c->vertex(j)); - } + for(int j = 0; j<4; j++) { + if(j==i) continue; + if(!c->vertex(j)->get_offset_flag()) { + c->vertex(j)->set_offset(int_to_off(c->offset(j))-current_off2); + v_offsets.push_back(c->vertex(j)); + } } } - } while (!cell_stack.empty()); + } while(!cell_stack.empty()); return it; } @@ -2519,49 +2840,53 @@ find_conflicts(Cell_handle d, const Offset ¤t_off, * - Also insert the eight periodic copies of p. */ template < class GT, class TDS > -template < class Conflict_tester, class Point_hider > +template < class Conflict_tester, class Point_hider, class CoverManager > inline typename Periodic_3_triangulation_3::Vertex_handle -Periodic_3_triangulation_3::insert_in_conflict(const Point & p, +Periodic_3_triangulation_3::insert_in_conflict(const Point& p, Locate_type lt, Cell_handle c, int li, int lj, - const Conflict_tester &tester, Point_hider &hider) { + const Conflict_tester& tester, Point_hider& hider, CoverManager& cover_manager) { + CGAL_triangulation_assertion((domain().xmin() <= p.x()) + && (p.x() < domain().xmax())); + CGAL_triangulation_assertion((domain().ymin() <= p.y()) + && (p.y() < domain().ymax())); + CGAL_triangulation_assertion((domain().zmin() <= p.z()) + && (p.z() < domain().zmax())); - CGAL_triangulation_assertion((_domain.xmin() <= p.x()) - && (p.x() < _domain.xmax())); - CGAL_triangulation_assertion((_domain.ymin() <= p.y()) - && (p.y() < _domain.ymax())); - CGAL_triangulation_assertion((_domain.zmin() <= p.z()) - && (p.z() < _domain.zmax())); - - if (number_of_vertices() == 0) { - return create_initial_triangulation(p); + if(number_of_vertices() == 0) { + Vertex_handle vh = create_initial_triangulation(p); + cover_manager.create_initial_triangulation(); + return vh; } - if ((lt == VERTEX) && - (tester.compare_weight(c->vertex(li)->point(),p)==0) ) { + if((lt == VERTEX) && + (tester.compare_weight(c->vertex(li)->point(),p) == 0) ) { return c->vertex(li); } Vertex_handle vstart; - if (!is_1_cover()) { + if(!is_1_cover()) { Virtual_vertex_map_it vvmit = virtual_vertices.find(c->vertex(0)); - if (vvmit == virtual_vertices.end()) + if(vvmit == virtual_vertices.end()) vstart = c->vertex(0); else vstart = vvmit->second.first; CGAL_triangulation_assertion(virtual_vertices.find(vstart) - ==virtual_vertices.end()); + ==virtual_vertices.end()); CGAL_triangulation_assertion(virtual_vertices_reverse.find(vstart) - != virtual_vertices_reverse.end()); + != virtual_vertices_reverse.end()); } + CGAL_triangulation_assertion( number_of_vertices() != 0 ); CGAL_triangulation_expensive_assertion(is_valid()); - Vertex_handle vh = periodic_insert(p, Offset(), lt, c, tester, hider); - if (is_1_cover()) { + hider.set_original_cube(true); + Vertex_handle vh = periodic_insert(p, Offset(), lt, c, tester, hider, cover_manager); + if(is_1_cover()) { return vh; } - - for (Cell_iterator it = all_cells_begin() ; - it != all_cells_end() ; it++){ + + hider.set_original_cube(false); + for(Cell_iterator it = all_cells_begin(); + it != all_cells_end(); it++) { CGAL_triangulation_assertion(it->neighbor(0)->neighbor( it->neighbor(0)->index(it))==it); CGAL_triangulation_assertion(it->neighbor(1)->neighbor( @@ -2572,18 +2897,15 @@ Periodic_3_triangulation_3::insert_in_conflict(const Point & p, it->neighbor(3)->index(it))==it); } - std::vector start_vertices - = virtual_vertices_reverse.find(vstart)->second; - Cell_handle start; virtual_vertices_reverse[vh] = std::vector(); + Offset lo; // insert 26 periodic copies - for (int i=0; i<_cover[0]; i++) { - for (int j=0; j<_cover[1]; j++) { - for (int k=0; k<_cover[2]; k++) { - if ((i!=0)||(j!=0)||(k!=0)) { - start = start_vertices[i*9+j*3+k-1]->cell(); - c = periodic_locate(p, Offset(i,j,k), lt, li, lj, start); - periodic_insert(p, Offset(i,j,k), lt, c, tester, hider,vh); + for(int i=0; i<_cover[0]; i++) { + for(int j=0; j<_cover[1]; j++) { + for(int k=0; k<_cover[2]; k++) { + if((i!=0)||(j!=0)||(k!=0)) { + c = periodic_locate(p, Offset(i,j,k), lo, lt, li, lj, Cell_handle()); + periodic_insert(p, Offset(i,j,k), lt, c, tester, hider,cover_manager,vh); } } } @@ -2592,7 +2914,7 @@ Periodic_3_triangulation_3::insert_in_conflict(const Point & p, // Fall back to 1-cover if the criterion that the longest edge is shorter // than sqrt(0.166) is fulfilled. - if ( too_long_edge_counter == 0 ) { + if( cover_manager.can_be_converted_to_1_sheet() ) { CGAL_triangulation_expensive_assertion(is_valid()); convert_to_1_sheeted_covering(); CGAL_triangulation_expensive_assertion( is_valid() ); @@ -2603,21 +2925,21 @@ Periodic_3_triangulation_3::insert_in_conflict(const Point & p, /// tests if two vertices of one cell are just periodic copies of each other template < class GT, class TDS > inline bool Periodic_3_triangulation_3::has_self_edges(Cell_handle c) const { - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(1)) || - (c->offset(0) != c->offset(1))); - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(2)) || - (c->offset(0) != c->offset(2))); - CGAL_triangulation_assertion((c->vertex(0) != c->vertex(3)) || - (c->offset(0) != c->offset(3))); - CGAL_triangulation_assertion((c->vertex(1) != c->vertex(2)) || - (c->offset(1) != c->offset(2))); - CGAL_triangulation_assertion((c->vertex(1) != c->vertex(3)) || - (c->offset(1) != c->offset(3))); - CGAL_triangulation_assertion((c->vertex(2) != c->vertex(3)) || - (c->offset(2) != c->offset(3))); + CGAL_triangulation_assertion((c->vertex(0) != c->vertex(1)) || + (c->offset(0) != c->offset(1))); + CGAL_triangulation_assertion((c->vertex(0) != c->vertex(2)) || + (c->offset(0) != c->offset(2))); + CGAL_triangulation_assertion((c->vertex(0) != c->vertex(3)) || + (c->offset(0) != c->offset(3))); + CGAL_triangulation_assertion((c->vertex(1) != c->vertex(2)) || + (c->offset(1) != c->offset(2))); + CGAL_triangulation_assertion((c->vertex(1) != c->vertex(3)) || + (c->offset(1) != c->offset(3))); + CGAL_triangulation_assertion((c->vertex(2) != c->vertex(3)) || + (c->offset(2) != c->offset(3))); return ((c->vertex(0) == c->vertex(1)) || - (c->vertex(0) == c->vertex(2)) || - (c->vertex(0) == c->vertex(3)) || + (c->vertex(0) == c->vertex(2)) || + (c->vertex(0) == c->vertex(3)) || (c->vertex(1) == c->vertex(2)) || (c->vertex(1) == c->vertex(3)) || (c->vertex(2) == c->vertex(3))); @@ -2636,38 +2958,56 @@ inline bool Periodic_3_triangulation_3::has_self_edges(Cell_handle c) co template < class GT, class TDS > bool Periodic_3_triangulation_3:: -is_valid(bool verbose, int level) const { +is_valid(bool verbose, int level) const +{ + if(!is_1_cover()) + { + for(Virtual_vertex_reverse_map_it iter = virtual_vertices_reverse.begin(), end_iter = virtual_vertices_reverse.end(); + iter != end_iter; + ++iter) + { + for(typename Virtual_vertex_reverse_map::mapped_type::const_iterator iter_2 = iter->second.begin(), + end_iter_2 = iter->second.end(); + iter_2 != end_iter_2; + ++iter_2) + { + CGAL_triangulation_assertion(virtual_vertices.find(*iter_2) != virtual_vertices.end()); + CGAL_triangulation_assertion(virtual_vertices.at(*iter_2).first == iter->first); + } + } + } + bool error = false; - for (Cell_iterator cit = cells_begin(); + for(Cell_iterator cit = cells_begin(); cit != cells_end(); ++cit) { - for (int i=0; i<4; i++) { + for(int i=0; i<4; i++) { CGAL_triangulation_assertion(cit != cit->neighbor(i)); - for (int j=i+1; j<4; j++) { + for(int j=i+1; j<4; j++) { CGAL_triangulation_assertion(cit->neighbor(i) != cit->neighbor(j)); CGAL_triangulation_assertion(cit->vertex(i) != cit->vertex(j)); } } // Check positive orientation: const Point *p[4]; Offset off[4]; - for (int i=0; i<4; i++) { + for(int i=0; i<4; i++) { p[i] = &cit->vertex(i)->point(); off[i] = get_offset(cit,i); } - if (orientation(*p[0], *p[1], *p[2], *p[3], + if(orientation(*p[0], *p[1], *p[2], *p[3], off[0], off[1], off[2], off[3]) != POSITIVE) { - if (verbose) { - std::cerr<<"Periodic_3_triangulation_3: wrong orientation:"< bool Periodic_3_triangulation_3::is_valid(Cell_handle ch, - bool verbose, int level) const { - if ( ! _tds.is_valid(ch,verbose,level) ) + bool verbose, int level) const +{ + if( ! _tds.is_valid(ch,verbose,level) ) return false; + bool error = false; const Point *p[4]; Offset off[4]; - for (int i=0; i<4; i++) { + for(int i=0; i<4; i++) { p[i] = &ch->vertex(i)->point(); off[i] = get_offset(ch,i); } - if (orientation(*p[0], *p[1], *p[2], *p[3], - off[0], off[1], off[2], off[3]) != POSITIVE) { + + if(orientation(*p[0], *p[1], *p[2], *p[3], + off[0], off[1], off[2], off[3]) != POSITIVE) { error = true; } - + return !error; } template < class GT, class TDS > template < class ConflictTester > bool Periodic_3_triangulation_3:: -is_valid_conflict(ConflictTester &tester, bool verbose, int level) const { +is_valid_conflict(ConflictTester& tester, bool verbose, int level) const +{ Cell_iterator it; - for ( it = cells_begin(); it != cells_end(); ++it ) { + for( it = cells_begin(); it != cells_end(); ++it ) { is_valid(it, verbose, level); - for (int i=0; i<4; i++ ) { - Offset o_nb = get_neighbor_offset(it,i,it->neighbor(i)); + for(int i=0; i<4; i++ ) { + Offset o_nb = neighbor_offset(it,i,it->neighbor(i)); Offset o_vt = get_offset(it->neighbor(i), - it->neighbor(i)->index(it)); - if (tester(it, - it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point(), - o_vt-o_nb)) { - if (verbose) + it->neighbor(i)->index(it)); + if(tester(it, + it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point(), + o_vt-o_nb)) { + if(verbose) { std::cerr << "non-empty sphere: " - <vertex(0)->point()<<'\t' - <vertex(1)->point()<<'\t' - <vertex(2)->point()<<'\t' - <vertex(3)->point()<<'\n' - <neighbor(i)->vertex(it->neighbor(i)->index(it))->point() - <<'\t'<vertex(0)->point()<<'\t' + << it->vertex(1)->point()<<'\t' + << it->vertex(2)->point()<<'\t' + << it->vertex(3)->point()<<'\n' + << it->neighbor(i)->vertex(it->neighbor(i)->index(it))->point() + << '\t'< -inline void Periodic_3_triangulation_3::make_hole(Vertex_handle v, - std::map &outer_map, std::vector &hole) { - - //CGAL_triangulation_precondition( all_vertices_begin()++ - // != all_vertices_end() ); - +inline void Periodic_3_triangulation_3::make_hole(Vertex_handle v, + std::map& outer_map, + std::vector& hole) +{ + //CGAL_triangulation_precondition( all_vertices_begin()++ != all_vertices_end() ); + incident_cells(v, std::back_inserter(hole)); - for (typename std::vector::iterator cit = hole.begin(); + for(typename std::vector::iterator cit = hole.begin(); cit != hole.end(); ++cit) { int indv = (*cit)->index(v); Cell_handle opp_cit = (*cit)->neighbor( indv ); - Facet f(opp_cit, opp_cit->index(*cit)); + Facet f(opp_cit, opp_cit->index(*cit)); Vertex_triple vt = make_vertex_triple(f); make_canonical(vt); outer_map[vt] = f; - for (int i=0; i<4; i++) - if ( i != indv ) + for(int i=0; i<4; i++) + if( i != indv ) (*cit)->vertex(i)->set_cell(opp_cit); } } @@ -2752,41 +3097,43 @@ inline void Periodic_3_triangulation_3::make_hole(Vertex_handle v, * Removes vertex v from the triangulation. */ template < class GT, class TDS > -template < class PointRemover, class Conflict_tester> -inline void Periodic_3_triangulation_3::remove(Vertex_handle v, - PointRemover &r, Conflict_tester &t) { +template < class PointRemover, class Conflict_tester, class CoverManager> +inline void Periodic_3_triangulation_3::remove( + Vertex_handle v, PointRemover& r, + Conflict_tester& t, CoverManager& cover_manager) +{ CGAL_expensive_precondition(is_vertex(v)); std::vector vhrem; - if (!is_1_cover()) { - if (number_of_vertices() == 1) { + if(!is_1_cover()) { + if(number_of_vertices() == 1) { clear(); return; } Virtual_vertex_map_it vvmit = virtual_vertices.find(v); - if (vvmit != virtual_vertices.end()) v = vvmit->second.first; + if(vvmit != virtual_vertices.end()) v = vvmit->second.first; CGAL_triangulation_assertion(virtual_vertices_reverse.find(v) - != virtual_vertices_reverse.end()); + != virtual_vertices_reverse.end()); vhrem = virtual_vertices_reverse.find(v)->second; virtual_vertices_reverse.erase(v); CGAL_triangulation_assertion(vhrem.size()==26); - for (int i=0 ; i<26 ; i++) { - periodic_remove(vhrem[i],r); + for(int i=0; i<26; i++) { + periodic_remove(vhrem[i],r, cover_manager); virtual_vertices.erase(vhrem[i]); CGAL_triangulation_expensive_assertion(is_valid()); } - periodic_remove(v,r); + periodic_remove(v,r, cover_manager); } else { - periodic_remove(v,r); - if (!is_1_cover()) remove(v,r,t); + periodic_remove(v,r, cover_manager); + if(!is_1_cover()) + remove(v,r, t, cover_manager); } - } /*! \brief Remove a vertex from the triangulation. * * Removes vertex v from the triangulation. * It expects a reference to an instance of a PointRemover. - * + * * Implementation: * - Compute the hole, that is, all cells incident to v. Cells outside of * this hole are not affected by the deletion of v. @@ -2797,14 +3144,14 @@ inline void Periodic_3_triangulation_3::remove(Vertex_handle v, * edge_length_threshold. If not, convert to 3-cover. */ template < class GT, class TDS > -template < class PointRemover > -inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, - PointRemover &remover) { - +template < class PointRemover, class CoverManager > +inline void Periodic_3_triangulation_3::periodic_remove( + Vertex_handle v, PointRemover& remover, CoverManager& cover_manager) +{ // Construct the set of vertex triples on the boundary // with the facet just behind - typedef std::map Vertex_triple_Facet_map; - typedef PointRemover Point_remover; + typedef std::map Vertex_triple_Facet_map; + typedef PointRemover Point_remover; typedef typename Point_remover::CellE_handle CellE_handle; typedef typename Point_remover::VertexE_handle VertexE_handle; typedef typename Point_remover::FacetE FacetE; @@ -2823,18 +3170,9 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, make_hole(v, outer_map, hole); CGAL_triangulation_assertion(outer_map.size()==hole.size()); - CGAL_triangulation_assertion(remover.hidden_points_begin() == - remover.hidden_points_end()); - if (!is_1_cover()) { - delete_too_long_edges(hole.begin(), hole.end()); - } - - // Output the hidden points. - for (typename std::vector::iterator - hi = hole.begin(), hend = hole.end(); hi != hend; ++hi) - { - remover.add_hidden_points(*hi); + if(!is_1_cover()) { + cover_manager.delete_unsatisfying_elements(hole.begin(), hole.end()); } // Build up the map between Vertices on the boundary and offsets @@ -2851,8 +3189,8 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, cit != hole.end(); ++cit) { // Put all incident vertices in tmp_vertices. - for (int j=0; j<4; ++j){ - if ((*cit)->vertex(j) != v){ + for(int j=0; j<4; ++j) { + if((*cit)->vertex(j) != v) { tmp_vertices.insert((*cit)->vertex(j)); vh_off_map[(*cit)->vertex(j)] = int_to_off((*cit)->offset(j)) - int_to_off((*cit)->offset((*cit)->index(v))); @@ -2867,18 +3205,18 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, // create a Delaunay/Regular triangulation of the points on the boundary // in Euclidean space and make a map from the vertices in remover.tmp // towards the vertices in *this - + Unique_hash_map vmap; CellE_handle ch; remover.tmp.clear(); - - for(unsigned int i=0; i < vertices.size(); i++){ + + for(unsigned int i=0; i < vertices.size(); i++) { typedef typename Point_remover::Triangulation_R3::Point TRPoint; - CGAL_triangulation_assertion(get_offset(vertices[i]) - + combine_offsets(Offset(), vh_off_map[vertices[i]]) - == combine_offsets(get_offset(vertices[i]),vh_off_map[vertices[i]])); + CGAL_triangulation_assertion( + get_offset(vertices[i]) + combine_offsets(Offset(), vh_off_map[vertices[i]]) + == combine_offsets(get_offset(vertices[i]),vh_off_map[vertices[i]])); TRPoint trp = std::make_pair(vertices[i]->point(), - combine_offsets( get_offset(vertices[i]), vh_off_map[vertices[i]]) ); + combine_offsets( get_offset(vertices[i]), vh_off_map[vertices[i]]) ); VertexE_handle vh = remover.tmp.insert(trp, ch); vmap[vh] = vertices[i]; CGAL_triangulation_assertion(vmap.is_defined(vh)); @@ -2890,15 +3228,15 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, // Also note that we use the vertices of *this, not of tmp for(Finite_cellsE_iterator it = remover.tmp.finite_cells_begin(); it != remover.tmp.finite_cells_end(); - ++it){ + ++it) { VertexE_triple vt_aux; - for(int i=0; i < 4; i++){ + for(int i=0; i < 4; i++) { FacetE f = std::pair(it,i); vt_aux = VertexE_triple( f.first->vertex(vertex_triple_index(f.second,0)), f.first->vertex(vertex_triple_index(f.second,1)), f.first->vertex(vertex_triple_index(f.second,2))); - if (vmap.is_defined(vt_aux.first) + if(vmap.is_defined(vt_aux.first) && vmap.is_defined(vt_aux.second) && vmap.is_defined(vt_aux.third) ) { Vertex_triple vt(vmap[vt_aux.first],vmap[vt_aux.third], @@ -2915,21 +3253,21 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, std::vector new_cells; // Grow inside the hole, by extending the surface - while(! outer_map.empty()){ + while(! outer_map.empty()) { typename Vertex_triple_Facet_map::iterator oit = outer_map.begin(); - + typename Vertex_triple_Facet_map::value_type o_vt_f_pair = *oit; Cell_handle o_ch = o_vt_f_pair.second.first; unsigned int o_i = o_vt_f_pair.second.second; - + typename Vertex_triple_FacetE_map::iterator iit = inner_map.find(o_vt_f_pair.first); - + CGAL_triangulation_assertion(iit != inner_map.end()); typename Vertex_triple_FacetE_map::value_type i_vt_f_pair = *iit; CellE_handle i_ch = i_vt_f_pair.second.first; unsigned int i_i = i_vt_f_pair.second.second; - + // create a new cell to glue to the outer surface Cell_handle new_ch = _tds.create_cell(); new_cells.push_back(new_ch); @@ -2939,38 +3277,10 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, vh_off_map[vmap[i_ch->vertex(1)]], vh_off_map[vmap[i_ch->vertex(2)]], vh_off_map[vmap[i_ch->vertex(3)]]); - + // Update the edge length management - for( int i=0 ; i < 4 ; i++ ) { - for (int j=0 ; j < 4 ; j++) { - if (j==i) continue; - if (&*(new_ch->vertex(i)) > &*(new_ch->vertex(j))) continue; - - Point p1 = construct_point(new_ch->vertex(i)->point(), - get_offset(new_ch, i)); - Point p2 = construct_point(new_ch->vertex(j)->point(), - get_offset(new_ch, j)); - Vertex_handle v_no = new_ch->vertex(i); - - if (squared_distance(p1,p2) > edge_length_threshold) { - // If the cell does not fulfill the edge-length criterion - // revert all changes to the triangulation and transform it - // to a triangulation in the needed covering space. - if (is_1_cover()) { - _tds.delete_cells(new_cells.begin(), new_cells.end()); - convert_to_27_sheeted_covering(); - return; - } - else if (find(too_long_edges[v_no].begin(), - too_long_edges[v_no].end(), - new_ch->vertex(j)) - == too_long_edges[v_no].end()) { - too_long_edges[v_no].push_back(new_ch->vertex(j)); - too_long_edge_counter++; - } - } - } - } + if(cover_manager.update_cover_data_during_management(new_ch, new_cells)) + return; // The neighboring relation needs to be stored temporarily in // nr_vec. It cannot be applied directly because then we could not @@ -2980,14 +3290,14 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, nr_vec.push_back(boost::make_tuple(new_ch,i_i,o_ch)); // for the other faces check, if they can also be glued - for(unsigned int i = 0; i < 4; i++){ - if(i != i_i){ - Facet f = std::pair(new_ch,i); + for(unsigned int i = 0; i < 4; i++) { + if(i != i_i) { + Facet f = std::pair(new_ch,i); Vertex_triple vt = make_vertex_triple(f); make_canonical(vt); std::swap(vt.second,vt.third); typename Vertex_triple_Facet_map::iterator oit2 = outer_map.find(vt); - if(oit2 == outer_map.end()){ + if(oit2 == outer_map.end()) { std::swap(vt.second,vt.third); outer_map[vt]= f; } else { @@ -2995,8 +3305,8 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, typename Vertex_triple_Facet_map::value_type o_vt_f_pair2 = *oit2; Cell_handle o_ch2 = o_vt_f_pair2.second.first; int o_i2 = o_vt_f_pair2.second.second; - nr_vec.push_back(boost::make_tuple(o_ch2,o_i2,new_ch)); - nr_vec.push_back(boost::make_tuple(new_ch,i,o_ch2)); + nr_vec.push_back(boost::make_tuple(o_ch2,o_i2,new_ch)); + nr_vec.push_back(boost::make_tuple(new_ch,i,o_ch2)); outer_map.erase(oit2); } } @@ -3005,45 +3315,29 @@ inline void Periodic_3_triangulation_3::periodic_remove(Vertex_handle v, } // finally set the neighboring relations - for (unsigned int i=0 ; i()->set_neighbor(nr_vec[i].template get<1>(),nr_vec[i].template get<2>()); } - + + // Output the hidden points. + for(typename std::vector::iterator + hi = hole.begin(), hend = hole.end(); hi != hend; ++hi) + { + remover.add_hidden_points(*hi); + } + _tds.delete_vertex(v); _tds.delete_cells(hole.begin(), hole.end()); CGAL_triangulation_expensive_assertion(is_valid()); } -// ############################################################################ -// ############################################################################ -// ############################################################################ -template < class GT, class TDS > -template < class Cmp > -class Periodic_3_triangulation_3::Perturbation_order { - - typedef GT Geometric_traits; - typedef typename Geometric_traits::Point_3 Point; - typedef typename Geometric_traits::Compare_xyz_3 Compare_xyz_3; - typedef typename Periodic_3_triangulation_3::Periodic_point - Periodic_point; - - Cmp _cmp; - -public: - Perturbation_order(const Cmp & cmp) : _cmp(cmp) {} - - bool operator()(const Periodic_point *p, const Periodic_point *q) const { - return (_cmp(p->first, q->first, p->second, q->second) == SMALLER); - } -}; - // ############################################################################ // ############################################################################ // ############################################################################ /** \brief Delete each redundant cell and the not anymore needed data * structures. - * + * * This function consists of four iterations over all cells and one * iteration over all vertices: * 1. cell iteration: mark all cells that are to delete @@ -3053,29 +3347,32 @@ public: * Vertex iteration: delete all vertices outside the original domain. */ template < class GT, class TDS > -inline void -Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { +inline void +Periodic_3_triangulation_3::convert_to_1_sheeted_covering() +{ // ################################################################### // ### First cell iteration ########################################## // ################################################################### { - if (is_1_cover()) return; + if(is_1_cover()) + return; + bool to_delete, has_simplifiable_offset; Virtual_vertex_map_it vvmit; // First iteration over all cells: Mark the cells that are to delete. // Cells are to delete if they cannot be translated anymore in the // direction of one of the axes without yielding negative offsets. - for( Cell_iterator it = all_cells_begin() ; - it != all_cells_end() ; ++it ) { + for( Cell_iterator it = all_cells_begin(); + it != all_cells_end(); ++it ) { to_delete = false; // for all directions in 3D Space - for( int j=0 ; j<3 ; j++ ) { + for( int j=0; j<3; j++ ) { has_simplifiable_offset = true; // for all vertices of cell it - for( int i=0 ; i<4 ; i++ ) { + for( int i=0; i<4; i++ ) { vvmit = virtual_vertices.find(it->vertex(i)); // if it->vertex(i) lies inside the original domain: - if (vvmit == virtual_vertices.end()) { + if(vvmit == virtual_vertices.end()) { // the cell cannot be moved any more because if we did, then // it->vertex(i) will get at least one negative offset. has_simplifiable_offset = false; @@ -3083,22 +3380,22 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { } else { // The cell can certainly be deleted if the offset contains a 2 to_delete = to_delete - || (vvmit->second.second[j] == 2) ; + || (vvmit->second.second[j] == 2); // The cell can be moved into one direction only if the offset of // all for vertices is >=1 for this direction. Since we already // tested for 2 it is sufficient to test here for 1. has_simplifiable_offset = has_simplifiable_offset - && (vvmit->second.second[j] == 1) ; + && (vvmit->second.second[j] == 1); } - } + } // if the offset can be simplified, i.e. the cell can be moved, then // it can be deleted. - if (has_simplifiable_offset) + if(has_simplifiable_offset) to_delete = true; } // Mark all cells that are to delete. They cannot be deleted yet, // because neighboring information still needs to be extracted. - if (to_delete) { + if(to_delete) { it->set_additional_flag(1); } } @@ -3114,20 +3411,22 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { std::vector > new_neighbor_relations; // Second iteration over all cells: redirect neighbors where necessary - for (Cell_iterator it = all_cells_begin() ; - it != all_cells_end() ; ++it) { + for(Cell_iterator it = all_cells_begin(); + it != all_cells_end(); ++it) { // Skip all cells that are to delete. - if (it->get_additional_flag() == 1) continue; - + if(it->get_additional_flag() == 1) + continue; + // Redirect neighbors: Only neighbors that are marked by the // additional_flag have to be substituted by one of their periodic // copies. The unmarked neighbors stay the same. - for ( int i = 0 ; i < 4 ; i++ ) { - if ( it->neighbor(i)->get_additional_flag() != 1 ) continue; - + for( int i = 0; i < 4; i++ ) { + if( it->neighbor(i)->get_additional_flag() != 1 ) + continue; + nb = it->neighbor(i); - - for ( int j = 0 ; j < 4 ; j++ ) { + + for( int j = 0; j < 4; j++ ) { off[j] = Offset(); get_vertex( nb, j, vert[j], off[j]); } @@ -3138,26 +3437,26 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { (std::min) ( off[2][1], off[3][1] ) ); z = (std::min) ( (std::min) ( off[0][2], off[1][2] ), (std::min) ( off[2][2], off[3][2] ) ); - + // The vector from nb to the "original" periodic copy of nb, that is // the copy that will not be deleted. Offset difference_offset(x,y,z); CGAL_triangulation_assertion( !difference_offset.is_null() ); - + // We now have to find the "original" periodic copy of nb from // its vertices. Therefore, we first have to find the vertices. - for ( int j = 0 ; j < 4 ; j++ ) { + for( int j = 0; j < 4; j++ ) { CGAL_triangulation_assertion( (off[j]-difference_offset)[0] >= 0); CGAL_triangulation_assertion( (off[j]-difference_offset)[1] >= 0); CGAL_triangulation_assertion( (off[j]-difference_offset)[2] >= 0); CGAL_triangulation_assertion( (off[j]-difference_offset)[0] < 3); CGAL_triangulation_assertion( (off[j]-difference_offset)[1] < 3); CGAL_triangulation_assertion( (off[j]-difference_offset)[2] < 3); - + // find the Vertex_handles of the vertices of the "original" // periodic copy of nb. If the vertex is inside the original // domain, there is nothing to do - if ( (off[j]-difference_offset).is_null() ) { + if( (off[j]-difference_offset).is_null() ) { nbv[j] = vert[j]; // If the vertex is outside the original domain, we have to search // in virtual_vertices in the "wrong" direction. That means, we @@ -3171,20 +3470,20 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { } // Find the new neighbor by its 4 vertices new_neighbor = get_cell( nbv ); - + // Store the new neighbor relation. This cannot be applied yet because // it would disturb the functioning of get_cell( ... ) new_neighbor_relations.push_back(make_triple(it, i, new_neighbor)); } } // Apply the new neighbor relations now. - for (unsigned int i=0 ; iset_neighbor( new_neighbor_relations[i].second, new_neighbor_relations[i].third); } } - + // ################################################################### // ### Third cell iteration ########################################## // ################################################################### @@ -3192,23 +3491,25 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { Vertex_handle vert[4]; Offset off[4]; // Third iteration over all cells: redirect vertices where necessary - for (Cell_iterator it = all_cells_begin() ; - it != all_cells_end() ; ++it) { + for(Cell_iterator it = all_cells_begin(); + it != all_cells_end(); ++it) { // Skip all cells that are marked to delete - if (it->get_additional_flag() == 1) continue; + if(it->get_additional_flag() == 1) + continue; + // Find the corresponding vertices of it in the original domain // and set them as new vertices of it. - for ( int i = 0 ; i < 4 ; i++ ) { + for( int i = 0; i < 4; i++ ) { off[i] = Offset(); get_vertex( it, i, vert[i], off[i]); it->set_vertex( i, vert[i]); - CGAL_triangulation_assertion(vert[i]->point()[0] < _domain.xmax()); - CGAL_triangulation_assertion(vert[i]->point()[1] < _domain.ymax()); - CGAL_triangulation_assertion(vert[i]->point()[2] < _domain.zmax()); - CGAL_triangulation_assertion(vert[i]->point()[0] >= _domain.xmin()); - CGAL_triangulation_assertion(vert[i]->point()[1] >= _domain.ymin()); - CGAL_triangulation_assertion(vert[i]->point()[2] >= _domain.zmin()); - + CGAL_triangulation_assertion(vert[i]->point()[0] < domain().xmax()); + CGAL_triangulation_assertion(vert[i]->point()[1] < domain().ymax()); + CGAL_triangulation_assertion(vert[i]->point()[2] < domain().zmax()); + CGAL_triangulation_assertion(vert[i]->point()[0] >= domain().xmin()); + CGAL_triangulation_assertion(vert[i]->point()[1] >= domain().ymin()); + CGAL_triangulation_assertion(vert[i]->point()[2] >= domain().zmin()); + // redirect also the cell pointer of the vertex. it->vertex(i)->set_cell(it); } @@ -3220,21 +3521,25 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { CGAL_triangulation_assertion( int_to_off(it->offset(3)) == off[3] ); } } - + // ################################################################### // ### Fourth cell iteration ######################################### // ################################################################### + std::vector hidden_points; { // Delete the marked cells. std::vector cells_to_delete; - for ( Cell_iterator cit = all_cells_begin() ; - cit != all_cells_end() ; ++cit ) { - if ( cit->get_additional_flag() == 1 ) + for( Cell_iterator cit = all_cells_begin(); + cit != all_cells_end(); ++cit ) { + if( cit->get_additional_flag() == 1 ) + { + gather_cell_hidden_points(cit, hidden_points); cells_to_delete.push_back( cit ); + } } _tds.delete_cells(cells_to_delete.begin(), cells_to_delete.end()); } - + // ################################################################### // ### Vertex iteration ############################################## // ################################################################### @@ -3242,111 +3547,116 @@ Periodic_3_triangulation_3::convert_to_1_sheeted_covering() { // Delete all the vertices in virtual_vertices, that is all vertices // outside the original domain. std::vector vertices_to_delete; - for ( Vertex_iterator vit = all_vertices_begin() ; - vit != all_vertices_end() ; ++vit ) { - if ( virtual_vertices.count( vit ) != 0 ) { + for( Vertex_iterator vit = all_vertices_begin(); + vit != all_vertices_end(); ++vit ) { + if( virtual_vertices.count( vit ) != 0 ) { CGAL_triangulation_assertion( virtual_vertices.count( vit ) == 1 ); - vertices_to_delete.push_back( vit ) ; + vertices_to_delete.push_back( vit ); } } _tds.delete_vertices(vertices_to_delete.begin(), vertices_to_delete.end()); } - _cover = make_array(1,1,1); + _cover = CGAL::make_array(1,1,1); virtual_vertices.clear(); virtual_vertices_reverse.clear(); + reinsert_hidden_points_after_converting_to_1_sheeted(hidden_points); } template < class GT, class TDS > inline void -Periodic_3_triangulation_3::convert_to_27_sheeted_covering() { - if (_cover == make_array(3,3,3)) return; +Periodic_3_triangulation_3::convert_to_27_sheeted_covering() +{ + if(_cover == CGAL::make_array(3,3,3)) + return; + CGAL_triangulation_precondition(is_1_cover()); // Create 27 copies of each vertex and write virtual_vertices and // virtual_vertices_reverse std::list original_vertices; // try to use std::copy instead of the following loop. - for (Vertex_iterator vit = vertices_begin() ; vit != vertices_end() ; ++vit) + for(Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) original_vertices.push_back(vit); - for (typename std::list::iterator vit - = original_vertices.begin() ; vit != original_vertices.end() ; ++vit) { + for(typename std::list::iterator vit + = original_vertices.begin(); vit != original_vertices.end(); ++vit) { Vertex_handle v_cp; std::vector copies; - for (int i=0; i<3; i++) - for (int j=0; j<3; j++) - for (int k=0; k<3; k++) { - if (i==0 && j==0 && k==0) continue; - v_cp = _tds.create_vertex(*vit); - copies.push_back(v_cp); - virtual_vertices.insert(std::make_pair(v_cp, - std::make_pair(*vit,Offset(i,j,k)))); - } + for(int i=0; i<3; i++) + for(int j=0; j<3; j++) + for(int k=0; k<3; k++) { + if(i==0 && j==0 && k==0) + continue; + v_cp = _tds.create_vertex(*vit); + copies.push_back(v_cp); + virtual_vertices.insert(std::make_pair(v_cp, + std::make_pair(*vit,Offset(i,j,k)))); + } virtual_vertices_reverse.insert(std::make_pair(*vit,copies)); } // Create 27 copies of each cell from the respective copies of the // vertices and write virtual_cells and virtual_cells_reverse. typedef std::map > - Virtual_cell_map; + Virtual_cell_map; typedef std::map > - Virtual_cell_reverse_map; + Virtual_cell_reverse_map; typedef typename Virtual_cell_reverse_map::const_iterator VCRMIT; Virtual_cell_map virtual_cells; Virtual_cell_reverse_map virtual_cells_reverse; - + std::list original_cells; - for (Cell_iterator cit = cells_begin() ; cit != cells_end() ; ++cit) + for(Cell_iterator cit = cells_begin(); cit != cells_end(); ++cit) original_cells.push_back(cit); // Store vertex offsets in a separate data structure std::list< Offset > off_v; - for (typename std::list::iterator vit - = original_vertices.begin() ; vit != original_vertices.end() ; ++vit) { + for(typename std::list::iterator vit + = original_vertices.begin(); vit != original_vertices.end(); ++vit) { Cell_handle ccc = (*vit)->cell(); int v_index = ccc->index(*vit); off_v.push_back(int_to_off(ccc->offset(v_index))); } // Store neighboring offsets in a separate data structure - std::list< array > off_nb; - for (typename std::list::iterator cit = original_cells.begin() ; - cit != original_cells.end() ; ++cit) { - array off_nb_c; - for (int i=0; i<4; i++){ + std::list > off_nb; + for(typename std::list::iterator cit = original_cells.begin(); + cit != original_cells.end(); ++cit) { + CGAL::cpp11::array off_nb_c; + for(int i=0; i<4; i++) { Cell_handle ccc = *cit; Cell_handle nnn = ccc->neighbor(i); - off_nb_c[i] = get_neighbor_offset(ccc,i,nnn); + off_nb_c[i] = neighbor_offset(ccc,i,nnn); } off_nb.push_back(off_nb_c); } // Create copies of cells - for (typename std::list::iterator cit = original_cells.begin() ; - cit != original_cells.end() ; ++cit) { + for(typename std::list::iterator cit = original_cells.begin(); + cit != original_cells.end(); ++cit) { Cell_handle c_cp; Vertex_handle v0,v1,v2,v3; std::vector copies; Virtual_vertex_reverse_map_it vvrmit[4]; Offset vvoff[4]; - for (int i=0; i<4; i++) { - vvrmit[i] = virtual_vertices_reverse.find((*cit)->vertex(i)); - CGAL_triangulation_assertion( - vvrmit[i] != virtual_vertices_reverse.end()); - vvoff[i] = int_to_off((*cit)->offset(i)); + for(int i=0; i<4; i++) { + vvrmit[i] = virtual_vertices_reverse.find((*cit)->vertex(i)); + CGAL_triangulation_assertion( + vvrmit[i] != virtual_vertices_reverse.end()); + vvoff[i] = int_to_off((*cit)->offset(i)); } Vertex_handle vvh[4]; - for (int n=0; n<26; n++) { - for (int i=0; i<4; i++) { - // Decomposition of n into an offset (nx,ny,nz): - // nx = (n+1)/9, ny = ((n+1)/3)%3, nz = (n+1)%3 - int o_i = ((n+1)/9+vvoff[i].x()+3)%3; - int o_j = ((n+1)/3+vvoff[i].y()+3)%3; - int o_k = ((n+1)+vvoff[i].z()+3)%3; - int n_c = 9*o_i+3*o_j+o_k-1; - CGAL_triangulation_assertion(n_c >= -1); - if (n_c == -1) vvh[i] = (*cit)->vertex(i); - else vvh[i] = vvrmit[i]->second[n_c]; + for(int n=0; n<26; n++) { + for(int i=0; i<4; i++) { + // Decomposition of n into an offset (nx,ny,nz): + // nx = (n+1)/9, ny = ((n+1)/3)%3, nz = (n+1)%3 + int o_i = ((n+1)/9+vvoff[i].x()+3)%3; + int o_j = ((n+1)/3+vvoff[i].y()+3)%3; + int o_k = ((n+1)+vvoff[i].z()+3)%3; + int n_c = 9*o_i+3*o_j+o_k-1; + CGAL_triangulation_assertion(n_c >= -1); + if(n_c == -1) vvh[i] = (*cit)->vertex(i); + else vvh[i] = vvrmit[i]->second[n_c]; } c_cp = _tds.create_cell(vvh[0], vvh[1], vvh[2], vvh[3]); copies.push_back(c_cp); @@ -3355,136 +3665,141 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() { } // Set new vertices of boundary cells of the original domain. - for (typename std::list::iterator cit = original_cells.begin() ; - cit != original_cells.end() ; ++cit) { - for (int i=0; i<4; i++) { + for(typename std::list::iterator cit = original_cells.begin(); + cit != original_cells.end(); ++cit) { + for(int i=0; i<4; i++) { Virtual_vertex_reverse_map_it vvrmit - = virtual_vertices_reverse.find((*cit)->vertex(i)); + = virtual_vertices_reverse.find((*cit)->vertex(i)); CGAL_triangulation_assertion(vvrmit != virtual_vertices_reverse.end()); Offset vvoff = int_to_off((*cit)->offset(i)); - if (!vvoff.is_null()) { - int n_c = 9*vvoff.x()+3*vvoff.y()+vvoff.z()-1; - CGAL_triangulation_assertion(n_c >= 0); - CGAL_triangulation_assertion(static_cast(n_c) - < vvrmit->second.size()); - (*cit)->set_vertex(i,vvrmit->second[n_c]); + if(!vvoff.is_null()) { + int n_c = 9*vvoff.x()+3*vvoff.y()+vvoff.z()-1; + CGAL_triangulation_assertion(n_c >= 0); + CGAL_triangulation_assertion(static_cast(n_c) + < vvrmit->second.size()); + (*cit)->set_vertex(i,vvrmit->second[n_c]); } } } // Set neighboring relations of cell copies - typename std::list< array >::iterator oit = off_nb.begin() ; - for (typename std::list::iterator cit = original_cells.begin(); - cit != original_cells.end() ; ++cit, ++oit) { + typename std::list >::iterator oit = off_nb.begin(); + for(typename std::list::iterator cit = original_cells.begin(); + cit != original_cells.end(); ++cit, ++oit) { CGAL_triangulation_assertion( oit != off_nb.end() ); VCRMIT c_cp = virtual_cells_reverse.find(*cit); CGAL_triangulation_assertion(c_cp != virtual_cells_reverse.end()); - for (int i=0; i<4; i++) { + for(int i=0; i<4; i++) { Cell_handle cit_nb = (*cit)->neighbor(i); VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb); CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end()); Offset nboff = (*oit)[i]; - for (int n=0; n<26; n++) { - int n_nb; - if (nboff.is_null()) n_nb = n; - else { - int o_i = ((n+1)/9-nboff.x()+3)%3; - int o_j = ((n+1)/3-nboff.y()+3)%3; - int o_k = (n+1-nboff.z()+3)%3; - n_nb = 9*o_i+3*o_j+o_k-1; - } - if (n_nb == -1) { - CGAL_triangulation_assertion(cit_nb->has_vertex( - c_cp->second[n]->vertex((i+1)%4)) ); - CGAL_triangulation_assertion(cit_nb->has_vertex( - c_cp->second[n]->vertex((i+2)%4)) ); - CGAL_triangulation_assertion(cit_nb->has_vertex( - c_cp->second[n]->vertex((i+3)%4)) ); - c_cp->second[n]->set_neighbor(i,cit_nb); - } - else { - CGAL_triangulation_assertion(n_nb >= 0); - CGAL_triangulation_assertion(static_cast(n_nb) - <= c_cp_nb->second.size()); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] - ->has_vertex(c_cp->second[n]->vertex((i+1)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] - ->has_vertex(c_cp->second[n]->vertex((i+2)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] - ->has_vertex(c_cp->second[n]->vertex((i+3)%4)) ); - c_cp->second[n]->set_neighbor(i,c_cp_nb->second[n_nb]); - } + for(int n=0; n<26; n++) { + int n_nb; + if(nboff.is_null()) n_nb = n; + else { + int o_i = ((n+1)/9-nboff.x()+3)%3; + int o_j = ((n+1)/3-nboff.y()+3)%3; + int o_k = (n+1-nboff.z()+3)%3; + n_nb = 9*o_i+3*o_j+o_k-1; + } + if(n_nb == -1) { + CGAL_triangulation_assertion(cit_nb->has_vertex( + c_cp->second[n]->vertex((i+1)%4)) ); + CGAL_triangulation_assertion(cit_nb->has_vertex( + c_cp->second[n]->vertex((i+2)%4)) ); + CGAL_triangulation_assertion(cit_nb->has_vertex( + c_cp->second[n]->vertex((i+3)%4)) ); + c_cp->second[n]->set_neighbor(i,cit_nb); + } + else { + CGAL_triangulation_assertion(n_nb >= 0); + CGAL_triangulation_assertion(static_cast(n_nb) + <= c_cp_nb->second.size()); + CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + ->has_vertex(c_cp->second[n]->vertex((i+1)%4)) ); + CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + ->has_vertex(c_cp->second[n]->vertex((i+2)%4)) ); + CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + ->has_vertex(c_cp->second[n]->vertex((i+3)%4)) ); + c_cp->second[n]->set_neighbor(i,c_cp_nb->second[n_nb]); + } } } } // Set neighboring relations of original cells oit = off_nb.begin(); - for (typename std::list::iterator cit = original_cells.begin(); - cit != original_cells.end() ; ++cit, ++oit) { + for(typename std::list::iterator cit = original_cells.begin(); + cit != original_cells.end(); ++cit, ++oit) { CGAL_triangulation_assertion( oit != off_nb.end() ); - for (int i=0; i<4; i++) { + for(int i=0; i<4; i++) { Offset nboff = (*oit)[i]; - if (!nboff.is_null()) { - Cell_handle cit_nb = (*cit)->neighbor(i); - VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb); - CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end()); - int o_i = (3-nboff.x())%3; - int o_j = (3-nboff.y())%3; - int o_k = (3-nboff.z())%3; - int n_nb = 9*o_i+3*o_j+o_k-1; - CGAL_triangulation_assertion(n_nb >= 0); - CGAL_triangulation_assertion(static_cast(n_nb) - <= c_cp_nb->second.size()); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] - ->has_vertex((*cit)->vertex((i+1)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] - ->has_vertex((*cit)->vertex((i+2)%4)) ); - CGAL_triangulation_assertion(c_cp_nb->second[n_nb] - ->has_vertex((*cit)->vertex((i+3)%4)) ); - (*cit)->set_neighbor(i,c_cp_nb->second[n_nb]); + if(!nboff.is_null()) { + Cell_handle cit_nb = (*cit)->neighbor(i); + VCRMIT c_cp_nb = virtual_cells_reverse.find(cit_nb); + CGAL_triangulation_assertion(c_cp_nb != virtual_cells_reverse.end()); + int o_i = (3-nboff.x())%3; + int o_j = (3-nboff.y())%3; + int o_k = (3-nboff.z())%3; + int n_nb = 9*o_i+3*o_j+o_k-1; + CGAL_triangulation_assertion(n_nb >= 0); + CGAL_triangulation_assertion(static_cast(n_nb) + <= c_cp_nb->second.size()); + CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + ->has_vertex((*cit)->vertex((i+1)%4)) ); + CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + ->has_vertex((*cit)->vertex((i+2)%4)) ); + CGAL_triangulation_assertion(c_cp_nb->second[n_nb] + ->has_vertex((*cit)->vertex((i+3)%4)) ); + (*cit)->set_neighbor(i,c_cp_nb->second[n_nb]); } } } - // Set incident cells - for (Cell_iterator cit = cells_begin() ; cit != cells_end() ; ++cit) { - for (int i=0 ; i<4 ; i++) { + // Set incident cells + for(Cell_iterator cit = cells_begin(); cit != cells_end(); ++cit) { + for(int i=0; i<4; i++) { cit->vertex(i)->set_cell(cit); } } // Set offsets where necessary - for (typename std::list::iterator cit = original_cells.begin() ; - cit != original_cells.end() ; ++cit) { + for(typename std::list::iterator cit = original_cells.begin(); + cit != original_cells.end(); ++cit) { VCRMIT c_cp = virtual_cells_reverse.find(*cit); CGAL_triangulation_assertion( c_cp != virtual_cells_reverse.end()); Offset off[4]; - for (int i=0; i<4; i++) + for(int i=0; i<4; i++) off[i] = int_to_off((*cit)->offset(i)); - if (off[0].is_null() && off[1].is_null() - && off[2].is_null() && off[3].is_null()) continue; - for (int n=0; n<26; n++) { + + if(off[0].is_null() && off[1].is_null() && + off[2].is_null() && off[3].is_null()) + continue; + + for(int n=0; n<26; n++) { Offset off_cp[4]; int o_i = (n+1)/9; int o_j = ((n+1)/3)%3; int o_k = (n+1)%3; - if (o_i!=2 && o_j!=2 && o_k !=2) continue; - for (int i=0; i<4; i++) { - off_cp[i] = Offset((o_i==2)?off[i].x():0, - (o_j==2)?off[i].y():0, - (o_k==2)?off[i].z():0); - CGAL_triangulation_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1); - CGAL_triangulation_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1); - CGAL_triangulation_assertion(off_cp[i].z() == 0 || off_cp[i].z() == 1); + if(o_i!=2 && o_j!=2 && o_k !=2) + continue; + + for(int i=0; i<4; i++) { + off_cp[i] = Offset((o_i==2)?off[i].x():0, + (o_j==2)?off[i].y():0, + (o_k==2)?off[i].z():0); + CGAL_triangulation_assertion(off_cp[i].x() == 0 || off_cp[i].x() == 1); + CGAL_triangulation_assertion(off_cp[i].y() == 0 || off_cp[i].y() == 1); + CGAL_triangulation_assertion(off_cp[i].z() == 0 || off_cp[i].z() == 1); } set_offsets(c_cp->second[n],off_cp[0],off_cp[1],off_cp[2],off_cp[3]); } } // Iterate over all original cells and reset offsets. - for (typename std::list::iterator cit = original_cells.begin() ; - cit != original_cells.end() ; ++cit) { + for(typename std::list::iterator cit = original_cells.begin(); + cit != original_cells.end(); ++cit) { //This statement does not seem to have any effect set_offsets(*cit, 0,0,0,0); CGAL_triangulation_assertion((*cit)->offset(0) == 0); @@ -3493,54 +3808,18 @@ Periodic_3_triangulation_3::convert_to_27_sheeted_covering() { CGAL_triangulation_assertion((*cit)->offset(3) == 0); } - _cover = make_array(3,3,3); + _cover = CGAL::make_array(3,3,3); CGAL_triangulation_expensive_assertion(is_valid()); - // Set up too long edges data structure - int i=0; - for (Vertex_iterator vit = vertices_begin(); vit != vertices_end(); ++vit) { - too_long_edges[vit] = std::list(); - ++i; - } - too_long_edge_counter = find_too_long_edges(too_long_edges); -} - -// iterate over all edges and store the ones that are longer than -// edge_length_threshold in edges. Return the number of too long edges. -template < class GT, class TDS > -inline int -Periodic_3_triangulation_3::find_too_long_edges( - std::map >& edges) -const { - Point p1, p2; - int counter = 0; - Vertex_handle v_no,vh; - for (Edge_iterator eit = edges_begin(); - eit != edges_end() ; eit++) { - p1 = construct_point(eit->first->vertex(eit->second)->point(), - get_offset(eit->first, eit->second)); - p2 = construct_point(eit->first->vertex(eit->third)->point(), - get_offset(eit->first, eit->third)); - if (squared_distance(p1,p2) > edge_length_threshold) { - if (&*(eit->first->vertex(eit->second)) < - &*(eit->first->vertex(eit->third))) { - v_no = eit->first->vertex(eit->second); - vh = eit->first->vertex(eit->third); - } else { - v_no = eit->first->vertex(eit->third); - vh = eit->first->vertex(eit->second); - } - edges[v_no].push_back(vh); - counter++; - } - } - return counter; + update_cover_data_after_converting_to_27_sheeted_covering(); } template < class GT, class TDS > -class Periodic_3_triangulation_3::Finder { +class Periodic_3_triangulation_3::Finder +{ const Self* _t; - const Point & _p; + const Point& _p; + public: Finder(const Self* t, const Point &p) : _t(t), _p(p) {} bool operator()(const Vertex_handle v) { @@ -3555,23 +3834,24 @@ public: */ template < class GT, class TDS > inline typename Periodic_3_triangulation_3::Cell_handle -Periodic_3_triangulation_3::get_cell(const Vertex_handle* vh) const { +Periodic_3_triangulation_3::get_cell(const Vertex_handle* vh) const +{ bool contains_v[4]; std::vector cells; incident_cells(vh[3],std::back_inserter(cells)); - for ( typename std::vector::iterator it = cells.begin(); + for( typename std::vector::iterator it = cells.begin(); it != cells.end(); it++ ) { CGAL_triangulation_assertion( - (*it)->vertex(0) == vh[3] || (*it)->vertex(1) == vh[3] - ||(*it)->vertex(2) == vh[3] || (*it)->vertex(3) == vh[3]) ; - for ( int j=0 ; j<3 ; j++ ) { + (*it)->vertex(0) == vh[3] || (*it)->vertex(1) == vh[3] + ||(*it)->vertex(2) == vh[3] || (*it)->vertex(3) == vh[3]); + for( int j=0; j<3; j++ ) { contains_v[j] = false; contains_v[j] = ( (*it)->vertex(0) == vh[j] ) || ( (*it)->vertex(1) == vh[j] ) || ( (*it)->vertex(2) == vh[j] ) || ( (*it)->vertex(3) == vh[j] ); } - if (contains_v[0] && contains_v[1] && contains_v[2]) { + if(contains_v[0] && contains_v[1] && contains_v[2]) { return (*it); } } @@ -3579,7 +3859,7 @@ Periodic_3_triangulation_3::get_cell(const Vertex_handle* vh) const { return Cell_handle(); } -/*! \brief Get the offset of tester.point() such that +/*! \brief Get the offset of tester.point() such that * this point is in conflict with c w.r.t tester.get_offset(). * * Implementation: Just try all eight possibilities. @@ -3588,23 +3868,24 @@ template < class GT, class TDS > template < class Conflict_tester > inline typename Periodic_3_triangulation_3::Offset Periodic_3_triangulation_3::get_location_offset( - const Conflict_tester& tester, Cell_handle c) const { + const Conflict_tester& tester, Cell_handle c) const +{ CGAL_triangulation_precondition( number_of_vertices() != 0 ); - // CGAL_triangulation_precondition_code(Locate_type lt; int i; int j;); - // CGAL_triangulation_precondition(side_of_cell(q,o,c,lt,i,j) - // != ON_UNBOUNDED_SIDE); +// CGAL_triangulation_precondition_code(Locate_type lt; int i; int j;); +// CGAL_triangulation_precondition(side_of_cell(q,o,c,lt,i,j) +// != ON_UNBOUNDED_SIDE); int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); - if (cumm_off == 0) { + if(cumm_off == 0) { // default case: return Offset(); } else { // Main idea seems to just test all possibilities. - for (int i=0; i<8; i++) { - if (((cumm_off | (~i))&7) == 7) { - if (tester(c,int_to_off(i))) { - return int_to_off(i); + for(int i=0; i<8; i++) { + if(((cumm_off | (~i))&7) == 7) { + if(tester(c,int_to_off(i))) { + return int_to_off(i); } } } @@ -3613,6 +3894,40 @@ Periodic_3_triangulation_3::get_location_offset( return Offset(); } +template < class GT, class TDS > +template < class Conflict_tester > +inline typename Periodic_3_triangulation_3::Offset +Periodic_3_triangulation_3::get_location_offset( + const Conflict_tester& tester, Cell_handle c, bool& found) const +{ + CGAL_triangulation_precondition( number_of_vertices() != 0 ); + +// CGAL_triangulation_precondition_code(Locate_type lt; int i; int j;); +// CGAL_triangulation_precondition(side_of_cell(q,o,c,lt,i,j) +// != ON_UNBOUNDED_SIDE); + + found = false; + + int cumm_off = c->offset(0) | c->offset(1) | c->offset(2) | c->offset(3); + if(cumm_off == 0) { + // default case: + found = true; + return Offset(); + } else { + // Main idea seems to just test all possibilities. + for(int i=0; i<8; i++) { + if(((cumm_off | (~i))&7) == 7) { + if(tester(c,int_to_off(i))) { + found = true; + return int_to_off(i); + } + } + } + } + + return Offset(); +} + /** Get the offset between the origins of the internal offset coordinate * systems of two neighboring cells with respect from ch to nb. * @@ -3621,12 +3936,13 @@ Periodic_3_triangulation_3::get_location_offset( */ template < class GT, class TDS > inline typename Periodic_3_triangulation_3::Offset -Periodic_3_triangulation_3::get_neighbor_offset( - Cell_handle ch, int i, Cell_handle nb) const { +Periodic_3_triangulation_3::neighbor_offset( + Cell_handle ch, int i, Cell_handle nb) const +{ // Redundance in the signature! CGAL_triangulation_precondition(ch->neighbor(i) == nb); CGAL_triangulation_precondition(nb->neighbor(nb->index(ch)) == ch); - + Vertex_handle vertex_ch; int index_ch, index_nb; // ensure that vertex_ch \in nb and vertex_nb \in ch @@ -3647,12 +3963,12 @@ Periodic_3_triangulation_3::get_neighbor_offset( */ template < class GT, class TDS > inline void Periodic_3_triangulation_3::get_vertex( - Cell_handle ch, int i, Vertex_handle &vh, Offset &off) const { - + Cell_handle ch, int i, Vertex_handle& vh, Offset& off) const +{ off = combine_offsets(Offset(),int_to_off(ch->offset(i))); vh = ch->vertex(i); - - if (is_1_cover()) return; + + if(is_1_cover()) return; Vertex_handle vh_i = vh; get_vertex(vh_i, vh, off); return; @@ -3660,11 +3976,11 @@ inline void Periodic_3_triangulation_3::get_vertex( template < class GT, class TDS > inline void Periodic_3_triangulation_3::get_vertex( - Vertex_handle vh_i, Vertex_handle &vh, Offset &off) const { - + Vertex_handle vh_i, Vertex_handle& vh, Offset& off) const +{ Virtual_vertex_map_it it = virtual_vertices.find(vh_i); - if (it == virtual_vertices.end()) { + if(it == virtual_vertices.end()) { // if ch->vertex(i) is not contained in virtual_vertices, then it is in // the original domain. vh = vh_i; @@ -3673,18 +3989,18 @@ inline void Periodic_3_triangulation_3::get_vertex( // otherwise it has to be looked up as well as its offset. vh = it->second.first; off += it->second.second; - CGAL_triangulation_assertion(vh->point().x() < _domain.xmax()); - CGAL_triangulation_assertion(vh->point().y() < _domain.ymax()); - CGAL_triangulation_assertion(vh->point().z() < _domain.zmax()); - CGAL_triangulation_assertion(vh->point().x() >= _domain.xmin()); - CGAL_triangulation_assertion(vh->point().y() >= _domain.ymin()); - CGAL_triangulation_assertion(vh->point().z() >= _domain.zmin()); + CGAL_triangulation_assertion(vh->point().x() < domain().xmax()); + CGAL_triangulation_assertion(vh->point().y() < domain().ymax()); + CGAL_triangulation_assertion(vh->point().z() < domain().zmax()); + CGAL_triangulation_assertion(vh->point().x() >= domain().xmin()); + CGAL_triangulation_assertion(vh->point().y() >= domain().ymin()); + CGAL_triangulation_assertion(vh->point().z() >= domain().zmin()); } } template < class GT, class TDS > -std::istream & -operator>> (std::istream& is, Periodic_3_triangulation_3 &tr) +std::istream& +operator>> (std::istream& is, Periodic_3_triangulation_3& tr) // reads // the current covering that guarantees the triangulation to be a // simplicial complex @@ -3699,8 +4015,7 @@ operator>> (std::istream& is, Periodic_3_triangulation_3 &tr) { CGAL_triangulation_precondition(is.good()); - typedef Periodic_3_triangulation_3 Triangulation; - typedef typename GT::FT FT; + typedef Periodic_3_triangulation_3 Triangulation; typedef typename Triangulation::size_type size_type; typedef typename Triangulation::Vertex_handle Vertex_handle; typedef typename Triangulation::Cell_handle Cell_handle; @@ -3713,7 +4028,7 @@ operator>> (std::istream& is, Periodic_3_triangulation_3 &tr) int cx=0, cy=0, cz=0; size_type n=0; - if (is_ascii(is)) { + if(is_ascii(is)) { is >> domain; is >> cx >> cy >> cz; is >> n; @@ -3725,20 +4040,19 @@ operator>> (std::istream& is, Periodic_3_triangulation_3 &tr) read(is,cz); read(is,n); } - + CGAL_triangulation_assertion((n/(cx*cy*cz))*cx*cy*cz == n); tr.tds().set_dimension((n==0?-2:3)); - tr._domain = domain; tr._gt.set_domain(domain); - tr._cover = make_array(cx,cy,cz); + tr._cover = CGAL::make_array(cx,cy,cz); - if ( n==0 ) return is; + if( n==0 ) return is; std::vector< Vertex_handle > V(n); - if (cx==1 && cy==1 && cz==1) { - for (std::size_t i=0; i < n; i++) { + if(cx==1 && cy==1 && cz==1) { + for(std::size_t i=0; i < n; i++) { V[i] = tr.tds().create_vertex(); is >> *V[i]; } @@ -3746,12 +4060,12 @@ operator>> (std::istream& is, Periodic_3_triangulation_3 &tr) Vertex_handle v,w; std::vector vv; Offset off; - for (std::size_t i=0; i < n; i++) { + for(std::size_t i=0; i < n; i++) { v = tr.tds().create_vertex(); V[i] = v; is >> *V[i] >> off; vv.clear(); - for (int j=1; j> (std::istream& is, Periodic_3_triangulation_3 &tr) tr.virtual_vertices_reverse[v]=vv; } } - + std::vector< Cell_handle > C; std::size_t m; tr._tds.read_cells(is, V, m, C); // read offsets int off[4] = {0,0,0,0}; - for (std::size_t j=0 ; j < m; j++) { - if (is_ascii(is)) + for(std::size_t j=0; j < m; j++) { + if(is_ascii(is)) is >> off[0] >> off[1] >> off[2] >> off[3]; else { read(is,off[0]); @@ -3780,31 +4094,18 @@ operator>> (std::istream& is, Periodic_3_triangulation_3 &tr) } tr.set_offsets(C[j],off[0],off[1],off[2],off[3]); } - + // read potential other information - for (std::size_t j=0 ; j < m; j++) + for(std::size_t j=0; j < m; j++) is >> *(C[j]); - typedef typename Triangulation::Vertex_iterator VI; - - int i=0; - for (VI vi = tr.vertices_begin(); - vi != tr.vertices_end(); ++vi) { - tr.too_long_edges[vi]=std::list(); - ++i; - } - - tr.edge_length_threshold = FT(0.166) * (tr._domain.xmax()-tr._domain.xmin()) - * (tr._domain.xmax()-tr._domain.xmin()); - tr.too_long_edge_counter = tr.find_too_long_edges(tr.too_long_edges); - CGAL_triangulation_expensive_assertion( tr.is_valid() ); return is; } - + template < class GT, class TDS > -std::ostream & -operator<< (std::ostream& os,const Periodic_3_triangulation_3 &tr) +std::ostream& +operator<< (std::ostream& os,const Periodic_3_triangulation_3& tr) // writes : // the number of vertices // the domain as six coordinates: xmin ymin zmin xmax ymax zmax @@ -3834,10 +4135,10 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3 &tr) Covering_sheets cover = tr.number_of_sheets(); size_type n = tr.number_of_vertices(); - if (is_ascii(os)) + if(is_ascii(os)) os << domain << std::endl << cover[0] << " " << cover[1] << " " << cover[2] << std::endl - << n*cover[0]*cover[1]*cover[2] << std::endl; + << n*cover[0]*cover[1]*cover[2] << std::endl; else { os << domain; write(os,cover[0]); @@ -3846,27 +4147,29 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3 &tr) write(os,n*cover[0]*cover[1]*cover[2]); } - if (n == 0) + if(n == 0) return os; - + // write the vertices Unique_hash_map V; std::size_t i=0; - if (tr.is_1_cover()) { - for (Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) { + if(tr.is_1_cover()) { + for(Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) { V[it] = i++; os << it->point(); - if (is_ascii(os)) + if(is_ascii(os)) os << std::endl; } } else { Virtual_vertex_map_it vit, vvit; std::vector vv; - for (Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) { + for(Vertex_iterator it=tr.vertices_begin(); it!=tr.vertices_end(); ++it) { vit = tr.virtual_vertices.find(it); - if (vit != tr.virtual_vertices.end()) continue; + if(vit != tr.virtual_vertices.end()) + continue; + V[it]=i++; - if (is_ascii(os)) + if(is_ascii(os)) os << it->point() << std::endl << Offset(0,0,0) << std::endl; else os << it->point() << Offset(0,0,0); @@ -3874,11 +4177,11 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3 &tr) != tr.virtual_vertices_reverse.end()); vv = tr.virtual_vertices_reverse.find(it)->second; CGAL_triangulation_assertion(vv.size() == 26); - for (std::size_t j=0; jpoint() << std::endl << vvit->second.second << std::endl; else os << vv[j]->point() << vvit->second.second; @@ -3886,19 +4189,19 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3 &tr) } } CGAL_triangulation_postcondition(i==tr._cover[0]*tr._cover[1]*tr._cover[2]*n); - + // asks the tds for the combinatorial information tr.tds().print_cells(os, V); - + // write offsets - //for (unsigned int i=0 ; ioffset(j); - if ( j==3 ) + os << ch->offset(j); + if( j==3 ) os << std::endl; else os << ' '; @@ -3906,7 +4209,7 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3 &tr) else write(os,ch->offset(j)); } } - + // write the non combinatorial information on the cells // using the << operator of Cell // works because the iterator of the tds traverses the cells in the @@ -3918,103 +4221,102 @@ operator<< (std::ostream& os,const Periodic_3_triangulation_3 &tr) os << std::endl; } } - return os ; + return os; } namespace internal { - /// Internal function used by operator==. - // This function tests and registers the 4 neighbors of c1/c2, - // and performs a bfs traversal - // Returns false if an inequality has been found. - //TODO: introduce offsets - template - bool - test_next(const Periodic_3_triangulation_3 &t1, - const Periodic_3_triangulation_3 & /* needed_for_deducing_TDS2 */, - typename Periodic_3_triangulation_3::Cell_handle c1, - typename Periodic_3_triangulation_3::Cell_handle c2, - std::map::Cell_handle, - typename Periodic_3_triangulation_3::Cell_handle> &Cmap, - std::map::Vertex_handle, - typename Periodic_3_triangulation_3::Vertex_handle> &Vmap) - { - typedef Periodic_3_triangulation_3 Tr1; - typedef Periodic_3_triangulation_3 Tr2; - typedef typename Tr1::Vertex_handle Vertex_handle1; - typedef typename Tr1::Cell_handle Cell_handle1; - typedef typename Tr2::Vertex_handle Vertex_handle2; - typedef typename Tr2::Cell_handle Cell_handle2; - typedef typename std::map::const_iterator Cit; - typedef typename std::map::const_iterator Vit; +/// Internal function used by operator==. +// This function tests and registers the 4 neighbors of c1/c2, +// and performs a bfs traversal +// Returns false if an inequality has been found. +//TODO: introduce offsets +template +bool +test_next(const Periodic_3_triangulation_3& t1, + const Periodic_3_triangulation_3& t2, + typename Periodic_3_triangulation_3::Cell_handle c1, + typename Periodic_3_triangulation_3::Cell_handle c2, + std::map::Cell_handle, + typename Periodic_3_triangulation_3::Cell_handle>& Cmap, + std::map::Vertex_handle, + typename Periodic_3_triangulation_3::Vertex_handle>& Vmap) +{ + typedef Periodic_3_triangulation_3 Tr1; + typedef Periodic_3_triangulation_3 Tr2; + typedef typename Tr1::Vertex_handle Vertex_handle1; + typedef typename Tr1::Cell_handle Cell_handle1; + typedef typename Tr2::Vertex_handle Vertex_handle2; + typedef typename Tr2::Cell_handle Cell_handle2; + typedef typename std::map::const_iterator Cit; + typedef typename std::map::const_iterator Vit; - std::vector > queue; - queue.push_back(std::make_pair(c1,c2)); - - while(! queue.empty()){ - boost::tie(c1,c2) = queue.back(); - queue.pop_back(); - - // Precondition: c1, c2 have been registered as well as their 4 vertices. - CGAL_triangulation_precondition(t1.number_of_vertices() != 0); - CGAL_triangulation_precondition(Cmap[c1] == c2); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); - CGAL_triangulation_precondition(Vmap.find(c1->vertex(3)) != Vmap.end()); - + std::vector > queue; + queue.push_back(std::make_pair(c1,c2)); - for (int i=0; i <= 3; ++i) { - Cell_handle1 n1 = c1->neighbor(i); - Cit cit = Cmap.find(n1); - Vertex_handle1 v1 = c1->vertex(i); - Vertex_handle2 v2 = Vmap[v1]; - Cell_handle2 n2 = c2->neighbor(c2->index(v2)); - if (cit != Cmap.end()) { - // n1 was already registered. - if (cit->second != n2) - return false; - continue; - } - // n1 has not yet been registered. - // We check that the new vertices match geometrically. - // And we register them. - Vertex_handle1 vn1 = n1->vertex(n1->index(c1)); - Vertex_handle2 vn2 = n2->vertex(n2->index(c2)); - Vit vit = Vmap.find(vn1); - if (vit != Vmap.end()) { - // vn1 already registered - if (vit->second != vn2) - return false; - } - else { - if (t1.geom_traits().compare_xyz_3_object()(vn1->point(), - vn2->point()) != 0) - return false; - - // We register vn1/vn2. - Vmap.insert(std::make_pair(vn1, vn2)); - } - - // We register n1/n2. - Cmap.insert(std::make_pair(n1, n2)); - queue.push_back(std::make_pair(n1, n2)); + while(! queue.empty()) { + boost::tie(c1,c2) = queue.back(); + queue.pop_back(); + + // Precondition: c1, c2 have been registered as well as their 4 vertices. + CGAL_triangulation_precondition(t1.number_of_vertices() != 0); + CGAL_triangulation_precondition(Cmap[c1] == c2); + CGAL_triangulation_precondition(Vmap.find(c1->vertex(0)) != Vmap.end()); + CGAL_triangulation_precondition(Vmap.find(c1->vertex(1)) != Vmap.end()); + CGAL_triangulation_precondition(Vmap.find(c1->vertex(2)) != Vmap.end()); + CGAL_triangulation_precondition(Vmap.find(c1->vertex(3)) != Vmap.end()); + + for(int i=0; i <= 3; ++i) { + Cell_handle1 n1 = c1->neighbor(i); + Cit cit = Cmap.find(n1); + Vertex_handle1 v1 = c1->vertex(i); + Vertex_handle2 v2 = Vmap[v1]; + Cell_handle2 n2 = c2->neighbor(c2->index(v2)); + if(cit != Cmap.end()) { + // n1 was already registered. + if(cit->second != n2) + return false; + continue; } + // n1 has not yet been registered. + // We check that the new vertices match geometrically. + // And we register them. + Vertex_handle1 vn1 = n1->vertex(n1->index(c1)); + Vertex_handle2 vn2 = n2->vertex(n2->index(c2)); + Vit vit = Vmap.find(vn1); + if(vit != Vmap.end()) { + // vn1 already registered + if(vit->second != vn2) + return false; + } + else { + if(t1.geom_traits().compare_xyz_3_object()(t1.construct_point(vn1->point()), + t2.construct_point(vn2->point())) != 0) + return false; + + // We register vn1/vn2. + Vmap.insert(std::make_pair(vn1, vn2)); + } + + // We register n1/n2. + Cmap.insert(std::make_pair(n1, n2)); + queue.push_back(std::make_pair(n1, n2)); } - return true; } + return true; +} } // namespace internal template < class GT, class TDS1, class TDS2 > bool -operator==(const Periodic_3_triangulation_3 &t1, - const Periodic_3_triangulation_3 &t2) +operator==(const Periodic_3_triangulation_3& t1, + const Periodic_3_triangulation_3& t2) { typedef typename Periodic_3_triangulation_3::Vertex_handle Vertex_handle1; - typedef typename Periodic_3_triangulation_3::Cell_handle + typedef typename Periodic_3_triangulation_3::Cell_handle Cell_handle1; typedef typename Periodic_3_triangulation_3::Vertex_handle Vertex_handle2; @@ -4022,7 +4324,7 @@ operator==(const Periodic_3_triangulation_3 &t1, Vertex_iterator2; typedef typename Periodic_3_triangulation_3::Cell_handle Cell_handle2; - + typedef typename Periodic_3_triangulation_3::Point Point; typedef typename Periodic_3_triangulation_3::Offset Offset; @@ -4030,18 +4332,18 @@ operator==(const Periodic_3_triangulation_3 &t1, // ::Geometric_traits::Compare_xyz_3 Compare_xyz_3; // Compare_xyz_3 cmp1 = t1.geom_traits().compare_xyz_3_object(); // Compare_xyz_3 cmp2 = t2.geom_traits().compare_xyz_3_object(); - + // Some quick checks. - if ( t1.domain() != t2.domain() + if( t1.domain() != t2.domain() || t1.number_of_sheets() != t2.number_of_sheets()) return false; - if ( t1.number_of_vertices() != t2.number_of_vertices() + if( t1.number_of_vertices() != t2.number_of_vertices() || t1.number_of_cells() != t2.number_of_cells()) return false; // Special case for empty triangulations - if (t1.number_of_vertices() == 0) + if(t1.number_of_vertices() == 0) return true; // We will store the mapping between the 2 triangulations vertices and @@ -4052,15 +4354,15 @@ operator==(const Periodic_3_triangulation_3 &t1, // find a common point Vertex_handle1 v1 = static_cast(t1.vertices_begin()); Vertex_handle2 iv2; - for (Vertex_iterator2 vit2 = t2.vertices_begin() ; + for(Vertex_iterator2 vit2 = t2.vertices_begin(); vit2 != t2.vertices_end(); ++vit2) { - if (!t1.equal(vit2->point(), v1->point(), - t2.get_offset(vit2), t1.get_offset(v1))) + if(!t1.equal(vit2->point(), v1->point(), + t2.get_offset(vit2), t1.get_offset(v1))) continue; iv2 = static_cast(vit2); break; } - if (iv2 == Vertex_handle2()) + if(iv2 == Vertex_handle2()) return false; Vmap.insert(std::make_pair(v1, iv2)); @@ -4079,42 +4381,42 @@ operator==(const Periodic_3_triangulation_3 &t1, std::vector ics; t2.incident_cells(iv2, std::back_inserter(ics)); - for (typename std::vector::const_iterator cit = ics.begin(); - cit != ics.end(); ++cit) { + for(typename std::vector::const_iterator cit = ics.begin(); + cit != ics.end(); ++cit) { int inf = (*cit)->index(iv2); - if (t1.equal(p2, (*cit)->vertex((inf+1)%4)->point(), - o2, t2.get_offset((*cit)->vertex((inf+1)%4)))) + if(t1.equal(p2, (*cit)->vertex((inf+1)%4)->point(), + o2, t2.get_offset((*cit)->vertex((inf+1)%4)))) Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+1)%4))); - else if (t1.equal(p2, (*cit)->vertex((inf+2)%4)->point(), - o2, t2.get_offset((*cit)->vertex((inf+2)%4)))) + else if(t1.equal(p2, (*cit)->vertex((inf+2)%4)->point(), + o2, t2.get_offset((*cit)->vertex((inf+2)%4)))) Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+2)%4))); - else if (t1.equal(p2, (*cit)->vertex((inf+3)%4)->point(), - o2, t2.get_offset((*cit)->vertex((inf+3)%4)))) + else if(t1.equal(p2, (*cit)->vertex((inf+3)%4)->point(), + o2, t2.get_offset((*cit)->vertex((inf+3)%4)))) Vmap.insert(std::make_pair(v2, (*cit)->vertex((inf+3)%4))); else continue; // None matched v2. - if (t1.equal(p3, (*cit)->vertex((inf+1)%4)->point(), - o3, t2.get_offset((*cit)->vertex((inf+1)%4)))) + if(t1.equal(p3, (*cit)->vertex((inf+1)%4)->point(), + o3, t2.get_offset((*cit)->vertex((inf+1)%4)))) Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+1)%4))); - else if (t1.equal(p3, (*cit)->vertex((inf+2)%4)->point(), - o3, t2.get_offset((*cit)->vertex((inf+2)%4)))) + else if(t1.equal(p3, (*cit)->vertex((inf+2)%4)->point(), + o3, t2.get_offset((*cit)->vertex((inf+2)%4)))) Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+2)%4))); - else if (t1.equal(p3, (*cit)->vertex((inf+3)%4)->point(), - o3, t2.get_offset((*cit)->vertex((inf+3)%4)))) + else if(t1.equal(p3, (*cit)->vertex((inf+3)%4)->point(), + o3, t2.get_offset((*cit)->vertex((inf+3)%4)))) Vmap.insert(std::make_pair(v3, (*cit)->vertex((inf+3)%4))); else continue; // None matched v3. - if (t1.equal(p4, (*cit)->vertex((inf+1)%4)->point(), - o4, t2.get_offset((*cit)->vertex((inf+1)%4)))) + if(t1.equal(p4, (*cit)->vertex((inf+1)%4)->point(), + o4, t2.get_offset((*cit)->vertex((inf+1)%4)))) Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+1)%4))); - else if (t1.equal(p4, (*cit)->vertex((inf+2)%4)->point(), - o4, t2.get_offset((*cit)->vertex((inf+2)%4)))) + else if(t1.equal(p4, (*cit)->vertex((inf+2)%4)->point(), + o4, t2.get_offset((*cit)->vertex((inf+2)%4)))) Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+2)%4))); - else if (t1.equal(p4, (*cit)->vertex((inf+3)%4)->point(), - o4, t2.get_offset((*cit)->vertex((inf+3)%4)))) + else if(t1.equal(p4, (*cit)->vertex((inf+3)%4)->point(), + o4, t2.get_offset((*cit)->vertex((inf+3)%4)))) Vmap.insert(std::make_pair(v4,(*cit)->vertex((inf+3)%4))); else continue; // None matched v4. @@ -4124,7 +4426,7 @@ operator==(const Periodic_3_triangulation_3 &t1, break; } - if (Cmap.size() == 0) + if(Cmap.size() == 0) return false; // We now have one cell, we need to compare in a bfs graph traversal @@ -4134,12 +4436,12 @@ operator==(const Periodic_3_triangulation_3 &t1, template < class GT, class TDS1, class TDS2 > inline bool -operator!=(const Periodic_3_triangulation_3 &t1, - const Periodic_3_triangulation_3 &t2) +operator!=(const Periodic_3_triangulation_3& t1, + const Periodic_3_triangulation_3& t2) { return ! (t1 == t2); } -} //namespace CGAL +} // namespace CGAL #endif // CGAL_PERIODIC_3_TRIANGULATION_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h index e368245fb9c..6e249a8588e 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_cell_base_3.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Monique Teillaud // Sylvain Pion @@ -28,7 +28,6 @@ #include - #include #include #include @@ -70,7 +69,7 @@ public: const Vertex_handle& v0, const Vertex_handle& v1, const Vertex_handle& v2, const Vertex_handle& v3, const Cell_handle& n0, const Cell_handle& n1, - const Cell_handle& n2, const Cell_handle& n3) + const Cell_handle& n2, const Cell_handle& n3) #ifndef CGAL_CFG_NO_CPP0X_UNIFIED_INITIALIZATION_SYNTAX : N{n0, n1, n2, n3}, V{v0, v1, v2, v3}, @@ -87,6 +86,7 @@ public: const Vertex_handle& vertex(int i) const { CGAL_triangulation_precondition( i >= 0 && i <= 3 ); + CGAL_assume( i >= 0 && i <= 3 ); return V[i]; } @@ -223,7 +223,7 @@ public: off = ((off&511 ) | ((_off3)<<9)); } } - + // CHECKING // the following trivial is_valid allows @@ -241,7 +241,7 @@ public: TDS_data& tds_data() { return _tds_data; } const TDS_data& tds_data() const { return _tds_data; } - // TODO: Get rid of this flag! Used in convert_to_1_cover. + // TODO: Get rid of this flag! Used in convert_to_1_sheeted_covering. // Either use the conflict flag or a std::map. void set_additional_flag(unsigned char f) { CGAL_triangulation_assertion(f < 4); @@ -250,7 +250,7 @@ public: unsigned char get_additional_flag() const { return _additional_flag; } - + private: Cell_handle N[4]; Vertex_handle V[4]; diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h index 33ee1d11482..8e54a191123 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_ds_vertex_base_3.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Monique Teillaud // Manuel Caroli @@ -24,7 +24,6 @@ #include - #include #include #include @@ -47,7 +46,7 @@ public: Periodic_3_triangulation_ds_vertex_base_3() : _c(), _off(), offset_flag(false) {} - + Periodic_3_triangulation_ds_vertex_base_3(const Cell_handle& c) : _c(c), _off(), offset_flag(false) {} @@ -59,7 +58,7 @@ public: const Offset& offset() const { return _off; } - + void set_offset(const Offset& off) { _off = off; offset_flag=true; } @@ -71,10 +70,10 @@ public: bool get_offset_flag() const { return offset_flag; } // the following trivial is_valid allows - // the user of derived cell base classes + // the user of derived cell base classes // to add their own purpose checking bool is_valid(bool = false, int = 0) const - { + { return cell() != Cell_handle(); } @@ -87,8 +86,14 @@ public: private: Cell_handle _c; Offset _off; - int _index; bool offset_flag; + +// The typedef and the bool are used by Triangulation_data_structure::Vertex_extractor +// The names are choosen complicated so that we do not have to document them +// (privacy by obfuscation) +public: + typedef bool Has_visited_for_vertex_extractor; + bool visited_for_vertex_extractor; }; template < class TDS > diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h index f3080bad63b..5dd24e96a7f 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_hierarchy_3.h @@ -24,7 +24,6 @@ #include - #include #include #include @@ -33,6 +32,11 @@ #include #include +#include +#include +#include +#include + namespace CGAL { template < class PTr > @@ -82,16 +86,16 @@ public: template < typename InputIterator > Periodic_3_triangulation_hierarchy_3(InputIterator first, InputIterator last, - const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1), - const Geom_traits& traits = Geom_traits()) + const Iso_cuboid& domain = Iso_cuboid(0,0,0,1,1,1), + const Geom_traits& traits = Geom_traits()) : PTr_Base(domain,traits), level_mult_cover(0) { - hierarchy[0] = this; - for(int i=1; i std::ptrdiff_t insert(InputIterator first, InputIterator last, bool = false) @@ -127,27 +131,26 @@ public: // would give us. Cell_handle hints[maxlevel]; for (typename std::vector::const_iterator p = points.begin(), - end = points.end(); p != end; ++p) { + end = points.end(); p != end; ++p) { int vertex_level = random_level(); - + Vertex_handle v = hierarchy[0]->insert (*p, hints[0]); hints[0] = v->cell(); - - Vertex_handle prev = v; - - for (int level = 1; level <= vertex_level; ++level) { - v = hierarchy[level]->insert (*p, hints[level]); - hints[level] = v->cell(); - - v->set_down (prev); - if (hierarchy[level]->number_of_sheets()[0] != 1) { - std::vector vtc - = hierarchy[level]->periodic_copies(v); - for (unsigned int i=0 ; iset_down(prev); - } - prev->set_up (v); - prev = v; + Vertex_handle prev = v; + + for (int level = 1; level <= vertex_level; ++level) { + v = hierarchy[level]->insert (*p, hints[level]); + hints[level] = v->cell(); + + v->set_down (prev); + if (hierarchy[level]->number_of_sheets()[0] != 1) { + std::vector vtc = hierarchy[level]->periodic_copies(v); + for (unsigned int i=0 ; iset_down(prev); + } + + prev->set_up (v); + prev = v; } } return number_of_vertices() - n; @@ -165,11 +168,13 @@ public: return n-number_of_vertices(); } + // @todo should be deprecated and a function move() should be introduced + // see what is done in /Triangulation_3 Vertex_handle move_point(Vertex_handle v, const Point & p); //LOCATE Cell_handle locate(const Point& p, Locate_type& lt, int& li, int& lj, - Cell_handle start = Cell_handle ()) const; + Cell_handle start = Cell_handle ()) const; Cell_handle locate(const Point& p, Cell_handle start = Cell_handle ()) const; Vertex_handle @@ -178,13 +183,13 @@ public: private: struct locs { - Cell_handle pos; - int li, lj; - Locate_type lt; + Cell_handle pos; + int li, lj; + Locate_type lt; }; void locate(const Point& p, Locate_type& lt, int& li, int& lj, - locs pos[maxlevel], Cell_handle start = Cell_handle ()) const; + locs pos[maxlevel], Cell_handle start = Cell_handle ()) const; int random_level(); // added to make the test program of usual triangulations work @@ -199,8 +204,8 @@ Periodic_3_triangulation_hierarchy_3:: Periodic_3_triangulation_hierarchy_3( const Iso_cuboid& domain, const Geom_traits& traits) : PTr_Base(domain, traits), level_mult_cover(0) -{ - hierarchy[0] = this; +{ + hierarchy[0] = this; for(int i=1;i:: Periodic_3_triangulation_hierarchy_3( const Periodic_3_triangulation_hierarchy_3 &tr) : PTr_Base(tr), level_mult_cover(tr.level_mult_cover) -{ +{ hierarchy[0] = this; for(int i=1; i V; - for( Vertex_iterator it=hierarchy[0]->vertices_begin(); + for( Vertex_iterator it=hierarchy[0]->vertices_begin(); it != hierarchy[0]->vertices_end(); ++it) { if (hierarchy[0]->is_virtual(it)) continue; if (it->up() != Vertex_handle()) @@ -230,15 +235,15 @@ Periodic_3_triangulation_hierarchy_3( for(int j=1; jvertices_begin(); - it != hierarchy[j]->vertices_end(); ++it) { + it != hierarchy[j]->vertices_end(); ++it) { if (hierarchy[j]->is_virtual(it)) { - // down pointer goes in original instead in copied triangulation - it->set_down(V[it->down()]); - // make reverse link - it->down()->set_up( it ); - // make map for next level - if (it->up() != Vertex_handle()) - V[ it->up()->down() ] = it; + // down pointer goes in original instead in copied triangulation + it->set_down(V[it->down()]); + // make reverse link + it->down()->set_up( it ); + // make map for next level + if (it->up() != Vertex_handle()) + V[ it->up()->down() ] = it; } } } @@ -246,16 +251,16 @@ Periodic_3_triangulation_hierarchy_3( template void -Periodic_3_triangulation_hierarchy_3:: +Periodic_3_triangulation_hierarchy_3:: swap(Periodic_3_triangulation_hierarchy_3 &tr) { PTr_Base::swap(tr); for(int i=1; i -Periodic_3_triangulation_hierarchy_3:: +Periodic_3_triangulation_hierarchy_3:: ~Periodic_3_triangulation_hierarchy_3() { clear(); @@ -265,48 +270,48 @@ Periodic_3_triangulation_hierarchy_3:: template void -Periodic_3_triangulation_hierarchy_3:: +Periodic_3_triangulation_hierarchy_3:: clear() { - for(int i=0;iclear(); + for(int i=0;iclear(); } template bool -Periodic_3_triangulation_hierarchy_3:: +Periodic_3_triangulation_hierarchy_3:: is_valid(bool verbose, int level) const { bool result = true; - + // verify correctness of triangulation at all levels for(int i=0; iis_valid(verbose, level); + result = result && hierarchy[i]->is_valid(verbose, level); // verify that lower level has no down pointers - for( Vertex_iterator it = hierarchy[0]->vertices_begin(); - it != hierarchy[0]->vertices_end(); ++it) + for( Vertex_iterator it = hierarchy[0]->vertices_begin(); + it != hierarchy[0]->vertices_end(); ++it) if (!hierarchy[0]->is_virtual(it)) result = result && (it->down() == Vertex_handle()); // verify that other levels has down pointer and reciprocal link is fine for(int j=1; jvertices_begin(); - it != hierarchy[j]->vertices_end(); ++it) + for( Vertex_iterator it = hierarchy[j]->vertices_begin(); + it != hierarchy[j]->vertices_end(); ++it) if (!hierarchy[j]->is_virtual(it)) - result = result && &*(it) == &*(it->down()->up()); + result = result && &*(it) == &*(it->down()->up()); // verify that other levels has down pointer and reciprocal link is fine for(int k=0; kvertices_begin(); - it != hierarchy[k]->vertices_end(); ++it) + for( Vertex_iterator it = hierarchy[k]->vertices_begin(); + it != hierarchy[k]->vertices_end(); ++it) if (!hierarchy[k]->is_virtual(it)) - result = result && ( it->up() == Vertex_handle() || - &*it == &*(it->up())->down() ); + result = result && ( it->up() == Vertex_handle() || + &*it == &*(it->up())->down() ); return result; } - + template typename Periodic_3_triangulation_hierarchy_3::Vertex_handle Periodic_3_triangulation_hierarchy_3:: @@ -320,27 +325,26 @@ insert(const Point &p, Cell_handle start) locate(p, lt, i, j, positions, start); // insert at level 0 Vertex_handle vertex = hierarchy[0]->insert(p, - positions[0].lt, - positions[0].pos, - positions[0].li, - positions[0].lj); + positions[0].lt, + positions[0].pos, + positions[0].li, + positions[0].lj); Vertex_handle previous = vertex; Vertex_handle first = vertex; int level = 1; while (level <= vertex_level ){ - if (positions[level].pos == Cell_handle()) - vertex = hierarchy[level]->insert(p); - else - vertex = hierarchy[level]->insert(p, - positions[level].lt, - positions[level].pos, - positions[level].li, - positions[level].lj); + if (positions[level].pos == Cell_handle()) + vertex = hierarchy[level]->insert(p); + else + vertex = hierarchy[level]->insert(p, + positions[level].lt, + positions[level].pos, + positions[level].li, + positions[level].lj); vertex->set_down(previous);// link with level above if (hierarchy[level]->number_of_sheets()[0] != 1) { - std::vector vtc - = hierarchy[level]->periodic_copies(vertex); + std::vector vtc = hierarchy[level]->periodic_copies(vertex); for (unsigned int i=0 ; iset_down(previous); } previous->set_up(vertex); @@ -367,22 +371,22 @@ insert(const Point &p, Locate_type lt, Cell_handle loc, int li, int lj) // locate using hierarchy locs positions[maxlevel]; locate(p, lt, i, j, positions, loc); - + int level = 1; while (level <= vertex_level ){ if (positions[level].pos == Cell_handle()) - vertex = hierarchy[level]->insert(p); + vertex = hierarchy[level]->insert(p); else - vertex = hierarchy[level]->insert(p, - positions[level].lt, - positions[level].pos, - positions[level].li, - positions[level].lj); + vertex = hierarchy[level]->insert(p, + positions[level].lt, + positions[level].pos, + positions[level].li, + positions[level].lj); vertex->set_down(previous);// link with level above if (hierarchy[level]->number_of_sheets()[0] != 1) { - std::vector vtc - = hierarchy[level]->periodic_copies(vertex); - for (unsigned int i=0 ; iset_down(previous); + std::vector vtc + = hierarchy[level]->periodic_copies(vertex); + for (unsigned int i=0 ; iset_down(previous); } previous->set_up(vertex); previous=vertex; @@ -403,7 +407,7 @@ remove(Vertex_handle v) Vertex_handle u = v->up(); hierarchy[l]->remove(v); if (u == Vertex_handle()) - break; + break; v = u; } } @@ -421,25 +425,25 @@ move_point(Vertex_handle v, const Point & p) CGAL_triangulation_assertion(hierarchy[l]->is_valid()); Vertex_handle w = hierarchy[l]->move_point(v, p); if (l == 0) { - ret = w; + ret = w; } else { - old->set_up(w); - w->set_down(old); - if (hierarchy[l]->number_of_sheets()[0] != 1) { - std::vector vtc = hierarchy[l]->periodic_copies(w); - for (unsigned int i=0 ; iset_down(old); - } + old->set_up(w); + w->set_down(old); + if (hierarchy[l]->number_of_sheets()[0] != 1) { + std::vector vtc = hierarchy[l]->periodic_copies(w); + for (unsigned int i=0 ; iset_down(old); + } } if (u == Vertex_handle()) - break; + break; old = w; v = u; } return ret; } - + template inline typename Periodic_3_triangulation_hierarchy_3::Cell_handle @@ -454,7 +458,7 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj, Cell_handle start) con template inline -typename Periodic_3_triangulation_hierarchy_3::Cell_handle +typename Periodic_3_triangulation_hierarchy_3::Cell_handle Periodic_3_triangulation_hierarchy_3:: locate(const Point& p, Cell_handle start) const { @@ -475,24 +479,24 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj, // find the highest level with enough vertices while (hierarchy[--level]->number_of_vertices() < (size_type) minsize) { if ( ! level) - break; // do not go below 0 + break; // do not go below 0 } for (int i=level+1; i 0) { // locate at that level from "position" // result is stored in "position" for the next level pos[level].pos = position = hierarchy[level]->locate(p, - pos[level].lt, - pos[level].li, - pos[level].lj, - position); + pos[level].lt, + pos[level].li, + pos[level].lj, + position); // find the nearest vertex. Vertex_handle nearest = - hierarchy[level]->nearest_vertex_in_cell(position,p); + hierarchy[level]->nearest_vertex_in_cell(position,p); // go at the same vertex on level below nearest = nearest->down(); @@ -507,12 +511,12 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj, } template -typename Periodic_3_triangulation_hierarchy_3::Vertex_handle +typename Periodic_3_triangulation_hierarchy_3::Vertex_handle Periodic_3_triangulation_hierarchy_3:: nearest_vertex(const Point& p, Cell_handle start) const { - return PTr_Base::nearest_vertex(p, start != Cell_handle() ? start - : locate(p)); + return PTr_Base::nearest_vertex(p, start != Cell_handle() ? start + : locate(p)); } template @@ -521,13 +525,13 @@ Periodic_3_triangulation_hierarchy_3:: random_level() { if ( level_mult_cover < maxlevel - && hierarchy[level_mult_cover]->number_of_sheets() == make_array(1,1,1) ) + && hierarchy[level_mult_cover]->number_of_sheets() == make_array(1,1,1) ) ++level_mult_cover; - boost::geometric_distribution<> proba(1.0/ratio); - boost::variate_generator > - die(random, proba); - return (std::min)(die()-1, level_mult_cover); + boost::geometric_distribution<> proba(1.0/ratio); + boost::variate_generator > + die(random, proba); + return (std::min)(die()-1, level_mult_cover); } } //namespace CGAL diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h index cf2a342faa6..2869f7e466e 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_traits_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 INRIA Sophia-Antipolis (France). +// Copyright (c) 2006-2009,2017 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Nico Kruithof // Manuel Caroli @@ -24,24 +20,26 @@ #include +#include +#include +#include #include -#include -#include -#include -#include #include +#include -namespace CGAL { +namespace CGAL { -template < class Kernel, class Off = typename CGAL::Periodic_3_offset_3 > +template < class K, class Off = typename CGAL::Periodic_3_offset_3 > class Periodic_3_triangulation_traits_base_3 - : public Kernel + : public K { + typedef Periodic_3_triangulation_traits_base_3 Self; + typedef K Base; + public: - typedef Kernel K; - typedef Off Offset; - typedef Periodic_3_triangulation_traits_base_3< K, Offset > Self; + typedef K Kernel; + typedef Off Offset; typedef typename K::RT RT; typedef typename K::FT FT; @@ -53,69 +51,77 @@ public: // The next typedef is there for backward compatibility // Some users take their point type from the traits class. // Before this type was Point - typedef Point_3 Point; + typedef Point_3 Point; typedef typename K::Segment_3 Segment_3; typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; - // Triangulation predicates - typedef Traits_with_offsets_adaptor - Compare_xyz_3; - typedef Traits_with_offsets_adaptor - Orientation_3; - - // Triangulation constructions - typedef Periodic_3_construct_point_3 - Construct_point_3; - typedef Traits_with_offsets_adaptor - Construct_segment_3; - typedef Traits_with_offsets_adaptor - Construct_triangle_3; - typedef Traits_with_offsets_adaptor - Construct_tetrahedron_3; +public: + Periodic_3_triangulation_traits_base_3(const Iso_cuboid_3& domain, + const K& k) + : Base(k) + { + set_domain(domain); + } - // Access - void set_domain(const Iso_cuboid_3& domain) { + // will be overwritten by filtered classes to create exact and approximate + // versions of the domain + virtual void set_domain(const Iso_cuboid_3& domain) { _domain = domain; } - - Iso_cuboid_3 get_domain() const { + + // Access + const Iso_cuboid_3& get_domain() const { return _domain; } + // Construct_point_3 with offset + typedef Periodic_3_construct_point_3 + Construct_point_3; + + // Triangulation predicates + typedef Functor_with_offset_points_adaptor + Compare_xyz_3; + typedef Functor_with_offset_points_adaptor + Orientation_3; + + // Triangulation constructions + typedef Functor_with_offset_points_adaptor + Construct_segment_3; + typedef Functor_with_offset_points_adaptor + Construct_triangle_3; + typedef Functor_with_offset_points_adaptor + Construct_tetrahedron_3; + // Operations - Compare_xyz_3 - compare_xyz_3_object() const { - return Compare_xyz_3(&_domain); + Construct_point_3 construct_point_3_object() const { + return Construct_point_3(&_domain, this->K::construct_point_3_object()); } - Orientation_3 - orientation_3_object() const { - return Orientation_3(&_domain); + + Compare_xyz_3 compare_xyz_3_object() const { + return Compare_xyz_3(this->K::compare_xyz_3_object(), construct_point_3_object()); } - Construct_point_3 - construct_point_3_object() const { - return Construct_point_3(_domain); + Orientation_3 orientation_3_object() const { + return Orientation_3(this->K::orientation_3_object(), construct_point_3_object()); } - Construct_segment_3 - construct_segment_3_object() const { - return Construct_segment_3(&_domain); + Construct_segment_3 construct_segment_3_object() const { + return Construct_segment_3(this->K::construct_segment_3_object(), construct_point_3_object()); } - Construct_triangle_3 - construct_triangle_3_object() const { - return Construct_triangle_3(&_domain); + Construct_triangle_3 construct_triangle_3_object() const { + return Construct_triangle_3(this->K::construct_triangle_3_object(), construct_point_3_object()); } - Construct_tetrahedron_3 - construct_tetrahedron_3_object() const { - return Construct_tetrahedron_3(&_domain); + Construct_tetrahedron_3 construct_tetrahedron_3_object() const { + return Construct_tetrahedron_3(this->K::construct_tetrahedron_3_object(), construct_point_3_object()); } protected: Iso_cuboid_3 _domain; }; - -template < typename K, typename Off = CGAL::Periodic_3_offset_3, bool Has_filtered_predicates = internal::Has_filtered_predicates::value > +template < typename K, + typename Off = CGAL::Periodic_3_offset_3, + bool Has_filtered_predicates = internal::Has_filtered_predicates::value > class Periodic_3_triangulation_traits_3; } //namespace CGAL @@ -123,33 +129,39 @@ class Periodic_3_triangulation_traits_3; #include namespace CGAL { -// This declaration is needed to break the cyclic dependency. -template < typename K, typename Off, bool Has_static_filters > -class Periodic_3_triangulation_filtered_traits_3; -template < class K, class Off, bool Has_filtered_predicates > -class Periodic_3_triangulation_traits_3 +template < class K, class Off > +class Periodic_3_triangulation_traits_3 : public Periodic_3_triangulation_traits_base_3 { + typedef Periodic_3_triangulation_traits_base_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1), + const K& k = K()) + : Base(domain, k) + { } }; -template < typename K, typename Off > -class Periodic_3_triangulation_traits_3 < K, Off, true> - : public Periodic_3_triangulation_filtered_traits_3 < K, Off, internal::Has_static_filters::value > +template < class K, class Off > +class Periodic_3_triangulation_traits_3 + : public Periodic_3_triangulation_filtered_traits_3< + K, Off, internal::Has_static_filters::value> { + typedef Periodic_3_triangulation_filtered_traits_3< + K, Off, internal::Has_static_filters::value> Base; + public: - typedef K Kernel; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_triangulation_traits_3(const Iso_cuboid_3& domain = Iso_cuboid_3(0,0,0,1,1,1), + const K& k = K()) + : Base(domain, k) + { } }; } //namespace CGAL -#include - - -namespace CGAL -{ -template < typename K, typename Off, bool Has_filtered_predicates > -class Periodic_3_Delaunay_triangulation_traits_3; -} - #endif // CGAL_PERIODIC_3_TRIANGULATION_TRAITS_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/Traits_with_offsets_adaptor.h b/Periodic_3_triangulation_3/include/CGAL/Traits_with_offsets_adaptor.h deleted file mode 100644 index 72a534cef20..00000000000 --- a/Periodic_3_triangulation_3/include/CGAL/Traits_with_offsets_adaptor.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 1999-2004,2006-2009,2014-2015 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// You can redistribute it and/or modify it under the terms of the GNU -// General Public License as published by the Free Software Foundation, -// either version 3 of the License, or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Monique Teillaud -// Sylvain Pion -// Andreas Fabri -// Nico Kruithof -// Manuel Caroli -// Aymeric Pellé -#ifndef CGAL_TRAITS_WITH_OFFSETS_ADAPTOR_H -#define CGAL_TRAITS_WITH_OFFSETS_ADAPTOR_H - -#include - - -namespace CGAL { - -template < class K, class Functor_ > - class Traits_with_offsets_adaptor { - typedef K Kernel; - typedef Functor_ Functor; - - typedef typename Kernel::Point_3 Point; - typedef typename Kernel::Offset Offset; - -public: - typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3; - typedef typename Kernel::Construct_point_3 Construct_point_3; - typedef typename Functor::result_type result_type; - - Traits_with_offsets_adaptor(const Iso_cuboid_3 * dom) : _domain(dom) { } - - result_type operator()(const Point& p0, const Point& p1, - const Offset& o0, const Offset& o1) const { - return Functor()(pp(p0,o0),pp(p1,o1)); - } - result_type operator()(const Point& p0, const Point& p1, const Point& p2, - const Offset& o0, const Offset& o1, const Offset& o2) const { - return Functor()(pp(p0,o0),pp(p1,o1),pp(p2,o2)); - } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, - const Offset& o0, const Offset& o1, - const Offset& o2, const Offset& o3) const { - return Functor()(pp(p0,o0),pp(p1,o1),pp(p2,o2),pp(p3,o3)); - } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, const Point& p4, - const Offset& o0, const Offset& o1, const Offset& o2, - const Offset& o3, const Offset& o4) const { - return Functor()(pp(p0,o0),pp(p1,o1),pp(p2,o2), - pp(p3,o3),pp(p4,o4)); - } - - result_type operator()(const Point& p0, const Point& p1) const { - return Functor()(p0, p1); - } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2) const { - return Functor()(p0, p1, p2); - } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3) const { - return Functor()(p0, p1, p2, p3); - } - result_type operator()(const Point& p0, const Point& p1, - const Point& p2, const Point& p3, const Point& p4) const { - return Functor()(p0, p1, p2, p3, p4); - } - -protected: - Point pp(const Point &p, const Offset &o) const { - return Construct_point_3(*_domain)(p,o); - } - public: - const Iso_cuboid_3* _domain; -}; -} // namespace CGAL - -#endif /* CGAL_TRAITS_WITH_OFFSETS_ADAPTOR_H */ diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Functor_with_offset_points_adaptor.h b/Periodic_3_triangulation_3/include/CGAL/internal/Functor_with_offset_points_adaptor.h new file mode 100644 index 00000000000..8a421a9dd31 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Functor_with_offset_points_adaptor.h @@ -0,0 +1,78 @@ +// Copyright (c) 1999-2004,2006-2009,2014-2015 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Author(s) : Monique Teillaud +// Sylvain Pion +// Andreas Fabri +// Nico Kruithof +// Manuel Caroli +// Aymeric Pellé +// Mael Rouxel-Labbé +#ifndef CGAL_FUNCTOR_WITH_OFFSET_POINTS_ADAPTOR_H +#define CGAL_FUNCTOR_WITH_OFFSET_POINTS_ADAPTOR_H + +#include + +namespace CGAL { + +template < class K_, class Functor_ > +class Functor_with_offset_points_adaptor + : public Functor_ +{ + typedef K_ Kernel; + typedef Functor_ Functor; + + typedef typename Kernel::Point_3 Point; + typedef typename Kernel::Offset Offset; + + typedef typename Kernel::Construct_point_3 Construct_point_3; + +public: + typedef typename Functor::result_type result_type; + + Functor_with_offset_points_adaptor(const Functor& functor, + const Construct_point_3& cp) + : Functor_(functor), cp(cp) + { } + + // gives access to function calls without offset + using Functor::operator(); + + result_type operator()(const Point& p0, const Point& p1, + const Offset& o0, const Offset& o1) const { + return operator()(cp(p0,o0), cp(p1,o1)); + } + result_type operator()(const Point& p0, const Point& p1, const Point& p2, + const Offset& o0, const Offset& o1, const Offset& o2) const { + return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2)); + } + result_type operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3) const { + return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3)); + } + result_type operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, const Point& p4, + const Offset& o0, const Offset& o1, const Offset& o2, + const Offset& o3, const Offset& o4) const { + return operator()(cp(p0,o0), cp(p1,o1), cp(p2,o2), cp(p3,o3), cp(p4,o4)); + } + + const Construct_point_3 cp; +}; + +} // namespace CGAL + +#endif /* CGAL_FUNCTOR_WITH_OFFSET_POINTS_ADAPTOR_H */ diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Functor_with_offset_weighted_points_adaptor.h b/Periodic_3_triangulation_3/include/CGAL/internal/Functor_with_offset_weighted_points_adaptor.h new file mode 100644 index 00000000000..ae3cd8051c2 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Functor_with_offset_weighted_points_adaptor.h @@ -0,0 +1,142 @@ +// Copyright (c) 1999-2004,2006-2009,2014-2015,2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Monique Teillaud +// Sylvain Pion +// Andreas Fabri +// Nico Kruithof +// Manuel Caroli +// Aymeric Pellé +// Mael Rouxel-Labbé +#ifndef CGAL_FUNCTOR_WITH_OFFSET_WEIGHTED_POINTS_ADAPTOR_H +#define CGAL_FUNCTOR_WITH_OFFSET_WEIGHTED_POINTS_ADAPTOR_H + +#include + +#include + +namespace CGAL { + +template < class K_, class Functor_ > +class Functor_with_offset_weighted_points_adaptor + : public Functor_with_offset_points_adaptor +{ + typedef Functor_with_offset_points_adaptor Base; + + typedef K_ Kernel; + typedef Functor_ Functor; + + typedef typename Kernel::FT FT; + typedef typename Kernel::Point_3 Point_3; + typedef typename Kernel::Weighted_point_3 Weighted_point_3; + typedef typename Kernel::Offset Offset; + + typedef typename Kernel::Construct_point_3 Construct_point_3; + typedef typename Kernel::Construct_weighted_point_3 Construct_weighted_point_3; + +public: + typedef typename Functor::result_type result_type; + + Functor_with_offset_weighted_points_adaptor(const Functor_& functor, + const Construct_point_3& cp, + const Construct_weighted_point_3& wp) + : Base(functor, cp), wp(wp) + { } + + // gives access to calls with Point_3 arguments and without offset + using Base::operator(); + + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Offset& o0, const Offset& o1) const { + return operator()(wp(p0, o0), wp(p1, o1)); + } + + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, + const Offset& o0, const Offset& o1, + const Offset& o2) const { + return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2)); + } + + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3) const { + return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3)); + } + + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Weighted_point_3& p4, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3, + const Offset& o4) const { + return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), wp(p4, o4)); + } + + // for `Compare_power_distance_3` + result_type operator() (const Point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, + const Offset& o0, const Offset& o1, + const Offset& o2) const { + return operator()(this->cp(p0, o0), wp(p1, o1), wp(p2, o2)); + } + + // for `Compare_weighted_squared_radius_3` + result_type operator() (const Weighted_point_3& p0, const Offset& o0, + const FT w) const { + return operator()(wp(p0, o0), w); + } + + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Offset& o0, const Offset& o1, + const FT w) const { + return operator()(wp(p0, o0), wp(p1, o1), w); + } + + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, + const Offset& o0, const Offset& o1, + const Offset& o2, + const FT w) const { + return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), w); + } + + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3, + const FT w) const { + return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), w); + } + + // for robust circumcenter_3 + result_type operator()(const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Offset& o0, const Offset& o1, + const Offset& o2, const Offset& o3, + bool b) const { + return operator()(wp(p0, o0), wp(p1, o1), wp(p2, o2), wp(p3, o3), b); + } + + const Construct_weighted_point_3 wp; +}; + +} // namespace CGAL + +#endif /* CGAL_FUNCTOR_WITH_OFFSET_WEIGHTED_POINTS_ADAPTOR_H */ diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h index 1917ef4b3c2..5a1fffafa0e 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_filtered_traits_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004,2006-2009 INRIA Sophia-Antipolis (France). +// Copyright (c) 2004,2006-2009, 2017 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -14,31 +14,30 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Sylvain Pion // Nico Kruithof // Manuel Caroli - #ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H #define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_FILTERED_TRAITS_3_H #include - -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include + namespace CGAL { -// The argument is supposed to be a Filtered_kernel like kernel. +// The first template item is supposed to be a Filtered_kernel-like kernel. template < typename K, typename Off > class Periodic_3_Delaunay_triangulation_filtered_traits_base_3 : public Periodic_3_Delaunay_triangulation_traits_base_3 @@ -47,122 +46,160 @@ class Periodic_3_Delaunay_triangulation_filtered_traits_base_3 // Exact traits is based on the exact kernel. typedef Periodic_3_Delaunay_triangulation_traits_3 - Exact_traits; + Off> Exact_traits; // Filtering traits is based on the filtering kernel. typedef Periodic_3_Delaunay_triangulation_traits_3 - Filtering_traits; + Off> Filtering_traits; private: typedef typename K::C2E C2E; typedef typename K::C2F C2F; - typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3; - typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3; - -public: typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - void set_domain(const Iso_cuboid_3& domain) { - C2E c2e; - C2F c2f; - this->_domain = domain; - this->_domain_e = c2e(this->_domain); - this->_domain_f = c2f(this->_domain); +public: + Periodic_3_Delaunay_triangulation_filtered_traits_base_3(const Iso_cuboid_3& domain, + const K& k) + : + Base(domain, k), + Delaunay_traits_e(C2E()(domain)), + Delaunay_traits_f(C2F()(domain)) + { + // Problem 1: above is a default initialization of the kernel in the traits. + // Hence, if the kernel has members and we use filtered traits, then + // the members will be default constructed here... + + // Problem 2: we have built filtered traits in P3Tfiltered_traits_3 and now + // we also need those two... } - typedef Filtered_periodic_predicate< - typename Exact_traits::Compare_xyz_3, - typename Filtering_traits::Compare_xyz_3, - Offset_converter_3, - Offset_converter_3 > Compare_xyz_3; + virtual void set_domain(const Iso_cuboid_3& domain) + { + this->_domain = domain; + this->set_filtrating_traits(domain); + set_filtrating_Delaunay_traits(domain); + } - typedef Filtered_periodic_predicate< - typename Exact_traits::Coplanar_orientation_3, - typename Filtering_traits::Coplanar_orientation_3, - Offset_converter_3, - Offset_converter_3 > Coplanar_orientation_3; + void set_filtrating_Delaunay_traits(const Iso_cuboid_3& domain) + { + Delaunay_traits_e.set_domain(C2E()(domain)); + Delaunay_traits_f.set_domain(C2F()(domain)); + } - typedef Filtered_periodic_predicate< - typename Exact_traits::Orientation_3, - typename Filtering_traits::Orientation_3, - Offset_converter_3, - Offset_converter_3 > Orientation_3; - - typedef Filtered_periodic_predicate< - typename Exact_traits::Coplanar_side_of_bounded_circle_3, - typename Filtering_traits::Coplanar_side_of_bounded_circle_3, - Offset_converter_3, - Offset_converter_3 > Coplanar_side_of_bounded_circle_3; - - typedef Filtered_periodic_predicate< +public: + typedef Filtered_predicate< typename Exact_traits::Side_of_oriented_sphere_3, typename Filtering_traits::Side_of_oriented_sphere_3, Offset_converter_3, Offset_converter_3 > Side_of_oriented_sphere_3; - typedef Filtered_periodic_predicate< + typedef Filtered_predicate< typename Exact_traits::Compare_distance_3, typename Filtering_traits::Compare_distance_3, Offset_converter_3, Offset_converter_3 > Compare_distance_3; - typedef Filtered_periodic_predicate< + typedef Filtered_predicate< + typename Exact_traits::Coplanar_orientation_3, + typename Filtering_traits::Coplanar_orientation_3, + Offset_converter_3, + Offset_converter_3 > Coplanar_orientation_3; + + typedef Filtered_predicate< + typename Exact_traits::Coplanar_side_of_bounded_circle_3, + typename Filtering_traits::Coplanar_side_of_bounded_circle_3, + Offset_converter_3, + Offset_converter_3 > Coplanar_side_of_bounded_circle_3; + + typedef Filtered_predicate< typename Exact_traits::Side_of_bounded_sphere_3, typename Filtering_traits::Side_of_bounded_sphere_3, Offset_converter_3, Offset_converter_3 > Side_of_bounded_sphere_3; - - Compare_xyz_3 compare_xyz_3_object() const - { return Compare_xyz_3(&_domain_e,&_domain_f);} - - Coplanar_orientation_3 coplanar_orientation_3_object() const - { return Coplanar_orientation_3(&_domain_e,&_domain_f); } - - Orientation_3 orientation_3_object() const - { return Orientation_3(&_domain_e,&_domain_f);} - - Coplanar_side_of_bounded_circle_3 - coplanar_side_of_bounded_circle_3_object() const - { return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); } - Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const - { return Side_of_oriented_sphere_3(&_domain_e,&_domain_f);} + { + typename Exact_traits::Side_of_oriented_sphere_3 pe = Delaunay_traits_e.side_of_oriented_sphere_3_object(); + typename Filtering_traits::Side_of_oriented_sphere_3 pf = Delaunay_traits_f.side_of_oriented_sphere_3_object(); + + return Side_of_oriented_sphere_3(pe, pf); + } Compare_distance_3 compare_distance_3_object() const - { return Compare_distance_3(&_domain_e,&_domain_f);} + { + typename Exact_traits::Compare_distance_3 pe = Delaunay_traits_e.compare_distance_3_object(); + typename Filtering_traits::Compare_distance_3 pf = Delaunay_traits_f.compare_distance_3_object(); + + return Compare_distance_3(pe, pf); + } + + Coplanar_orientation_3 coplanar_orientation_3_object() const + { + typename Exact_traits::Coplanar_orientation_3 pe = Delaunay_traits_e.coplanar_orientation_3_object(); + typename Filtering_traits::Coplanar_orientation_3 pf = Delaunay_traits_f.coplanar_orientation_3_object(); + + return Coplanar_orientation_3(pe, pf); + } + + Coplanar_side_of_bounded_circle_3 coplanar_side_of_bounded_circle_3_object() const + { + typename Exact_traits::Coplanar_side_of_bounded_circle_3 pe = Delaunay_traits_e.coplanar_side_of_bounded_circle_3_object(); + typename Filtering_traits::Coplanar_side_of_bounded_circle_3 pf = Delaunay_traits_f.coplanar_side_of_bounded_circle_3_object(); + + return Coplanar_side_of_bounded_circle_3(pe, pf); + } Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const - { return Side_of_bounded_sphere_3(&_domain_e,&_domain_f);} + { + typename Exact_traits::Side_of_bounded_sphere_3 pe = Delaunay_traits_e.side_of_bounded_sphere_3_object(); + typename Filtering_traits::Side_of_bounded_sphere_3 pf = Delaunay_traits_f.side_of_bounded_sphere_3_object(); - // The following are inherited since they are constructions : - // Construct_segment_3 - // Construct_triangle_3 - // Construct_tetrahedron_3 - // Construct_circumcenter_3 + return Side_of_bounded_sphere_3(pe, pf); + } - protected: - Exact_iso_cuboid_3 _domain_e; - Approximate_iso_cuboid_3 _domain_f; +protected: + Exact_traits Delaunay_traits_e; + Filtering_traits Delaunay_traits_f; }; +template < typename K, + typename Off = CGAL::Periodic_3_offset_3, + bool Has_static_filters = internal::Has_static_filters::value > +class Periodic_3_Delaunay_triangulation_filtered_traits_3; + } //namespace CGAL #include namespace CGAL { -template < typename K, typename Off = typename CGAL::Periodic_3_offset_3, bool Has_static_filters = internal::Has_static_filters::value > -class Periodic_3_Delaunay_triangulation_filtered_traits_3 - : public Periodic_3_Delaunay_triangulation_statically_filtered_traits_3< - Periodic_3_Delaunay_triangulation_filtered_traits_base_3 > { +template +class Periodic_3_Delaunay_triangulation_filtered_traits_3 + : public Periodic_3_Delaunay_triangulation_filtered_traits_base_3 +{ + typedef Periodic_3_Delaunay_triangulation_filtered_traits_base_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_Delaunay_triangulation_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } }; -template < typename K_, typename Off> -class Periodic_3_Delaunay_triangulation_filtered_traits_3 - : public Periodic_3_Delaunay_triangulation_filtered_traits_base_3 +template +class Periodic_3_Delaunay_triangulation_filtered_traits_3 + : public Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 { + typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_Delaunay_triangulation_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } }; } //namespace CGAL diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h new file mode 100644 index 00000000000..46625504f29 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h @@ -0,0 +1,166 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Manuel Caroli + +#ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_REMOVE_TRAITS_3_H +#define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_REMOVE_TRAITS_3_H + +#include + +#include +#include +#include + +namespace CGAL { + +// Triangulation_3 uses Construct_point_3 to handle weighted and bare points. +// The default Construct_point_3 inherited by Periodic_3_triangulation_remove_traits_3 +// must be overwritten by a custom Construct_point_3 that offers: +// - pair --> pair (identity) +template +class Construct_point_from_pair_3 + : public Construct_point_3_base +{ + typedef Construct_point_3_base Base; + + // Gt::Point_3 is actually a pair + typedef typename Gt::Point_3 Point_3; + +public: + Construct_point_from_pair_3(const Construct_point_3_base& cp) : Base(cp) { } + + using Base::operator(); + + const Point_3& operator()(const Point_3& p) { return p; } +}; + +template < class Traits_, class Functor_ > +class Functor_with_point_offset_pair_adaptor + : public Functor_ +{ + typedef Traits_ Traits; + typedef Functor_ Functor; + + // `Traits::Point_3` is actually a `std::pair` + typedef typename Traits::Point_3 Point; + +public: + typedef typename Functor::result_type result_type; + + Functor_with_point_offset_pair_adaptor(const Functor & functor) : Functor_(functor) { } + +public: + using Functor::operator(); + + result_type operator()(const Point& p0, const Point& p1) const { + return operator()(p0.first, p1.first, + p0.second, p1.second); + } + result_type operator()(const Point& p0, const Point& p1, + const Point& p2) const { + return operator()(p0.first, p1.first, p2.first, + p0.second, p1.second, p2.second); + } + result_type operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3) const { + return operator()(p0.first, p1.first, p2.first, p3.first, + p0.second, p1.second, p2.second, p3.second); + } + result_type operator()(const Point& p0, const Point& p1, + const Point& p2, const Point& p3, const Point& p4) const { + return operator()(p0.first, p1.first, p2.first, p3.first, p4.first, + p0.second, p1.second, p2.second, p3.second, p4.second); + } +}; + +template < class Gt, class Off = typename CGAL::Periodic_3_offset_3 > +class Periodic_3_Delaunay_triangulation_remove_traits_3 + : public Gt +{ + typedef Periodic_3_Delaunay_triangulation_remove_traits_3 Self; + typedef Gt Base; + +public: + typedef Gt Geom_traits; + typedef Off Offset; + + typedef typename Gt::RT RT; + typedef typename Gt::FT FT; + typedef std::pair Point_3; + + // not allowing a default value for `gt` because we need to have + // an initialized domain in `gt` + Periodic_3_Delaunay_triangulation_remove_traits_3(const Gt& gt) : Base(gt) { } + + // Construct point + typedef Construct_point_from_pair_3 Construct_point_3; + + // Triangulation predicates + typedef Functor_with_point_offset_pair_adaptor + Compare_xyz_3; + typedef Functor_with_point_offset_pair_adaptor + Orientation_3; + + // Delaunay Triangulation predicates + typedef Functor_with_point_offset_pair_adaptor + Compare_distance_3; + typedef Functor_with_point_offset_pair_adaptor + Side_of_oriented_sphere_3; + + // Degenerate dimension predicates + typedef Functor_with_point_offset_pair_adaptor + Coplanar_orientation_3; + typedef Functor_with_point_offset_pair_adaptor + Coplanar_side_of_bounded_circle_3; + + // Operations + Construct_point_3 + construct_point_3_object() const { + return Construct_point_3(this->Base::construct_point_3_object()); + } + + Compare_xyz_3 + compare_xyz_3_object() const { + return Compare_xyz_3(this->Base::compare_xyz_3_object()); + } + Coplanar_orientation_3 + coplanar_orientation_3_object() const { + return Coplanar_orientation_3(this->Base::coplanar_orientation_3_object()); + } + Orientation_3 + orientation_3_object() const { + return Orientation_3(this->Base::orientation_3_object()); + } + Coplanar_side_of_bounded_circle_3 + coplanar_side_of_bounded_circle_3_object() const { + return Coplanar_side_of_bounded_circle_3(this->Base::coplanar_side_of_bounded_circle_3_object()); + } + Side_of_oriented_sphere_3 + side_of_oriented_sphere_3_object() const { + return Side_of_oriented_sphere_3(this->Base::side_of_oriented_sphere_3_object()); + } + Compare_distance_3 + compare_distance_3_object() const { + return Compare_distance_3(this->Base::compare_distance_3_object()); + } +}; + +} //namespace CGAL + +#endif // CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_REMOVE_TRAITS_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h index 78a30386771..82bfb25888f 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_statically_filtered_traits_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2001,2004,2008-2009 INRIA Sophia-Antipolis (France). +// Copyright (c) 2001,2004,2008-2009, 2017 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -14,49 +14,43 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Sylvain Pion // Manuel Caroli - + #ifndef CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H #define CGAL_PERIODIC_3_DELAUNAY_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H #include - -// This class gathers optimized predicates written by hand, using -// a few steps of filtering. It should work if the initial traits has -// cartesian coordinates which fit exactly in doubles. -// -// Purely static filters code has been removed, since it requires additional -// logic and is not plug'n play (requires users providing bounds). -// If it should be provided again, it should probably be separate. - -#include - #include - -// TODO : -// - add more predicates : +#include namespace CGAL { -// The K_base argument is supposed to provide exact primitives. -template < typename Traits > -class Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 : public Periodic_3_triangulation_statically_filtered_traits_3 +template< typename K, + typename Off = typename CGAL::Periodic_3_offset_3> +class Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 + : public Periodic_3_Delaunay_triangulation_filtered_traits_base_3 { - typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 Self; + typedef Periodic_3_Delaunay_triangulation_statically_filtered_traits_3 Self; + typedef Periodic_3_Delaunay_triangulation_filtered_traits_base_3 Base; public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - typedef internal::Static_filters_predicates::Periodic_3_side_of_oriented_sphere_3 - Side_of_oriented_sphere_3; + Periodic_3_Delaunay_triangulation_statically_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } + + typedef internal::Static_filters_predicates::Periodic_3_side_of_oriented_sphere_3< + Self, typename Base::Side_of_oriented_sphere_3> Side_of_oriented_sphere_3; Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object() const { return Side_of_oriented_sphere_3(&this->_domain, - &this->_domain_e, - &this->_domain_f); + this->Base::side_of_oriented_sphere_3_object()); } }; diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_construct_point_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_construct_point_3.h similarity index 54% rename from Periodic_3_triangulation_3/include/CGAL/Periodic_3_construct_point_3.h rename to Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_construct_point_3.h index ccac763e186..2aad83ac558 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_construct_point_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_construct_point_3.h @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Monique Teillaud // Sylvain Pion // Andreas Fabri @@ -27,38 +23,45 @@ #include +namespace CGAL { -namespace CGAL -{ template < typename K, typename Construct_point_3_base> -class Periodic_3_construct_point_3 : public Construct_point_3_base +class Periodic_3_construct_point_3 + : public Construct_point_3_base { - typedef K Kernel; + typedef Construct_point_3_base Base; + + typedef K Kernel; + + typedef typename Kernel::Point_3 Point; + typedef typename Kernel::Weighted_point_3 Weighted_point; + typedef typename Kernel::Offset Offset; + typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3; public: - typedef typename Kernel::Point_3 Point; - typedef typename Kernel::Offset Offset; - typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3; + Periodic_3_construct_point_3(const Iso_cuboid_3* dom, + const Construct_point_3_base& cp) + : Base(cp), _dom(dom) + { } - typedef Point result_type; - - Periodic_3_construct_point_3(const Iso_cuboid_3 & dom) : _dom(dom) { } - - using Construct_point_3_base::operator(); + using Base::operator(); Point operator() ( const Point& p, const Offset& o ) const { - return Point(p.x()+(_dom.xmax()-_dom.xmin())*o.x(), - p.y()+(_dom.ymax()-_dom.ymin())*o.y(), - p.z()+(_dom.zmax()-_dom.zmin())*o.z()); + return Point(p.x() + (_dom->xmax() - _dom->xmin()) * o.x(), + p.y() + (_dom->ymax() - _dom->ymin()) * o.y(), + p.z() + (_dom->zmax() - _dom->zmin()) * o.z()); } - const typename K::Point_3& - operator()(const typename K::Weighted_point_3 & p) const - { return p.rep().point(); } + Point operator() ( const Weighted_point& p, const Offset& o ) const { + return Point(p.x() + (_dom->xmax() - _dom->xmin()) * o.x(), + p.y() + (_dom->ymax() - _dom->ymin()) * o.y(), + p.z() + (_dom->zmax() - _dom->zmin()) * o.z()); + } private: - Iso_cuboid_3 _dom; + const Iso_cuboid_3* _dom; }; -} -#endif +} // namespace CGAL + +#endif // CGAL_PERIODIC_3_CONSTRUCT_POINT_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_construct_weighted_point_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_construct_weighted_point_3.h new file mode 100644 index 00000000000..e819f1c958d --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_construct_weighted_point_3.h @@ -0,0 +1,58 @@ +// Copyright (c) 2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// Author(s) : Mael Rouxel-Labbé +#ifndef CGAL_PERIODIC_3_CONSTRUCT_WEIGHTED_POINT_3_H +#define CGAL_PERIODIC_3_CONSTRUCT_WEIGHTED_POINT_3_H + +#include + +namespace CGAL { + +template < typename K, typename Construct_weighted_point_3_base> +class Periodic_3_construct_weighted_point_3 + : public Construct_weighted_point_3_base +{ + typedef Construct_weighted_point_3_base Base; + + typedef K Kernel; + + typedef typename Kernel::Point_3 Point_3; + typedef typename Kernel::Weighted_point_3 Weighted_point_3; + typedef typename Kernel::Offset Offset; + typedef typename Kernel::Iso_cuboid_3 Iso_cuboid_3; + +public: + Periodic_3_construct_weighted_point_3(const Iso_cuboid_3* dom, + const Construct_weighted_point_3_base& wp) + : Base(wp), _dom(dom) + { } + + using Base::operator(); + + Weighted_point_3 operator() (const Weighted_point_3& p, const Offset& o) const + { + return Weighted_point_3(Point_3(p.x() + (_dom->xmax() - _dom->xmin()) * o.x(), + p.y() + (_dom->ymax() - _dom->ymin()) * o.y(), + p.z() + (_dom->zmax() - _dom->zmin()) * o.z()), + p.weight()); + } + +private: + const Iso_cuboid_3* _dom; +}; + +} // namespace CGAL + +#endif // CGAL_PERIODIC_3_CONSTRUCT_WEIGHTED_POINT_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_dummy_288.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_dummy_288.h new file mode 100644 index 00000000000..083ac3ba5f8 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_dummy_288.h @@ -0,0 +1,5539 @@ +// Copyright (c) 2009, 2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Manuel Caroli + +#ifdef CGAL_INCLUDE_FROM_PERIODIC_3_REGULAR_TRIANGULATION_3_H + +std::vector insert_dummy_points () +{ + this->clear(); + + std::vector vertices; + vertices.reserve(6*6*8); + Cell_handle cells[1728]; + + FT domain_x(domain().xmax() - domain().xmin()); + FT domain_y(domain().ymax() - domain().ymin()); + FT domain_z(domain().zmax() - domain().zmin()); + + for (unsigned i = 0; i < 6; ++i) + { + for (unsigned j = 0; j < 6; ++j) + { + for (unsigned k = 0; k < 8; ++k) + { + Vertex_handle vh = tds().create_vertex(); + vertices.push_back(vh); + + FT x = (FT(i) * domain_x / FT(6)) + domain().xmin(); + if (k % 2) + x += FT(1) * domain_x / FT(12); + FT y = (FT(j) * domain_y / FT(6)) + domain().ymin(); + if (k % 2) + y += FT(1) * domain_y / FT(12); + FT z = (FT(k) * domain_z / FT(8)) + domain().zmin(); + + vh->set_point(Weighted_point(Bare_point(x, y, z), 0)); + } + } + } + + for (Cell_handle* iter=cells, *end_iter=cells+1728; iter!=end_iter; ++iter) + *iter = tds().create_cell(); + + cells[0]->set_vertices(vertices[31],vertices[279],vertices[32],vertices[39]); + cells[0]->set_neighbors(cells[1220],cells[495],cells[1015],cells[1489]); + set_offsets(cells[0],4,0,5,4); + cells[1]->set_vertices(vertices[48],vertices[1],vertices[0],vertices[41]); + cells[1]->set_neighbors(cells[1402],cells[567],cells[123],cells[295]); + set_offsets(cells[1],2,2,2,0); + cells[2]->set_vertices(vertices[23],vertices[24],vertices[72],vertices[31]); + cells[2]->set_neighbors(cells[499],cells[428],cells[1261],cells[195]); + set_offsets(cells[2],0,1,1,0); + cells[3]->set_vertices(vertices[59],vertices[11],vertices[51],vertices[60]); + cells[3]->set_neighbors(cells[221],cells[7],cells[298],cells[424]); + set_offsets(cells[3],0,0,0,0); + cells[4]->set_vertices(vertices[226],vertices[169],vertices[218],vertices[178]); + cells[4]->set_neighbors(cells[959],cells[1337],cells[47],cells[873]); + set_offsets(cells[4],0,0,0,0); + cells[5]->set_vertices(vertices[62],vertices[22],vertices[15],vertices[70]); + cells[5]->set_neighbors(cells[447],cells[341],cells[288],cells[18]); + set_offsets(cells[5],0,0,0,0); + cells[6]->set_vertices(vertices[68],vertices[116],vertices[108],vertices[59]); + cells[6]->set_neighbors(cells[478],cells[498],cells[549],cells[193]); + set_offsets(cells[6],0,0,0,0); + cells[7]->set_vertices(vertices[60],vertices[59],vertices[108],vertices[51]); + cells[7]->set_neighbors(cells[210],cells[658],cells[3],cells[498]); + set_offsets(cells[7],0,0,0,0); + cells[8]->set_vertices(vertices[54],vertices[6],vertices[7],vertices[14]); + cells[8]->set_neighbors(cells[266],cells[171],cells[62],cells[103]); + set_offsets(cells[8],0,0,0,0); + cells[9]->set_vertices(vertices[3],vertices[251],vertices[11],vertices[10]); + cells[9]->set_neighbors(cells[912],cells[185],cells[945],cells[803]); + set_offsets(cells[9],4,0,4,4); + cells[10]->set_vertices(vertices[7],vertices[8],vertices[0],vertices[48]); + cells[10]->set_neighbors(cells[295],cells[27],cells[188],cells[963]); + set_offsets(cells[10],0,1,1,1); + cells[11]->set_vertices(vertices[68],vertices[20],vertices[11],vertices[60]); + cells[11]->set_neighbors(cells[179],cells[298],cells[239],cells[144]); + set_offsets(cells[11],0,0,0,0); + cells[12]->set_vertices(vertices[5],vertices[54],vertices[6],vertices[45]); + cells[12]->set_neighbors(cells[175],cells[1425],cells[574],cells[62]); + set_offsets(cells[12],2,2,2,0); + cells[13]->set_vertices(vertices[55],vertices[7],vertices[56],vertices[15]); + cells[13]->set_neighbors(cells[112],cells[314],cells[66],cells[230]); + set_offsets(cells[13],0,0,1,0); + cells[14]->set_vertices(vertices[91],vertices[138],vertices[90],vertices[50]); + cells[14]->set_neighbors(cells[821],cells[156],cells[696],cells[820]); + set_offsets(cells[14],0,0,0,2); + cells[15]->set_vertices(vertices[3],vertices[11],vertices[51],vertices[58]); + cells[15]->set_neighbors(cells[424],cells[249],cells[185],cells[221]); + set_offsets(cells[15],0,0,0,0); + cells[16]->set_vertices(vertices[176],vertices[168],vertices[216],vertices[169]); + cells[16]->set_neighbors(cells[994],cells[254],cells[571],cells[1314]); + set_offsets(cells[16],0,0,0,0); + cells[17]->set_vertices(vertices[57],vertices[58],vertices[106],vertices[66]); + cells[17]->set_neighbors(cells[96],cells[679],cells[263],cells[431]); + set_offsets(cells[17],0,0,0,0); + cells[18]->set_vertices(vertices[62],vertices[14],vertices[15],vertices[22]); + cells[18]->set_neighbors(cells[1494],cells[5],cells[79],cells[189]); + set_offsets(cells[18],0,0,0,0); + cells[19]->set_vertices(vertices[73],vertices[65],vertices[120],vertices[113]); + cells[19]->set_neighbors(cells[272],cells[766],cells[618],cells[738]); + set_offsets(cells[19],0,0,0,0); + cells[20]->set_vertices(vertices[122],vertices[114],vertices[115],vertices[67]); + cells[20]->set_neighbors(cells[742],cells[379],cells[397],cells[517]); + set_offsets(cells[20],0,0,0,0); + cells[21]->set_vertices(vertices[62],vertices[63],vertices[15],vertices[55]); + cells[21]->set_neighbors(cells[314],cells[66],cells[487],cells[341]); + set_offsets(cells[21],0,0,0,0); + cells[22]->set_vertices(vertices[68],vertices[76],vertices[21],vertices[69]); + cells[22]->set_neighbors(cells[300],cells[488],cells[258],cells[481]); + set_offsets(cells[22],0,0,0,0); + cells[23]->set_vertices(vertices[102],vertices[110],vertices[62],vertices[55]); + cells[23]->set_neighbors(cells[487],cells[371],cells[657],cells[627]); + set_offsets(cells[23],0,0,0,0); + cells[24]->set_vertices(vertices[174],vertices[166],vertices[167],vertices[119]); + cells[24]->set_neighbors(cells[1037],cells[869],cells[785],cells[1075]); + set_offsets(cells[24],0,0,0,0); + cells[25]->set_vertices(vertices[161],vertices[153],vertices[208],vertices[201]); + cells[25]->set_neighbors(cells[967],cells[138],cells[1027],cells[1217]); + set_offsets(cells[25],0,0,0,0); + cells[26]->set_vertices(vertices[29],vertices[30],vertices[78],vertices[38]); + cells[26]->set_neighbors(cells[464],cells[359],cells[1583],cells[404]); + set_offsets(cells[26],0,0,0,0); + cells[27]->set_vertices(vertices[47],vertices[0],vertices[48],vertices[7]); + cells[27]->set_neighbors(cells[10],cells[609],cells[1353],cells[363]); + set_offsets(cells[27],0,3,3,2); + cells[28]->set_vertices(vertices[18],vertices[10],vertices[9],vertices[58]); + cells[28]->set_neighbors(cells[39],cells[75],cells[106],cells[1006]); + set_offsets(cells[28],0,0,0,0); + cells[29]->set_vertices(vertices[166],vertices[109],vertices[158],vertices[118]); + cells[29]->set_neighbors(cells[739],cells[690],cells[224],cells[182]); + set_offsets(cells[29],0,0,0,0); + cells[30]->set_vertices(vertices[34],vertices[74],vertices[26],vertices[25]); + cells[30]->set_neighbors(cells[242],cells[1550],cells[520],cells[186]); + set_offsets(cells[30],0,0,0,0); + cells[31]->set_vertices(vertices[3],vertices[4],vertices[52],vertices[12]); + cells[31]->set_neighbors(cells[337],cells[120],cells[1457],cells[331]); + set_offsets(cells[31],0,0,0,0); + cells[32]->set_vertices(vertices[66],vertices[19],vertices[67],vertices[74]); + cells[32]->set_neighbors(cells[432],cells[63],cells[484],cells[470]); + set_offsets(cells[32],0,0,0,0); + cells[33]->set_vertices(vertices[64],vertices[24],vertices[17],vertices[72]); + cells[33]->set_neighbors(cells[287],cells[213],cells[195],cells[87]); + set_offsets(cells[33],0,0,0,0); + cells[34]->set_vertices(vertices[248],vertices[193],vertices[241],vertices[201]); + cells[34]->set_neighbors(cells[1502],cells[1509],cells[1481],cells[301]); + set_offsets(cells[34],0,0,0,0); + cells[35]->set_vertices(vertices[197],vertices[204],vertices[149],vertices[157]); + cells[35]->set_neighbors(cells[1190],cells[558],cells[443],cells[168]); + set_offsets(cells[35],0,0,0,0); + cells[36]->set_vertices(vertices[17],vertices[66],vertices[9],vertices[57]); + cells[36]->set_neighbors(cells[263],cells[270],cells[338],cells[232]); + set_offsets(cells[36],0,0,0,0); + cells[37]->set_vertices(vertices[204],vertices[196],vertices[149],vertices[156]); + cells[37]->set_neighbors(cells[852],cells[1190],cells[976],cells[168]); + set_offsets(cells[37],0,0,0,0); + cells[38]->set_vertices(vertices[31],vertices[80],vertices[72],vertices[79]); + cells[38]->set_neighbors(cells[684],cells[401],cells[251],cells[508]); + set_offsets(cells[38],0,1,1,0); + cells[39]->set_vertices(vertices[1],vertices[10],vertices[58],vertices[9]); + cells[39]->set_neighbors(cells[28],cells[166],cells[1507],cells[190]); + set_offsets(cells[39],0,0,0,0); + cells[40]->set_vertices(vertices[74],vertices[27],vertices[75],vertices[82]); + cells[40]->set_neighbors(cells[514],cells[697],cells[482],cells[515]); + set_offsets(cells[40],0,0,0,0); + cells[41]->set_vertices(vertices[43],vertices[92],vertices[44],vertices[35]); + cells[41]->set_neighbors(cells[143],cells[1004],cells[493],cells[523]); + set_offsets(cells[41],0,0,0,0); + cells[42]->set_vertices(vertices[60],vertices[52],vertices[5],vertices[12]); + cells[42]->set_neighbors(cells[337],cells[206],cells[120],cells[149]); + set_offsets(cells[42],0,0,0,0); + cells[43]->set_vertices(vertices[160],vertices[105],vertices[152],vertices[153]); + cells[43]->set_neighbors(cells[951],cells[1112],cells[955],cells[678]); + set_offsets(cells[43],0,0,0,0); + cells[44]->set_vertices(vertices[258],vertices[249],vertices[18],vertices[10]); + cells[44]->set_neighbors(cells[1006],cells[749],cells[1510],cells[145]); + set_offsets(cells[44],0,0,4,4); + cells[45]->set_vertices(vertices[116],vertices[69],vertices[68],vertices[61]); + cells[45]->set_neighbors(cells[488],cells[193],cells[317],cells[258]); + set_offsets(cells[45],0,0,0,0); + cells[46]->set_vertices(vertices[21],vertices[70],vertices[69],vertices[78]); + cells[46]->set_neighbors(cells[292],cells[452],cells[380],cells[201]); + set_offsets(cells[46],0,0,0,0); + cells[47]->set_vertices(vertices[177],vertices[169],vertices[226],vertices[178]); + cells[47]->set_neighbors(cells[4],cells[1039],cells[646],cells[1186]); + set_offsets(cells[47],0,0,0,0); + cells[48]->set_vertices(vertices[201],vertices[153],vertices[193],vertices[202]); + cells[48]->set_neighbors(cells[1149],cells[1501],cells[811],cells[1229]); + set_offsets(cells[48],0,0,0,0); + cells[49]->set_vertices(vertices[1],vertices[50],vertices[49],vertices[58]); + cells[49]->set_neighbors(cells[320],cells[166],cells[190],cells[583]); + set_offsets(cells[49],0,0,0,0); + cells[50]->set_vertices(vertices[93],vertices[140],vertices[92],vertices[52]); + cells[50]->set_neighbors(cells[349],cells[597],cells[788],cells[812]); + set_offsets(cells[50],0,0,0,2); + cells[51]->set_vertices(vertices[108],vertices[53],vertices[101],vertices[61]); + cells[51]->set_neighbors(cells[281],cells[706],cells[247],cells[382]); + set_offsets(cells[51],0,0,0,0); + cells[52]->set_vertices(vertices[41],vertices[90],vertices[2],vertices[42]); + cells[52]->set_neighbors(cells[477],cells[1606],cells[102],cells[564]); + set_offsets(cells[52],0,0,2,0); + cells[53]->set_vertices(vertices[1],vertices[2],vertices[50],vertices[10]); + cells[53]->set_neighbors(cells[72],cells[190],cells[1449],cells[328]); + set_offsets(cells[53],0,0,0,0); + cells[54]->set_vertices(vertices[98],vertices[51],vertices[91],vertices[139]); + cells[54]->set_neighbors(cells[823],cells[147],cells[872],cells[187]); + set_offsets(cells[54],2,2,0,0); + cells[55]->set_vertices(vertices[87],vertices[86],vertices[134],vertices[79]); + cells[55]->set_neighbors(cells[414],cells[808],cells[578],cells[218]); + set_offsets(cells[55],0,0,0,0); + cells[56]->set_vertices(vertices[172],vertices[115],vertices[164],vertices[124]); + cells[56]->set_neighbors(cells[970],cells[984],cells[845],cells[772]); + set_offsets(cells[56],0,0,0,0); + cells[57]->set_vertices(vertices[163],vertices[155],vertices[212],vertices[164]); + cells[57]->set_neighbors(cells[59],cells[833],cells[703],cells[441]); + set_offsets(cells[57],0,0,0,0); + cells[58]->set_vertices(vertices[285],vertices[277],vertices[44],vertices[37]); + cells[58]->set_neighbors(cells[1193],cells[1354],cells[1172],cells[1710]); + set_offsets(cells[58],0,0,4,4); + cells[59]->set_vertices(vertices[212],vertices[155],vertices[204],vertices[164]); + cells[59]->set_neighbors(cells[1030],cells[1258],cells[57],cells[1281]); + set_offsets(cells[59],0,0,0,0); + cells[60]->set_vertices(vertices[81],vertices[73],vertices[82],vertices[33]); + cells[60]->set_neighbors(cells[465],cells[290],cells[556],cells[601]); + set_offsets(cells[60],0,0,0,0); + cells[61]->set_vertices(vertices[13],vertices[61],vertices[53],vertices[60]); + cells[61]->set_neighbors(cells[247],cells[113],cells[274],cells[296]); + set_offsets(cells[61],0,0,0,0); + cells[62]->set_vertices(vertices[5],vertices[6],vertices[54],vertices[14]); + cells[62]->set_neighbors(cells[8],cells[321],cells[1417],cells[12]); + set_offsets(cells[62],0,0,0,0); + cells[63]->set_vertices(vertices[114],vertices[66],vertices[67],vertices[74]); + cells[63]->set_neighbors(cells[32],cells[397],cells[240],cells[82]); + set_offsets(cells[63],0,0,0,0); + cells[64]->set_vertices(vertices[100],vertices[108],vertices[99],vertices[51]); + cells[64]->set_neighbors(cells[210],cells[791],cells[658],cells[894]); + set_offsets(cells[64],0,0,0,0); + cells[65]->set_vertices(vertices[185],vertices[146],vertices[186],vertices[234]); + cells[65]->set_neighbors(cells[245],cells[1173],cells[1414],cells[1125]); + set_offsets(cells[65],0,2,0,0); + cells[66]->set_vertices(vertices[62],vertices[7],vertices[55],vertices[15]); + cells[66]->set_neighbors(cells[13],cells[21],cells[189],cells[114]); + set_offsets(cells[66],0,0,0,0); + cells[67]->set_vertices(vertices[144],vertices[96],vertices[137],vertices[97]); + cells[67]->set_neighbors(cells[861],cells[1129],cells[674],cells[1072]); + set_offsets(cells[67],2,2,0,2); + cells[68]->set_vertices(vertices[83],vertices[82],vertices[130],vertices[75]); + cells[68]->set_neighbors(cells[814],cells[781],cells[566],cells[388]); + set_offsets(cells[68],0,0,0,0); + cells[69]->set_vertices(vertices[175],vertices[216],vertices[167],vertices[215]); + cells[69]->set_neighbors(cells[919],cells[810],cells[837],cells[1313]); + set_offsets(cells[69],0,1,0,0); + cells[70]->set_vertices(vertices[48],vertices[88],vertices[89],vertices[41]); + cells[70]->set_neighbors(cells[378],cells[123],cells[567],cells[787]); + set_offsets(cells[70],2,0,0,0); + cells[71]->set_vertices(vertices[29],vertices[78],vertices[69],vertices[77]); + cells[71]->set_neighbors(cells[561],cells[528],cells[279],cells[452]); + set_offsets(cells[71],0,0,0,0); + cells[72]->set_vertices(vertices[50],vertices[2],vertices[3],vertices[10]); + cells[72]->set_neighbors(cells[1423],cells[306],cells[53],cells[374]); + set_offsets(cells[72],0,0,0,0); + cells[73]->set_vertices(vertices[153],vertices[105],vertices[145],vertices[154]); + cells[73]->set_neighbors(cells[557],cells[1151],cells[969],cells[951]); + set_offsets(cells[73],0,0,0,0); + cells[74]->set_vertices(vertices[33],vertices[82],vertices[34],vertices[25]); + cells[74]->set_neighbors(cells[520],cells[948],cells[465],cells[449]); + set_offsets(cells[74],0,0,0,0); + cells[75]->set_vertices(vertices[66],vertices[18],vertices[9],vertices[58]); + cells[75]->set_neighbors(cells[28],cells[263],cells[202],cells[232]); + set_offsets(cells[75],0,0,0,0); + cells[76]->set_vertices(vertices[173],vertices[220],vertices[213],vertices[165]); + cells[76]->set_neighbors(cells[1295],cells[1060],cells[1302],cells[1047]); + set_offsets(cells[76],0,0,0,0); + cells[77]->set_vertices(vertices[149],vertices[198],vertices[197],vertices[206]); + cells[77]->set_neighbors(cells[1213],cells[558],cells[151],cells[1182]); + set_offsets(cells[77],0,0,0,0); + cells[78]->set_vertices(vertices[130],vertices[138],vertices[129],vertices[81]); + cells[78]->set_neighbors(cells[381],cells[98],cells[591],cells[1017]); + set_offsets(cells[78],0,0,0,0); + cells[79]->set_vertices(vertices[13],vertices[14],vertices[62],vertices[22]); + cells[79]->set_neighbors(cells[18],cells[288],cells[1528],cells[278]); + set_offsets(cells[79],0,0,0,0); + cells[80]->set_vertices(vertices[75],vertices[76],vertices[124],vertices[84]); + cells[80]->set_neighbors(cells[545],cells[89],cells[458],cells[624]); + set_offsets(cells[80],0,0,0,0); + cells[81]->set_vertices(vertices[220],vertices[163],vertices[212],vertices[172]); + cells[81]->set_neighbors(cells[833],cells[1301],cells[233],cells[1062]); + set_offsets(cells[81],0,0,0,0); + cells[82]->set_vertices(vertices[114],vertices[66],vertices[59],vertices[67]); + cells[82]->set_neighbors(cells[470],cells[469],cells[63],cells[429]); + set_offsets(cells[82],0,0,0,0); + cells[83]->set_vertices(vertices[273],vertices[265],vertices[34],vertices[274]); + cells[83]->set_neighbors(cells[1563],cells[1691],cells[930],cells[1659]); + set_offsets(cells[83],0,0,4,0); + cells[84]->set_vertices(vertices[235],vertices[194],vertices[242],vertices[282]); + cells[84]->set_neighbors(cells[226],cells[1696],cells[1694],cells[1002]); + set_offsets(cells[84],0,2,2,0); + cells[85]->set_vertices(vertices[225],vertices[217],vertices[274],vertices[226]); + cells[85]->set_neighbors(cells[1178],cells[1655],cells[1187],cells[1330]); + set_offsets(cells[85],0,0,0,0); + cells[86]->set_vertices(vertices[76],vertices[28],vertices[19],vertices[68]); + cells[86]->set_neighbors(cells[271],cells[480],cells[481],cells[339]); + set_offsets(cells[86],0,0,0,0); + cells[87]->set_vertices(vertices[64],vertices[16],vertices[17],vertices[24]); + cells[87]->set_neighbors(cells[1553],cells[33],cells[297],cells[170]); + set_offsets(cells[87],0,0,0,0); + cells[88]->set_vertices(vertices[128],vertices[120],vertices[79],vertices[127]); + cells[88]->set_neighbors(cells[654],cells[737],cells[1038],cells[813]); + set_offsets(cells[88],1,1,0,0); + cells[89]->set_vertices(vertices[75],vertices[84],vertices[124],vertices[132]); + cells[89]->set_neighbors(cells[365],cells[418],cells[633],cells[80]); + set_offsets(cells[89],0,0,0,0); + cells[90]->set_vertices(vertices[25],vertices[74],vertices[17],vertices[65]); + cells[90]->set_neighbors(cells[486],cells[466],cells[358],cells[242]); + set_offsets(cells[90],0,0,0,0); + cells[91]->set_vertices(vertices[125],vertices[172],vertices[165],vertices[117]); + cells[91]->set_neighbors(cells[712],cells[982],cells[459],cells[953]); + set_offsets(cells[91],0,0,0,0); + cells[92]->set_vertices(vertices[72],vertices[24],vertices[25],vertices[32]); + cells[92]->set_neighbors(cells[1610],cells[437],cells[499],cells[287]); + set_offsets(cells[92],0,0,0,0); + cells[93]->set_vertices(vertices[47],vertices[40],vertices[88],vertices[0]); + cells[93]->set_neighbors(cells[235],cells[363],cells[1615],cells[550]); + set_offsets(cells[93],0,1,1,3); + cells[94]->set_vertices(vertices[73],vertices[122],vertices[113],vertices[121]); + cells[94]->set_neighbors(cells[792],cells[766],cells[115],cells[618]); + set_offsets(cells[94],0,0,0,0); + cells[95]->set_vertices(vertices[260],vertices[212],vertices[252],vertices[205]); + cells[95]->set_neighbors(cells[1243],cells[1465],cells[964],cells[1024]); + set_offsets(cells[95],0,0,0,0); + cells[96]->set_vertices(vertices[106],vertices[58],vertices[59],vertices[66]); + cells[96]->set_neighbors(cells[451],cells[429],cells[17],cells[681]); + set_offsets(cells[96],0,0,0,0); + cells[97]->set_vertices(vertices[1],vertices[56],vertices[49],vertices[48]); + cells[97]->set_neighbors(cells[604],cells[584],cells[335],cells[131]); + set_offsets(cells[97],0,0,0,0); + cells[98]->set_vertices(vertices[129],vertices[130],vertices[81],vertices[121]); + cells[98]->set_neighbors(cells[764],cells[617],cells[1065],cells[78]); + set_offsets(cells[98],0,0,0,0); + cells[99]->set_vertices(vertices[36],vertices[76],vertices[28],vertices[27]); + cells[99]->set_neighbors(cells[339],cells[1574],cells[220],cells[107]); + set_offsets(cells[99],0,0,0,0); + cells[100]->set_vertices(vertices[155],vertices[202],vertices[147],vertices[154]); + cells[100]->set_neighbors(cells[1191],cells[961],cells[1179],cells[1034]); + set_offsets(cells[100],0,0,0,0); + cells[101]->set_vertices(vertices[56],vertices[8],vertices[9],vertices[16]); + cells[101]->set_neighbors(cells[1505],cells[199],cells[385],cells[336]); + set_offsets(cells[101],0,0,0,0); + cells[102]->set_vertices(vertices[41],vertices[90],vertices[42],vertices[33]); + cells[102]->set_neighbors(cells[303],cells[1183],cells[560],cells[52]); + set_offsets(cells[102],0,0,0,0); + cells[103]->set_vertices(vertices[54],vertices[7],vertices[6],vertices[47]); + cells[103]->set_neighbors(cells[234],cells[426],cells[612],cells[8]); + set_offsets(cells[103],2,2,2,0); + cells[104]->set_vertices(vertices[28],vertices[20],vertices[68],vertices[21]); + cells[104]->set_neighbors(cells[434],cells[481],cells[1251],cells[271]); + set_offsets(cells[104],0,0,0,0); + cells[105]->set_vertices(vertices[3],vertices[12],vertices[60],vertices[11]); + cells[105]->set_neighbors(cells[179],cells[221],cells[803],cells[120]); + set_offsets(cells[105],0,0,0,0); + cells[106]->set_vertices(vertices[18],vertices[10],vertices[58],vertices[11]); + cells[106]->set_neighbors(cells[185],cells[202],cells[912],cells[28]); + set_offsets(cells[106],0,0,0,0); + cells[107]->set_vertices(vertices[36],vertices[29],vertices[28],vertices[76]); + cells[107]->set_neighbors(cells[439],cells[99],cells[502],cells[1527]); + set_offsets(cells[107],0,0,0,0); + cells[108]->set_vertices(vertices[5],vertices[93],vertices[45],vertices[52]); + cells[108]->set_neighbors(cells[597],cells[276],cells[599],cells[574]); + set_offsets(cells[108],2,0,0,2); + cells[109]->set_vertices(vertices[133],vertices[134],vertices[85],vertices[125]); + cells[109]->set_neighbors(cells[462],cells[828],cells[590],cells[389]); + set_offsets(cells[109],0,0,0,0); + cells[110]->set_vertices(vertices[253],vertices[252],vertices[245],vertices[205]); + cells[110]->set_neighbors(cells[1469],cells[1305],cells[1465],cells[1484]); + set_offsets(cells[110],0,0,0,0); + cells[111]->set_vertices(vertices[96],vertices[48],vertices[89],vertices[49]); + cells[111]->set_neighbors(cells[584],cells[858],cells[604],cells[350]); + set_offsets(cells[111],2,2,0,2); + cells[112]->set_vertices(vertices[7],vertices[8],vertices[56],vertices[15]); + cells[112]->set_neighbors(cells[385],cells[13],cells[1304],cells[188]); + set_offsets(cells[112],0,1,1,0); + cells[113]->set_vertices(vertices[5],vertices[13],vertices[53],vertices[60]); + cells[113]->set_neighbors(cells[61],cells[149],cells[206],cells[192]); + set_offsets(cells[113],0,0,0,0); + cells[114]->set_vertices(vertices[54],vertices[7],vertices[55],vertices[62]); + cells[114]->set_neighbors(cells[66],cells[371],cells[171],cells[611]); + set_offsets(cells[114],0,0,0,0); + cells[115]->set_vertices(vertices[73],vertices[122],vertices[121],vertices[130]); + cells[115]->set_neighbors(cells[521],cells[764],cells[778],cells[94]); + set_offsets(cells[115],0,0,0,0); + cells[116]->set_vertices(vertices[148],vertices[141],vertices[188],vertices[189]); + cells[116]->set_neighbors(cells[926],cells[1383],cells[390],cells[332]); + set_offsets(cells[116],2,0,0,0); + cells[117]->set_vertices(vertices[167],vertices[208],vertices[159],vertices[207]); + cells[117]->set_neighbors(cells[1141],cells[1161],cells[1204],cells[1268]); + set_offsets(cells[117],0,1,0,0); + cells[118]->set_vertices(vertices[82],vertices[35],vertices[90],vertices[42]); + cells[118]->set_neighbors(cells[313],cells[303],cells[497],cells[293]); + set_offsets(cells[118],0,0,0,0); + cells[119]->set_vertices(vertices[37],vertices[29],vertices[36],vertices[84]); + cells[119]->set_neighbors(cells[502],cells[368],cells[527],cells[1629]); + set_offsets(cells[119],0,0,0,0); + cells[120]->set_vertices(vertices[3],vertices[12],vertices[52],vertices[60]); + cells[120]->set_neighbors(cells[42],cells[223],cells[105],cells[31]); + set_offsets(cells[120],0,0,0,0); + cells[121]->set_vertices(vertices[55],vertices[104],vertices[63],vertices[56]); + cells[121]->set_neighbors(cells[209],cells[314],cells[150],cells[330]); + set_offsets(cells[121],0,1,0,1); + cells[122]->set_vertices(vertices[70],vertices[23],vertices[15],vertices[63]); + cells[122]->set_neighbors(cells[135],cells[341],cells[148],cells[447]); + set_offsets(cells[122],0,0,0,0); + cells[123]->set_vertices(vertices[1],vertices[89],vertices[41],vertices[48]); + cells[123]->set_neighbors(cells[70],cells[1],cells[584],cells[289]); + set_offsets(cells[123],2,0,0,2); + cells[124]->set_vertices(vertices[12],vertices[243],vertices[252],vertices[251]); + cells[124]->set_neighbors(cells[1257],cells[1576],cells[1468],cells[1379]); + set_offsets(cells[124],4,0,0,0); + cells[125]->set_vertices(vertices[280],vertices[225],vertices[233],vertices[232]); + cells[125]->set_neighbors(cells[1407],cells[1642],cells[1487],cells[1648]); + set_offsets(cells[125],0,0,0,0); + cells[126]->set_vertices(vertices[196],vertices[148],vertices[236],vertices[189]); + cells[126]->set_neighbors(cells[1383],cells[238],cells[862],cells[768]); + set_offsets(cells[126],2,2,0,0); + cells[127]->set_vertices(vertices[221],vertices[213],vertices[261],vertices[270]); + cells[127]->set_neighbors(cells[1585],cells[1536],cells[1586],cells[891]); + set_offsets(cells[127],0,0,0,0); + cells[128]->set_vertices(vertices[28],vertices[268],vertices[20],vertices[261]); + cells[128]->set_neighbors(cells[217],cells[1251],cells[1571],cells[1298]); + set_offsets(cells[128],4,0,4,0); + cells[129]->set_vertices(vertices[84],vertices[37],vertices[85],vertices[92]); + cells[129]->set_neighbors(cells[513],cells[632],cells[524],cells[568]); + set_offsets(cells[129],0,0,0,0); + cells[130]->set_vertices(vertices[99],vertices[148],vertices[147],vertices[156]); + cells[130]->set_neighbors(cells[1192],cells[153],cells[720],cells[1099]); + set_offsets(cells[130],0,0,0,0); + cells[131]->set_vertices(vertices[1],vertices[9],vertices[49],vertices[56]); + cells[131]->set_neighbors(cells[412],cells[97],cells[336],cells[166]); + set_offsets(cells[131],0,0,0,0); + cells[132]->set_vertices(vertices[103],vertices[55],vertices[96],vertices[104]); + cells[132]->set_neighbors(cells[150],cells[638],cells[330],cells[838]); + set_offsets(cells[132],0,0,1,1); + cells[133]->set_vertices(vertices[236],vertices[188],vertices[179],vertices[228]); + cells[133]->set_neighbors(cells[925],cells[269],cells[327],cells[1392]); + set_offsets(cells[133],0,0,0,0); + cells[134]->set_vertices(vertices[199],vertices[192],vertices[240],vertices[200]); + cells[134]->set_neighbors(cells[1143],cells[1498],cells[1221],cells[1444]); + set_offsets(cells[134],0,1,1,1); + cells[135]->set_vertices(vertices[15],vertices[23],vertices[64],vertices[63]); + cells[135]->set_neighbors(cells[169],cells[141],cells[122],cells[453]); + set_offsets(cells[135],0,0,1,0); + cells[136]->set_vertices(vertices[21],vertices[261],vertices[269],vertices[28]); + cells[136]->set_neighbors(cells[1571],cells[1464],cells[1251],cells[1209]); + set_offsets(cells[136],4,0,0,4); + cells[137]->set_vertices(vertices[159],vertices[200],vertices[199],vertices[207]); + cells[137]->set_neighbors(cells[1450],cells[1205],cells[1141],cells[1222]); + set_offsets(cells[137],0,1,0,0); + cells[138]->set_vertices(vertices[209],vertices[161],vertices[208],vertices[201]); + cells[138]->set_neighbors(cells[25],cells[176],cells[960],cells[1273]); + set_offsets(cells[138],0,0,0,0); + cells[139]->set_vertices(vertices[121],vertices[113],vertices[161],vertices[170]); + cells[139]->set_neighbors(cells[954],cells[444],cells[792],cells[992]); + set_offsets(cells[139],0,0,0,0); + cells[140]->set_vertices(vertices[135],vertices[142],vertices[134],vertices[87]); + cells[140]->set_neighbors(cells[850],cells[822],cells[848],cells[1106]); + set_offsets(cells[140],0,0,0,0); + cells[141]->set_vertices(vertices[15],vertices[64],vertices[56],vertices[63]); + cells[141]->set_neighbors(cells[209],cells[314],cells[135],cells[184]); + set_offsets(cells[141],0,1,1,0); + cells[142]->set_vertices(vertices[94],vertices[86],vertices[85],vertices[134]); + cells[142]->set_neighbors(cells[311],cells[880],cells[218],cells[407]); + set_offsets(cells[142],0,0,0,0); + cells[143]->set_vertices(vertices[92],vertices[84],vertices[44],vertices[35]); + cells[143]->set_neighbors(cells[538],cells[41],cells[302],cells[524]); + set_offsets(cells[143],0,0,0,0); + cells[144]->set_vertices(vertices[19],vertices[20],vertices[11],vertices[68]); + cells[144]->set_neighbors(cells[11],cells[433],cells[271],cells[1567]); + set_offsets(cells[144],0,0,0,0); + cells[145]->set_vertices(vertices[257],vertices[249],vertices[18],vertices[258]); + cells[145]->set_neighbors(cells[44],cells[1558],cells[1378],cells[1556]); + set_offsets(cells[145],0,0,4,0); + cells[146]->set_vertices(vertices[206],vertices[198],vertices[151],vertices[158]); + cells[146]->set_neighbors(cells[641],cells[1111],cells[151],cells[1240]); + set_offsets(cells[146],0,0,0,0); + cells[147]->set_vertices(vertices[98],vertices[91],vertices[138],vertices[139]); + cells[147]->set_neighbors(cells[376],cells[413],cells[54],cells[696]); + set_offsets(cells[147],2,0,0,0); + cells[148]->set_vertices(vertices[70],vertices[71],vertices[23],vertices[63]); + cells[148]->set_neighbors(cells[169],cells[122],cells[294],cells[355]); + set_offsets(cells[148],0,0,0,0); + cells[149]->set_vertices(vertices[5],vertices[60],vertices[53],vertices[52]); + cells[149]->set_neighbors(cells[650],cells[599],cells[42],cells[113]); + set_offsets(cells[149],0,0,0,0); + cells[150]->set_vertices(vertices[55],vertices[96],vertices[104],vertices[56]); + cells[150]->set_neighbors(cells[637],cells[121],cells[200],cells[132]); + set_offsets(cells[150],0,1,1,1); + cells[151]->set_vertices(vertices[149],vertices[158],vertices[198],vertices[206]); + cells[151]->set_neighbors(cells[146],cells[77],cells[692],cells[643]); + set_offsets(cells[151],0,0,0,0); + cells[152]->set_vertices(vertices[91],vertices[90],vertices[83],vertices[43]); + cells[152]->set_neighbors(cells[329],cells[211],cells[156],cells[820]); + set_offsets(cells[152],0,0,0,0); + cells[153]->set_vertices(vertices[99],vertices[156],vertices[147],vertices[107]); + cells[153]->set_neighbors(cells[843],cells[704],cells[907],cells[130]); + set_offsets(cells[153],0,0,0,0); + cells[154]->set_vertices(vertices[116],vertices[67],vertices[107],vertices[59]); + cells[154]->set_neighbors(cells[469],cells[478],cells[549],cells[286]); + set_offsets(cells[154],0,0,0,0); + cells[155]->set_vertices(vertices[180],vertices[220],vertices[173],vertices[172]); + cells[155]->set_neighbors(cells[1302],cells[993],cells[870],cells[1345]); + set_offsets(cells[155],0,0,0,0); + cells[156]->set_vertices(vertices[50],vertices[90],vertices[91],vertices[43]); + cells[156]->set_neighbors(cells[152],cells[519],cells[536],cells[14]); + set_offsets(cells[156],2,0,0,0); + cells[157]->set_vertices(vertices[224],vertices[216],vertices[264],vertices[217]); + cells[157]->set_neighbors(cells[1446],cells[1315],cells[1320],cells[1605]); + set_offsets(cells[157],0,0,0,0); + cells[158]->set_vertices(vertices[161],vertices[153],vertices[210],vertices[162]); + cells[158]->set_neighbors(cells[208],cells[1008],cells[746],cells[1027]); + set_offsets(cells[158],0,0,0,0); + cells[159]->set_vertices(vertices[127],vertices[135],vertices[182],vertices[134]); + cells[159]->set_neighbors(cells[1106],cells[780],cells[822],cells[1076]); + set_offsets(cells[159],0,0,0,0); + cells[160]->set_vertices(vertices[80],vertices[32],vertices[33],vertices[40]); + cells[160]->set_neighbors(cells[1439],cells[562],cells[539],cells[402]); + set_offsets(cells[160],0,0,0,0); + cells[161]->set_vertices(vertices[138],vertices[89],vertices[137],vertices[129]); + cells[161]->set_neighbors(cells[815],cells[652],cells[381],cells[856]); + set_offsets(cells[161],0,0,0,0); + cells[162]->set_vertices(vertices[100],vertices[51],vertices[91],vertices[52]); + cells[162]->set_neighbors(cells[592],cells[492],cells[372],cells[823]); + set_offsets(cells[162],2,2,0,2); + cells[163]->set_vertices(vertices[39],vertices[40],vertices[80],vertices[88]); + cells[163]->set_neighbors(cells[562],cells[546],cells[550],cells[539]); + set_offsets(cells[163],0,1,1,1); + cells[164]->set_vertices(vertices[157],vertices[109],vertices[149],vertices[158]); + cells[164]->set_neighbors(cells[691],cells[692],cells[182],cells[971]); + set_offsets(cells[164],0,0,0,0); + cells[165]->set_vertices(vertices[169],vertices[161],vertices[218],vertices[170]); + cells[165]->set_neighbors(cells[248],cells[959],cells[444],cells[1049]); + set_offsets(cells[165],0,0,0,0); + cells[166]->set_vertices(vertices[1],vertices[58],vertices[49],vertices[9]); + cells[166]->set_neighbors(cells[177],cells[131],cells[39],cells[49]); + set_offsets(cells[166],0,0,0,0); + cells[167]->set_vertices(vertices[92],vertices[52],vertices[91],vertices[43]); + cells[167]->set_neighbors(cells[563],cells[211],cells[525],cells[349]); + set_offsets(cells[167],0,2,0,0); + cells[168]->set_vertices(vertices[197],vertices[196],vertices[149],vertices[204]); + cells[168]->set_neighbors(cells[37],cells[35],cells[1244],cells[1199]); + set_offsets(cells[168],0,0,0,0); + cells[169]->set_vertices(vertices[23],vertices[71],vertices[64],vertices[63]); + cells[169]->set_neighbors(cells[725],cells[135],cells[148],cells[203]); + set_offsets(cells[169],0,0,1,0); + cells[170]->set_vertices(vertices[64],vertices[16],vertices[9],vertices[17]); + cells[170]->set_neighbors(cells[1554],cells[270],cells[87],cells[199]); + set_offsets(cells[170],0,0,0,0); + cells[171]->set_vertices(vertices[54],vertices[14],vertices[7],vertices[62]); + cells[171]->set_neighbors(cells[189],cells[114],cells[321],cells[8]); + set_offsets(cells[171],0,0,0,0); + cells[172]->set_vertices(vertices[222],vertices[213],vertices[262],vertices[214]); + cells[172]->set_neighbors(cells[1290],cells[1349],cells[1338],cells[1057]); + set_offsets(cells[172],0,0,0,0); + cells[173]->set_vertices(vertices[247],vertices[254],vertices[199],vertices[207]); + cells[173]->set_neighbors(cells[1249],cells[1441],cells[1291],cells[769]); + set_offsets(cells[173],0,0,0,0); + cells[174]->set_vertices(vertices[128],vertices[136],vertices[135],vertices[87]); + cells[174]->set_neighbors(cells[531],cells[758],cells[273],cells[782]); + set_offsets(cells[174],1,1,0,0); + cells[175]->set_vertices(vertices[45],vertices[54],vertices[6],vertices[94]); + cells[175]->set_neighbors(cells[426],cells[581],cells[255],cells[12]); + set_offsets(cells[175],0,2,2,0); + cells[176]->set_vertices(vertices[209],vertices[201],vertices[208],vertices[256]); + cells[176]->set_neighbors(cells[940],cells[1226],cells[1542],cells[138]); + set_offsets(cells[176],0,0,0,0); + cells[177]->set_vertices(vertices[58],vertices[57],vertices[49],vertices[9]); + cells[177]->set_neighbors(cells[412],cells[166],cells[263],cells[431]); + set_offsets(cells[177],0,0,0,0); + cells[178]->set_vertices(vertices[13],vertices[22],vertices[70],vertices[21]); + cells[178]->set_neighbors(cells[406],cells[367],cells[1580],cells[288]); + set_offsets(cells[178],0,0,0,0); + cells[179]->set_vertices(vertices[20],vertices[12],vertices[11],vertices[60]); + cells[179]->set_neighbors(cells[105],cells[11],cells[319],cells[183]); + set_offsets(cells[179],0,0,0,0); + cells[180]->set_vertices(vertices[112],vertices[72],vertices[64],vertices[65]); + cells[180]->set_neighbors(cells[213],cells[569],cells[456],cells[724]); + set_offsets(cells[180],0,0,0,0); + cells[181]->set_vertices(vertices[67],vertices[76],vertices[68],vertices[116]); + cells[181]->set_neighbors(cells[258],cells[549],cells[619],cells[480]); + set_offsets(cells[181],0,0,0,0); + cells[182]->set_vertices(vertices[166],vertices[109],vertices[157],vertices[158]); + cells[182]->set_neighbors(cells[164],cells[1041],cells[29],cells[268]); + set_offsets(cells[182],0,0,0,0); + cells[183]->set_vertices(vertices[251],vertices[12],vertices[11],vertices[20]); + cells[183]->set_neighbors(cells[179],cells[1566],cells[1253],cells[803]); + set_offsets(cells[183],0,4,4,4); + cells[184]->set_vertices(vertices[15],vertices[16],vertices[56],vertices[64]); + cells[184]->set_neighbors(cells[199],cells[141],cells[453],cells[385]); + set_offsets(cells[184],0,1,1,1); + cells[185]->set_vertices(vertices[10],vertices[11],vertices[3],vertices[58]); + cells[185]->set_neighbors(cells[15],cells[306],cells[106],cells[9]); + set_offsets(cells[185],0,0,0,0); + cells[186]->set_vertices(vertices[34],vertices[27],vertices[26],vertices[74]); + cells[186]->set_neighbors(cells[285],cells[30],cells[482],cells[1565]); + set_offsets(cells[186],0,0,0,0); + cells[187]->set_vertices(vertices[51],vertices[98],vertices[91],vertices[50]); + cells[187]->set_neighbors(cells[696],cells[473],cells[448],cells[54]); + set_offsets(cells[187],2,2,0,2); + cells[188]->set_vertices(vertices[7],vertices[8],vertices[48],vertices[56]); + cells[188]->set_neighbors(cells[335],cells[230],cells[112],cells[10]); + set_offsets(cells[188],0,1,1,1); + cells[189]->set_vertices(vertices[62],vertices[14],vertices[7],vertices[15]); + cells[189]->set_neighbors(cells[1495],cells[66],cells[18],cells[171]); + set_offsets(cells[189],0,0,0,0); + cells[190]->set_vertices(vertices[1],vertices[10],vertices[50],vertices[58]); + cells[190]->set_neighbors(cells[306],cells[49],cells[39],cells[53]); + set_offsets(cells[190],0,0,0,0); + cells[191]->set_vertices(vertices[117],vertices[164],vertices[157],vertices[109]); + cells[191]->set_neighbors(cells[647],cells[268],cells[642],cells[1018]); + set_offsets(cells[191],0,0,0,0); + cells[192]->set_vertices(vertices[5],vertices[62],vertices[53],vertices[13]); + cells[192]->set_neighbors(cells[296],cells[113],cells[278],cells[207]); + set_offsets(cells[192],0,0,0,0); + cells[193]->set_vertices(vertices[108],vertices[116],vertices[68],vertices[61]); + cells[193]->set_neighbors(cells[45],cells[479],cells[700],cells[6]); + set_offsets(cells[193],0,0,0,0); + cells[194]->set_vertices(vertices[181],vertices[173],vertices[230],vertices[182]); + cells[194]->set_neighbors(cells[244],cells[1165],cells[986],cells[1109]); + set_offsets(cells[194],0,0,0,0); + cells[195]->set_vertices(vertices[23],vertices[24],vertices[64],vertices[72]); + cells[195]->set_neighbors(cells[33],cells[203],cells[2],cells[297]); + set_offsets(cells[195],0,1,1,1); + cells[196]->set_vertices(vertices[127],vertices[174],vertices[119],vertices[126]); + cells[196]->set_neighbors(cells[785],cells[759],cells[710],cells[869]); + set_offsets(cells[196],0,0,0,0); + cells[197]->set_vertices(vertices[6],vertices[245],vertices[246],vertices[254]); + cells[197]->set_neighbors(cells[1026],cells[1485],cells[1466],cells[1056]); + set_offsets(cells[197],4,0,0,0); + cells[198]->set_vertices(vertices[81],vertices[90],vertices[89],vertices[41]); + cells[198]->set_neighbors(cells[399],cells[378],cells[560],cells[789]); + set_offsets(cells[198],0,0,0,0); + cells[199]->set_vertices(vertices[56],vertices[16],vertices[9],vertices[64]); + cells[199]->set_neighbors(cells[170],cells[420],cells[184],cells[101]); + set_offsets(cells[199],0,0,0,0); + cells[200]->set_vertices(vertices[55],vertices[56],vertices[48],vertices[96]); + cells[200]->set_neighbors(cells[604],cells[576],cells[150],cells[230]); + set_offsets(cells[200],0,1,1,1); + cells[201]->set_vertices(vertices[21],vertices[70],vertices[61],vertices[69]); + cells[201]->set_neighbors(cells[722],cells[488],cells[46],cells[367]); + set_offsets(cells[201],0,0,0,0); + cells[202]->set_vertices(vertices[66],vertices[58],vertices[11],vertices[18]); + cells[202]->set_neighbors(cells[106],cells[423],cells[75],cells[451]); + set_offsets(cells[202],0,0,0,0); + cells[203]->set_vertices(vertices[23],vertices[72],vertices[64],vertices[71]); + cells[203]->set_neighbors(cells[724],cells[169],cells[428],cells[195]); + set_offsets(cells[203],0,1,1,0); + cells[204]->set_vertices(vertices[61],vertices[118],vertices[70],vertices[110]); + cells[204]->set_neighbors(cells[629],cells[677],cells[284],cells[722]); + set_offsets(cells[204],0,0,0,0); + cells[205]->set_vertices(vertices[76],vertices[75],vertices[67],vertices[27]); + cells[205]->set_neighbors(cells[515],cells[283],cells[458],cells[624]); + set_offsets(cells[205],0,0,0,0); + cells[206]->set_vertices(vertices[13],vertices[60],vertices[5],vertices[12]); + cells[206]->set_neighbors(cells[42],cells[1532],cells[319],cells[113]); + set_offsets(cells[206],0,0,0,0); + cells[207]->set_vertices(vertices[5],vertices[54],vertices[53],vertices[62]); + cells[207]->set_neighbors(cells[411],cells[192],cells[321],cells[600]); + set_offsets(cells[207],0,0,0,0); + cells[208]->set_vertices(vertices[210],vertices[153],vertices[202],vertices[162]); + cells[208]->set_neighbors(cells[783],cells[250],cells[158],cells[811]); + set_offsets(cells[208],0,0,0,0); + cells[209]->set_vertices(vertices[63],vertices[64],vertices[56],vertices[104]); + cells[209]->set_neighbors(cells[215],cells[121],cells[726],cells[141]); + set_offsets(cells[209],0,1,1,1); + cells[210]->set_vertices(vertices[108],vertices[59],vertices[99],vertices[51]); + cells[210]->set_neighbors(cells[635],cells[64],cells[7],cells[630]); + set_offsets(cells[210],0,0,0,0); + cells[211]->set_vertices(vertices[83],vertices[92],vertices[91],vertices[43]); + cells[211]->set_neighbors(cells[167],cells[152],cells[493],cells[416]); + set_offsets(cells[211],0,0,0,0); + cells[212]->set_vertices(vertices[57],vertices[106],vertices[105],vertices[114]); + cells[212]->set_neighbors(cells[950],cells[450],cells[679],cells[304]); + set_offsets(cells[212],0,0,0,0); + cells[213]->set_vertices(vertices[64],vertices[72],vertices[17],vertices[65]); + cells[213]->set_neighbors(cells[466],cells[454],cells[180],cells[33]); + set_offsets(cells[213],0,0,0,0); + cells[214]->set_vertices(vertices[266],vertices[258],vertices[18],vertices[259]); + cells[214]->set_neighbors(cells[421],cells[1121],cells[1564],cells[1558]); + set_offsets(cells[214],0,0,4,0); + cells[215]->set_vertices(vertices[104],vertices[64],vertices[56],vertices[57]); + cells[215]->set_neighbors(cells[420],cells[395],cells[509],cells[209]); + set_offsets(cells[215],0,0,0,0); + cells[216]->set_vertices(vertices[168],vertices[161],vertices[208],vertices[216]); + cells[216]->set_neighbors(cells[1273],cells[1312],cells[994],cells[1087]); + set_offsets(cells[216],0,0,0,0); + cells[217]->set_vertices(vertices[268],vertices[260],vertices[20],vertices[261]); + cells[217]->set_neighbors(cells[1188],cells[128],cells[522],cells[1023]); + set_offsets(cells[217],0,0,4,0); + cells[218]->set_vertices(vertices[94],vertices[86],vertices[134],vertices[87]); + cells[218]->set_neighbors(cells[55],cells[850],cells[596],cells[142]); + set_offsets(cells[218],0,0,0,0); + cells[219]->set_vertices(vertices[45],vertices[94],vertices[46],vertices[37]); + cells[219]->set_neighbors(cells[555],cells[1219],cells[573],cells[581]); + set_offsets(cells[219],0,0,0,0); + cells[220]->set_vertices(vertices[84],vertices[76],vertices[36],vertices[27]); + cells[220]->set_neighbors(cells[99],cells[503],cells[458],cells[502]); + set_offsets(cells[220],0,0,0,0); + cells[221]->set_vertices(vertices[3],vertices[60],vertices[51],vertices[11]); + cells[221]->set_neighbors(cells[3],cells[15],cells[105],cells[223]); + set_offsets(cells[221],0,0,0,0); + cells[222]->set_vertices(vertices[14],vertices[253],vertices[262],vertices[22]); + cells[222]->set_neighbors(cells[1411],cells[875],cells[1528],cells[1224]); + set_offsets(cells[222],4,0,0,4); + cells[223]->set_vertices(vertices[3],vertices[52],vertices[51],vertices[60]); + cells[223]->set_neighbors(cells[372],cells[221],cells[120],cells[592]); + set_offsets(cells[223],0,0,0,0); + cells[224]->set_vertices(vertices[117],vertices[109],vertices[166],vertices[118]); + cells[224]->set_neighbors(cells[29],cells[844],cells[580],cells[268]); + set_offsets(cells[224],0,0,0,0); + cells[225]->set_vertices(vertices[118],vertices[110],vertices[111],vertices[63]); + cells[225]->set_neighbors(cells[717],cells[430],cells[629],cells[354]); + set_offsets(cells[225],0,0,0,0); + cells[226]->set_vertices(vertices[242],vertices[194],vertices[233],vertices[282]); + cells[226]->set_neighbors(cells[1617],cells[1679],cells[84],cells[1455]); + set_offsets(cells[226],2,2,0,0); + cells[227]->set_vertices(vertices[112],vertices[57],vertices[104],vertices[105]); + cells[227]->set_neighbors(cells[683],cells[842],cells[510],cells[509]); + set_offsets(cells[227],0,0,0,0); + cells[228]->set_vertices(vertices[120],vertices[80],vertices[72],vertices[73]); + cells[228]->set_neighbors(cells[305],cells[738],cells[735],cells[684]); + set_offsets(cells[228],0,0,0,0); + cells[229]->set_vertices(vertices[0],vertices[240],vertices[241],vertices[248]); + cells[229]->set_neighbors(cells[301],cells[975],cells[1496],cells[1684]); + set_offsets(cells[229],4,0,0,0); + cells[230]->set_vertices(vertices[55],vertices[7],vertices[48],vertices[56]); + cells[230]->set_neighbors(cells[188],cells[200],cells[13],cells[610]); + set_offsets(cells[230],0,0,1,1); + cells[231]->set_vertices(vertices[65],vertices[114],vertices[113],vertices[122]); + cells[231]->set_neighbors(cells[748],cells[618],cells[353],cells[504]); + set_offsets(cells[231],0,0,0,0); + cells[232]->set_vertices(vertices[17],vertices[18],vertices[9],vertices[66]); + cells[232]->set_neighbors(cells[75],cells[36],cells[361],cells[1555]); + set_offsets(cells[232],0,0,0,0); + cells[233]->set_vertices(vertices[171],vertices[163],vertices[220],vertices[172]); + cells[233]->set_neighbors(cells[81],cells[870],cells[917],cells[1322]); + set_offsets(cells[233],0,0,0,0); + cells[234]->set_vertices(vertices[6],vertices[247],vertices[47],vertices[7]); + cells[234]->set_neighbors(cells[1353],cells[103],cells[266],cells[1724]); + set_offsets(cells[234],6,2,4,6); + cells[235]->set_vertices(vertices[88],vertices[40],vertices[41],vertices[0]); + cells[235]->set_neighbors(cells[1686],cells[567],cells[93],cells[507]); + set_offsets(cells[235],0,0,0,2); + cells[236]->set_vertices(vertices[4],vertices[245],vertices[45],vertices[5]); + cells[236]->set_neighbors(cells[1425],cells[276],cells[966],cells[1207]); + set_offsets(cells[236],6,2,4,6); + cells[237]->set_vertices(vertices[244],vertices[4],vertices[44],vertices[283]); + cells[237]->set_neighbors(cells[1364],cells[324],cells[1283],cells[1711]); + set_offsets(cells[237],2,6,4,0); + cells[238]->set_vertices(vertices[237],vertices[196],vertices[236],vertices[189]); + cells[238]->set_neighbors(cells[126],cells[1427],cells[1429],cells[1706]); + set_offsets(cells[238],0,2,0,0); + cells[239]->set_vertices(vertices[13],vertices[60],vertices[20],vertices[68]); + cells[239]->set_neighbors(cells[11],cells[434],cells[274],cells[319]); + set_offsets(cells[239],0,0,0,0); + cells[240]->set_vertices(vertices[65],vertices[66],vertices[114],vertices[74]); + cells[240]->set_neighbors(cells[63],cells[353],cells[486],cells[257]); + set_offsets(cells[240],0,0,0,0); + cells[241]->set_vertices(vertices[159],vertices[152],vertices[111],vertices[151]); + cells[241]->set_neighbors(cells[898],cells[585],cells[941],cells[767]); + set_offsets(cells[241],0,1,0,0); + cells[242]->set_vertices(vertices[25],vertices[26],vertices[17],vertices[74]); + cells[242]->set_neighbors(cells[485],cells[90],cells[30],cells[1612]); + set_offsets(cells[242],0,0,0,0); + cells[243]->set_vertices(vertices[13],vertices[21],vertices[61],vertices[68]); + cells[243]->set_neighbors(cells[488],cells[274],cells[434],cells[367]); + set_offsets(cells[243],0,0,0,0); + cells[244]->set_vertices(vertices[230],vertices[173],vertices[222],vertices[182]); + cells[244]->set_neighbors(cells[1071],cells[1357],cells[194],cells[1116]); + set_offsets(cells[244],0,0,0,0); + cells[245]->set_vertices(vertices[234],vertices[146],vertices[186],vertices[187]); + cells[245]->set_neighbors(cells[1138],cells[1171],cells[1115],cells[65]); + set_offsets(cells[245],0,2,0,0); + cells[246]->set_vertices(vertices[173],vertices[165],vertices[222],vertices[174]); + cells[246]->set_neighbors(cells[256],cells[1071],cells[540],cells[1060]); + set_offsets(cells[246],0,0,0,0); + cells[247]->set_vertices(vertices[60],vertices[61],vertices[53],vertices[108]); + cells[247]->set_neighbors(cells[51],cells[438],cells[479],cells[61]); + set_offsets(cells[247],0,0,0,0); + cells[248]->set_vertices(vertices[218],vertices[161],vertices[210],vertices[170]); + cells[248]->set_neighbors(cells[1008],cells[1289],cells[165],cells[979]); + set_offsets(cells[248],0,0,0,0); + cells[249]->set_vertices(vertices[3],vertices[58],vertices[51],vertices[50]); + cells[249]->set_neighbors(cells[448],cells[473],cells[306],cells[15]); + set_offsets(cells[249],0,0,0,0); + cells[250]->set_vertices(vertices[210],vertices[202],vertices[155],vertices[162]); + cells[250]->set_neighbors(cells[1179],cells[1010],cells[208],cells[1236]); + set_offsets(cells[250],0,0,0,0); + cells[251]->set_vertices(vertices[31],vertices[39],vertices[80],vertices[79]); + cells[251]->set_neighbors(cells[577],cells[38],cells[387],cells[495]); + set_offsets(cells[251],0,0,1,0); + cells[252]->set_vertices(vertices[282],vertices[235],vertices[234],vertices[227]); + cells[252]->set_neighbors(cells[1418],cells[1650],cells[1452],cells[1694]); + set_offsets(cells[252],0,0,0,0); + cells[253]->set_vertices(vertices[158],vertices[150],vertices[103],vertices[110]); + cells[253]->set_neighbors(cells[932],cells[702],cells[740],cells[670]); + set_offsets(cells[253],0,0,0,0); + cells[254]->set_vertices(vertices[176],vertices[169],vertices[216],vertices[224]); + cells[254]->set_neighbors(cells[1320],cells[1360],cells[1358],cells[16]); + set_offsets(cells[254],0,0,0,0); + cells[255]->set_vertices(vertices[94],vertices[54],vertices[93],vertices[45]); + cells[255]->set_neighbors(cells[574],cells[532],cells[175],cells[881]); + set_offsets(cells[255],0,2,0,0); + cells[256]->set_vertices(vertices[222],vertices[165],vertices[214],vertices[174]); + cells[256]->set_neighbors(cells[918],cells[1311],cells[246],cells[1338]); + set_offsets(cells[256],0,0,0,0); + cells[257]->set_vertices(vertices[57],vertices[66],vertices[114],vertices[65]); + cells[257]->set_neighbors(cells[240],cells[450],cells[338],cells[679]); + set_offsets(cells[257],0,0,0,0); + cells[258]->set_vertices(vertices[116],vertices[76],vertices[68],vertices[69]); + cells[258]->set_neighbors(cells[22],cells[45],cells[375],cells[181]); + set_offsets(cells[258],0,0,0,0); + cells[259]->set_vertices(vertices[228],vertices[171],vertices[220],vertices[180]); + cells[259]->set_neighbors(cells[870],cells[1345],cells[261],cells[962]); + set_offsets(cells[259],0,0,0,0); + cells[260]->set_vertices(vertices[58],vertices[106],vertices[98],vertices[49]); + cells[260]->set_neighbors(cells[483],cells[320],cells[431],cells[312]); + set_offsets(cells[260],0,0,0,0); + cells[261]->set_vertices(vertices[179],vertices[171],vertices[228],vertices[180]); + cells[261]->set_neighbors(cells[259],cells[925],cells[1095],cells[1122]); + set_offsets(cells[261],0,0,0,0); + cells[262]->set_vertices(vertices[268],vertices[220],vertices[260],vertices[213]); + cells[262]->set_neighbors(cells[1284],cells[522],cells[1381],cells[1365]); + set_offsets(cells[262],0,0,0,0); + cells[263]->set_vertices(vertices[66],vertices[58],vertices[9],vertices[57]); + cells[263]->set_neighbors(cells[177],cells[36],cells[17],cells[75]); + set_offsets(cells[263],0,0,0,0); + cells[264]->set_vertices(vertices[270],vertices[262],vertices[22],vertices[263]); + cells[264]->set_neighbors(cells[1025],cells[1202],cells[779],cells[1533]); + set_offsets(cells[264],0,0,4,0); + cells[265]->set_vertices(vertices[212],vertices[204],vertices[205],vertices[157]); + cells[265]->set_neighbors(cells[443],cells[1255],cells[1258],cells[1243]); + set_offsets(cells[265],0,0,0,0); + cells[266]->set_vertices(vertices[6],vertices[14],vertices[247],vertices[7]); + cells[266]->set_neighbors(cells[708],cells[234],cells[8],cells[1239]); + set_offsets(cells[266],4,4,0,4); + cells[267]->set_vertices(vertices[275],vertices[44],vertices[36],vertices[35]); + cells[267]->set_neighbors(cells[538],cells[1424],cells[1666],cells[1705]); + set_offsets(cells[267],0,4,4,4); + cells[268]->set_vertices(vertices[117],vertices[109],vertices[157],vertices[166]); + cells[268]->set_neighbors(cells[182],cells[980],cells[224],cells[191]); + set_offsets(cells[268],0,0,0,0); + cells[269]->set_vertices(vertices[227],vertices[236],vertices[179],vertices[228]); + cells[269]->set_neighbors(cells[133],cells[1201],cells[1362],cells[1200]); + set_offsets(cells[269],0,0,0,0); + cells[270]->set_vertices(vertices[64],vertices[17],vertices[9],vertices[57]); + cells[270]->set_neighbors(cells[36],cells[420],cells[454],cells[170]); + set_offsets(cells[270],0,0,0,0); + cells[271]->set_vertices(vertices[28],vertices[20],vertices[19],vertices[68]); + cells[271]->set_neighbors(cells[144],cells[86],cells[104],cells[1467]); + set_offsets(cells[271],0,0,0,0); + cells[272]->set_vertices(vertices[120],vertices[65],vertices[112],vertices[113]); + cells[272]->set_neighbors(cells[729],cells[949],cells[19],cells[456]); + set_offsets(cells[272],0,0,0,0); + cells[273]->set_vertices(vertices[87],vertices[88],vertices[128],vertices[136]); + cells[273]->set_neighbors(cells[425],cells[174],cells[806],cells[745]); + set_offsets(cells[273],0,1,1,1); + cells[274]->set_vertices(vertices[13],vertices[68],vertices[61],vertices[60]); + cells[274]->set_neighbors(cells[479],cells[61],cells[239],cells[243]); + set_offsets(cells[274],0,0,0,0); + cells[275]->set_vertices(vertices[86],vertices[37],vertices[38],vertices[46]); + cells[275]->set_neighbors(cells[1474],cells[315],cells[555],cells[553]); + set_offsets(cells[275],0,0,0,0); + cells[276]->set_vertices(vertices[52],vertices[5],vertices[4],vertices[45]); + cells[276]->set_neighbors(cells[236],cells[476],cells[108],cells[337]); + set_offsets(cells[276],2,2,2,0); + cells[277]->set_vertices(vertices[225],vertices[217],vertices[224],vertices[272]); + cells[277]->set_neighbors(cells[1315],cells[1598],cells[1646],cells[1174]); + set_offsets(cells[277],0,0,0,0); + cells[278]->set_vertices(vertices[5],vertices[14],vertices[62],vertices[13]); + cells[278]->set_neighbors(cells[79],cells[192],cells[1529],cells[321]); + set_offsets(cells[278],0,0,0,0); + cells[279]->set_vertices(vertices[29],vertices[78],vertices[77],vertices[86]); + cells[279]->set_neighbors(cells[442],cells[518],cells[359],cells[71]); + set_offsets(cells[279],0,0,0,0); + cells[280]->set_vertices(vertices[195],vertices[242],vertices[250],vertices[243]); + cells[280]->set_neighbors(cells[1009],cells[1242],cells[1380],cells[1513]); + set_offsets(cells[280],0,0,0,0); + cells[281]->set_vertices(vertices[53],vertices[110],vertices[101],vertices[61]); + cells[281]->set_neighbors(cells[639],cells[51],cells[676],cells[427]); + set_offsets(cells[281],0,0,0,0); + cells[282]->set_vertices(vertices[114],vertices[106],vertices[107],vertices[59]); + cells[282]->set_neighbors(cells[649],cells[469],cells[429],cells[501]); + set_offsets(cells[282],0,0,0,0); + cells[283]->set_vertices(vertices[27],vertices[76],vertices[19],vertices[67]); + cells[283]->set_neighbors(cells[480],cells[432],cells[205],cells[339]); + set_offsets(cells[283],0,0,0,0); + cells[284]->set_vertices(vertices[61],vertices[118],vertices[110],vertices[109]); + cells[284]->set_neighbors(cells[739],cells[639],cells[547],cells[204]); + set_offsets(cells[284],0,0,0,0); + cells[285]->set_vertices(vertices[26],vertices[27],vertices[19],vertices[74]); + cells[285]->set_neighbors(cells[432],cells[484],cells[186],cells[1515]); + set_offsets(cells[285],0,0,0,0); + cells[286]->set_vertices(vertices[67],vertices[115],vertices[116],vertices[107]); + cells[286]->set_neighbors(cells[802],cells[154],cells[742],cells[663]); + set_offsets(cells[286],0,0,0,0); + cells[287]->set_vertices(vertices[72],vertices[24],vertices[17],vertices[25]); + cells[287]->set_neighbors(cells[1611],cells[466],cells[92],cells[33]); + set_offsets(cells[287],0,0,0,0); + cells[288]->set_vertices(vertices[13],vertices[22],vertices[62],vertices[70]); + cells[288]->set_neighbors(cells[5],cells[383],cells[178],cells[79]); + set_offsets(cells[288],0,0,0,0); + cells[289]->set_vertices(vertices[1],vertices[89],vertices[50],vertices[41]); + cells[289]->set_neighbors(cells[399],cells[328],cells[123],cells[583]); + set_offsets(cells[289],2,0,2,0); + cells[290]->set_vertices(vertices[33],vertices[82],vertices[81],vertices[90]); + cells[290]->set_neighbors(cells[794],cells[560],cells[303],cells[60]); + set_offsets(cells[290],0,0,0,0); + cells[291]->set_vertices(vertices[282],vertices[42],vertices[281],vertices[242]); + cells[291]->set_neighbors(cells[1232],cells[1679],cells[1697],cells[1689]); + set_offsets(cells[291],0,4,0,2); + cells[292]->set_vertices(vertices[69],vertices[78],vertices[70],vertices[118]); + cells[292]->set_neighbors(cells[723],cells[722],cells[640],cells[46]); + set_offsets(cells[292],0,0,0,0); + cells[293]->set_vertices(vertices[82],vertices[35],vertices[83],vertices[90]); + cells[293]->set_neighbors(cells[329],cells[388],cells[118],cells[566]); + set_offsets(cells[293],0,0,0,0); + cells[294]->set_vertices(vertices[118],vertices[71],vertices[70],vertices[63]); + cells[294]->set_neighbors(cells[148],cells[629],cells[430],cells[723]); + set_offsets(cells[294],0,0,0,0); + cells[295]->set_vertices(vertices[1],vertices[8],vertices[48],vertices[0]); + cells[295]->set_neighbors(cells[10],cells[1],cells[1101],cells[335]); + set_offsets(cells[295],0,0,0,0); + cells[296]->set_vertices(vertices[13],vertices[62],vertices[53],vertices[61]); + cells[296]->set_neighbors(cells[676],cells[61],cells[383],cells[192]); + set_offsets(cells[296],0,0,0,0); + cells[297]->set_vertices(vertices[23],vertices[16],vertices[64],vertices[24]); + cells[297]->set_neighbors(cells[87],cells[195],cells[939],cells[453]); + set_offsets(cells[297],0,1,1,1); + cells[298]->set_vertices(vertices[68],vertices[60],vertices[11],vertices[59]); + cells[298]->set_neighbors(cells[3],cells[433],cells[498],cells[11]); + set_offsets(cells[298],0,0,0,0); + cells[299]->set_vertices(vertices[136],vertices[89],vertices[81],vertices[129]); + cells[299]->set_neighbors(cells[381],cells[357],cells[815],cells[765]); + set_offsets(cells[299],0,0,0,0); + cells[300]->set_vertices(vertices[76],vertices[29],vertices[21],vertices[69]); + cells[300]->set_neighbors(cells[452],cells[22],cells[528],cells[439]); + set_offsets(cells[300],0,0,0,0); + cells[301]->set_vertices(vertices[240],vertices[193],vertices[241],vertices[248]); + cells[301]->set_neighbors(cells[34],cells[229],cells[1432],cells[1683]); + set_offsets(cells[301],0,0,0,0); + cells[302]->set_vertices(vertices[35],vertices[84],vertices[83],vertices[92]); + cells[302]->set_neighbors(cells[800],cells[493],cells[143],cells[537]); + set_offsets(cells[302],0,0,0,0); + cells[303]->set_vertices(vertices[90],vertices[82],vertices[42],vertices[33]); + cells[303]->set_neighbors(cells[449],cells[102],cells[290],cells[118]); + set_offsets(cells[303],0,0,0,0); + cells[304]->set_vertices(vertices[57],vertices[106],vertices[97],vertices[105]); + cells[304]->set_neighbors(cells[366],cells[683],cells[212],cells[352]); + set_offsets(cells[304],0,0,0,0); + cells[305]->set_vertices(vertices[72],vertices[80],vertices[25],vertices[73]); + cells[305]->set_neighbors(cells[467],cells[505],cells[228],cells[437]); + set_offsets(cells[305],0,0,0,0); + cells[306]->set_vertices(vertices[10],vertices[58],vertices[3],vertices[50]); + cells[306]->set_neighbors(cells[249],cells[72],cells[190],cells[185]); + set_offsets(cells[306],0,0,0,0); + cells[307]->set_vertices(vertices[227],vertices[234],vertices[179],vertices[187]); + cells[307]->set_neighbors(cells[1171],cells[1200],cells[1418],cells[1368]); + set_offsets(cells[307],0,0,0,0); + cells[308]->set_vertices(vertices[164],vertices[156],vertices[109],vertices[116]); + cells[308]->set_neighbors(cells[751],cells[642],cells[761],cells[647]); + set_offsets(cells[308],0,0,0,0); + cells[309]->set_vertices(vertices[147],vertices[196],vertices[195],vertices[204]); + cells[309]->set_neighbors(cells[952],cells[1012],cells[976],cells[1376]); + set_offsets(cells[309],0,0,0,0); + cells[310]->set_vertices(vertices[35],vertices[27],vertices[34],vertices[82]); + cells[310]->set_neighbors(cells[482],cells[497],cells[514],cells[1660]); + set_offsets(cells[310],0,0,0,0); + cells[311]->set_vertices(vertices[77],vertices[85],vertices[86],vertices[134]); + cells[311]->set_neighbors(cells[142],cells[777],cells[462],cells[496]); + set_offsets(cells[311],0,0,0,0); + cells[312]->set_vertices(vertices[98],vertices[58],vertices[51],vertices[106]); + cells[312]->set_neighbors(cells[681],cells[511],cells[260],cells[448]); + set_offsets(cells[312],0,0,0,0); + cells[313]->set_vertices(vertices[90],vertices[35],vertices[43],vertices[42]); + cells[313]->set_neighbors(cells[1139],cells[477],cells[118],cells[329]); + set_offsets(cells[313],0,0,0,0); + cells[314]->set_vertices(vertices[15],vertices[63],vertices[56],vertices[55]); + cells[314]->set_neighbors(cells[121],cells[13],cells[21],cells[141]); + set_offsets(cells[314],0,0,1,0); + cells[315]->set_vertices(vertices[39],vertices[86],vertices[38],vertices[46]); + cells[315]->set_neighbors(cells[275],cells[1671],cells[500],cells[552]); + set_offsets(cells[315],0,0,0,0); + cells[316]->set_vertices(vertices[184],vertices[96],vertices[143],vertices[136]); + cells[316]->set_neighbors(cells[671],cells[816],cells[685],cells[1120]); + set_offsets(cells[316],1,3,0,1); + cells[317]->set_vertices(vertices[69],vertices[116],vertices[109],vertices[61]); + cells[317]->set_neighbors(cells[700],cells[547],cells[45],cells[752]); + set_offsets(cells[317],0,0,0,0); + cells[318]->set_vertices(vertices[66],vertices[11],vertices[59],vertices[19]); + cells[318]->set_neighbors(cells[433],cells[470],cells[423],cells[451]); + set_offsets(cells[318],0,0,0,0); + cells[319]->set_vertices(vertices[20],vertices[12],vertices[60],vertices[13]); + cells[319]->set_neighbors(cells[206],cells[239],cells[1279],cells[179]); + set_offsets(cells[319],0,0,0,0); + cells[320]->set_vertices(vertices[50],vertices[58],vertices[98],vertices[49]); + cells[320]->set_neighbors(cells[260],cells[631],cells[49],cells[448]); + set_offsets(cells[320],0,0,0,0); + cells[321]->set_vertices(vertices[5],vertices[14],vertices[54],vertices[62]); + cells[321]->set_neighbors(cells[171],cells[207],cells[278],cells[62]); + set_offsets(cells[321],0,0,0,0); + cells[322]->set_vertices(vertices[277],vertices[269],vertices[38],vertices[278]); + cells[322]->set_neighbors(cells[346],cells[1719],cells[1472],cells[1181]); + set_offsets(cells[322],0,0,4,0); + cells[323]->set_vertices(vertices[191],vertices[238],vertices[231],vertices[183]); + cells[323]->set_neighbors(cells[972],cells[1401],cells[325],cells[1434]); + set_offsets(cells[323],0,0,0,0); + cells[324]->set_vertices(vertices[284],vertices[244],vertices[44],vertices[283]); + cells[324]->set_neighbors(cells[237],cells[1623],cells[1701],cells[1709]); + set_offsets(cells[324],0,2,4,0); + cells[325]->set_vertices(vertices[183],vertices[191],vertices[238],vertices[190]); + cells[325]->set_neighbors(cells[973],cells[419],cells[1155],cells[323]); + set_offsets(cells[325],0,0,0,0); + cells[326]->set_vertices(vertices[227],vertices[219],vertices[276],vertices[228]); + cells[326]->set_neighbors(cells[1374],cells[1362],cells[1201],cells[1625]); + set_offsets(cells[326],0,0,0,0); + cells[327]->set_vertices(vertices[228],vertices[236],vertices[188],vertices[181]); + cells[327]->set_neighbors(cells[1114],cells[1325],cells[1184],cells[133]); + set_offsets(cells[327],0,0,0,0); + cells[328]->set_vertices(vertices[1],vertices[50],vertices[2],vertices[41]); + cells[328]->set_neighbors(cells[564],cells[1317],cells[289],cells[53]); + set_offsets(cells[328],2,2,2,0); + cells[329]->set_vertices(vertices[90],vertices[35],vertices[83],vertices[43]); + cells[329]->set_neighbors(cells[493],cells[152],cells[313],cells[293]); + set_offsets(cells[329],0,0,0,0); + cells[330]->set_vertices(vertices[103],vertices[55],vertices[104],vertices[63]); + cells[330]->set_neighbors(cells[121],cells[698],cells[699],cells[132]); + set_offsets(cells[330],0,0,1,0); + cells[331]->set_vertices(vertices[3],vertices[52],vertices[4],vertices[43]); + cells[331]->set_neighbors(cells[525],cells[890],cells[563],cells[31]); + set_offsets(cells[331],2,2,2,0); + cells[332]->set_vertices(vertices[141],vertices[148],vertices[188],vertices[100]); + cells[332]->set_neighbors(cells[1135],cells[1113],cells[707],cells[116]); + set_offsets(cells[332],0,2,0,2); + cells[333]->set_vertices(vertices[146],vertices[106],vertices[154],vertices[97]); + cells[333]->set_neighbors(cells[366],cells[457],cells[626],cells[754]); + set_offsets(cells[333],0,0,0,0); + cells[334]->set_vertices(vertices[70],vertices[30],vertices[23],vertices[78]); + cells[334]->set_neighbors(cells[405],cells[355],cells[380],cells[396]); + set_offsets(cells[334],0,0,0,0); + cells[335]->set_vertices(vertices[48],vertices[8],vertices[1],vertices[56]); + cells[335]->set_neighbors(cells[336],cells[97],cells[188],cells[295]); + set_offsets(cells[335],0,0,0,0); + cells[336]->set_vertices(vertices[56],vertices[8],vertices[1],vertices[9]); + cells[336]->set_neighbors(cells[1506],cells[131],cells[101],cells[335]); + set_offsets(cells[336],0,0,0,0); + cells[337]->set_vertices(vertices[52],vertices[4],vertices[5],vertices[12]); + cells[337]->set_neighbors(cells[966],cells[42],cells[31],cells[276]); + set_offsets(cells[337],0,0,0,0); + cells[338]->set_vertices(vertices[65],vertices[17],vertices[57],vertices[66]); + cells[338]->set_neighbors(cells[36],cells[257],cells[486],cells[454]); + set_offsets(cells[338],0,0,0,0); + cells[339]->set_vertices(vertices[27],vertices[28],vertices[19],vertices[76]); + cells[339]->set_neighbors(cells[86],cells[283],cells[99],cells[1195]); + set_offsets(cells[339],0,0,0,0); + cells[340]->set_vertices(vertices[138],vertices[91],vertices[83],vertices[131]); + cells[340]->set_neighbors(cells[835],cells[829],cells[376],cells[820]); + set_offsets(cells[340],0,0,0,0); + cells[341]->set_vertices(vertices[62],vertices[70],vertices[15],vertices[63]); + cells[341]->set_neighbors(cells[122],cells[21],cells[373],cells[5]); + set_offsets(cells[341],0,0,0,0); + cells[342]->set_vertices(vertices[250],vertices[241],vertices[201],vertices[249]); + cells[342]->set_neighbors(cells[1509],cells[1562],cells[1422],cells[1502]); + set_offsets(cells[342],0,0,0,0); + cells[343]->set_vertices(vertices[244],vertices[197],vertices[285],vertices[245]); + cells[343]->set_neighbors(cells[1669],cells[1630],cells[1522],cells[1712]); + set_offsets(cells[343],2,2,0,2); + cells[344]->set_vertices(vertices[282],vertices[233],vertices[225],vertices[234]); + cells[344]->set_neighbors(cells[1415],cells[1100],cells[1617],cells[1693]); + set_offsets(cells[344],0,0,0,0); + cells[345]->set_vertices(vertices[239],vertices[151],vertices[191],vertices[192]); + cells[345]->set_neighbors(cells[909],cells[613],cells[1355],cells[1436]); + set_offsets(cells[345],0,2,0,3); + cells[346]->set_vertices(vertices[38],vertices[269],vertices[30],vertices[278]); + cells[346]->set_neighbors(cells[911],cells[1581],cells[322],cells[1583]); + set_offsets(cells[346],4,0,4,0); + cells[347]->set_vertices(vertices[237],vertices[189],vertices[229],vertices[238]); + cells[347]->set_neighbors(cells[1163],cells[1627],cells[1363],cells[1427]); + set_offsets(cells[347],0,0,0,0); + cells[348]->set_vertices(vertices[230],vertices[190],vertices[238],vertices[181]); + cells[348]->set_neighbors(cells[921],cells[1168],cells[1165],cells[419]); + set_offsets(cells[348],0,0,0,0); + cells[349]->set_vertices(vertices[140],vertices[91],vertices[92],vertices[52]); + cells[349]->set_neighbors(cells[167],cells[50],cells[492],cells[416]); + set_offsets(cells[349],0,0,0,2); + cells[350]->set_vertices(vertices[96],vertices[136],vertices[89],vertices[48]); + cells[350]->set_neighbors(cells[787],cells[111],cells[839],cells[857]); + set_offsets(cells[350],2,0,0,2); + cells[351]->set_vertices(vertices[142],vertices[54],vertices[94],vertices[95]); + cells[351]->set_neighbors(cells[605],cells[849],cells[675],cells[881]); + set_offsets(cells[351],0,2,0,0); + cells[352]->set_vertices(vertices[106],vertices[57],vertices[97],vertices[49]); + cells[352]->set_neighbors(cells[588],cells[483],cells[431],cells[304]); + set_offsets(cells[352],0,0,0,0); + cells[353]->set_vertices(vertices[65],vertices[74],vertices[114],vertices[122]); + cells[353]->set_neighbors(cells[397],cells[231],cells[616],cells[240]); + set_offsets(cells[353],0,0,0,0); + cells[354]->set_vertices(vertices[118],vertices[158],vertices[111],vertices[110]); + cells[354]->set_neighbors(cells[702],cells[225],cells[739],cells[690]); + set_offsets(cells[354],0,0,0,0); + cells[355]->set_vertices(vertices[70],vertices[78],vertices[23],vertices[71]); + cells[355]->set_neighbors(cells[356],cells[148],cells[723],cells[334]); + set_offsets(cells[355],0,0,0,0); + cells[356]->set_vertices(vertices[78],vertices[31],vertices[23],vertices[71]); + cells[356]->set_neighbors(cells[428],cells[355],cells[393],cells[405]); + set_offsets(cells[356],0,0,0,0); + cells[357]->set_vertices(vertices[128],vertices[136],vertices[81],vertices[129]); + cells[357]->set_neighbors(cells[299],cells[617],cells[1073],cells[425]); + set_offsets(cells[357],0,0,0,0); + cells[358]->set_vertices(vertices[74],vertices[73],vertices[65],vertices[25]); + cells[358]->set_neighbors(cells[505],cells[90],cells[377],cells[616]); + set_offsets(cells[358],0,0,0,0); + cells[359]->set_vertices(vertices[29],vertices[38],vertices[78],vertices[86]); + cells[359]->set_neighbors(cells[551],cells[279],cells[553],cells[26]); + set_offsets(cells[359],0,0,0,0); + cells[360]->set_vertices(vertices[119],vertices[160],vertices[111],vertices[159]); + cells[360]->set_neighbors(cells[767],cells[750],cells[1036],cells[762]); + set_offsets(cells[360],0,1,0,0); + cells[361]->set_vertices(vertices[26],vertices[18],vertices[17],vertices[66]); + cells[361]->set_neighbors(cells[232],cells[485],cells[370],cells[559]); + set_offsets(cells[361],0,0,0,0); + cells[362]->set_vertices(vertices[118],vertices[126],vertices[78],vertices[71]); + cells[362]->set_neighbors(cells[544],cells[723],cells[755],cells[640]); + set_offsets(cells[362],0,0,0,0); + cells[363]->set_vertices(vertices[47],vertices[88],vertices[48],vertices[0]); + cells[363]->set_neighbors(cells[567],cells[27],cells[93],cells[608]); + set_offsets(cells[363],0,1,3,3); + cells[364]->set_vertices(vertices[211],vertices[210],vertices[203],vertices[163]); + cells[364]->set_neighbors(cells[968],cells[905],cells[1282],cells[1048]); + set_offsets(cells[364],0,0,0,0); + cells[365]->set_vertices(vertices[132],vertices[84],vertices[124],vertices[77]); + cells[365]->set_neighbors(cells[545],cells[472],cells[579],cells[89]); + set_offsets(cells[365],0,0,0,0); + cells[366]->set_vertices(vertices[154],vertices[106],vertices[105],vertices[97]); + cells[366]->set_neighbors(cells[304],cells[557],cells[333],cells[950]); + set_offsets(cells[366],0,0,0,0); + cells[367]->set_vertices(vertices[13],vertices[70],vertices[61],vertices[21]); + cells[367]->set_neighbors(cells[201],cells[243],cells[178],cells[383]); + set_offsets(cells[367],0,0,0,0); + cells[368]->set_vertices(vertices[44],vertices[37],vertices[36],vertices[84]); + cells[368]->set_neighbors(cells[119],cells[538],cells[524],cells[1193]); + set_offsets(cells[368],0,0,0,0); + cells[369]->set_vertices(vertices[132],vertices[140],vertices[83],vertices[92]); + cells[369]->set_neighbors(cells[416],cells[800],cells[871],cells[743]); + set_offsets(cells[369],0,0,0,0); + cells[370]->set_vertices(vertices[26],vertices[18],vertices[66],vertices[19]); + cells[370]->set_neighbors(cells[423],cells[484],cells[1569],cells[361]); + set_offsets(cells[370],0,0,0,0); + cells[371]->set_vertices(vertices[102],vertices[54],vertices[55],vertices[62]); + cells[371]->set_neighbors(cells[114],cells[23],cells[411],cells[669]); + set_offsets(cells[371],0,0,0,0); + cells[372]->set_vertices(vertices[52],vertices[60],vertices[100],vertices[51]); + cells[372]->set_neighbors(cells[658],cells[162],cells[223],cells[650]); + set_offsets(cells[372],0,0,0,0); + cells[373]->set_vertices(vertices[110],vertices[70],vertices[62],vertices[63]); + cells[373]->set_neighbors(cells[341],cells[487],cells[629],cells[677]); + set_offsets(cells[373],0,0,0,0); + cells[374]->set_vertices(vertices[50],vertices[3],vertices[2],vertices[43]); + cells[374]->set_neighbors(cells[1228],cells[536],cells[519],cells[72]); + set_offsets(cells[374],2,2,2,0); + cells[375]->set_vertices(vertices[116],vertices[76],vertices[69],vertices[124]); + cells[375]->set_neighbors(cells[666],cells[410],cells[619],cells[258]); + set_offsets(cells[375],0,0,0,0); + cells[376]->set_vertices(vertices[139],vertices[91],vertices[138],vertices[131]); + cells[376]->set_neighbors(cells[340],cells[1126],cells[836],cells[147]); + set_offsets(cells[376],0,0,0,0); + cells[377]->set_vertices(vertices[82],vertices[73],vertices[74],vertices[25]); + cells[377]->set_neighbors(cells[358],cells[520],cells[465],cells[491]); + set_offsets(cells[377],0,0,0,0); + cells[378]->set_vertices(vertices[89],vertices[88],vertices[81],vertices[41]); + cells[378]->set_neighbors(cells[403],cells[198],cells[70],cells[765]); + set_offsets(cells[378],0,0,0,0); + cells[379]->set_vertices(vertices[75],vertices[122],vertices[115],vertices[67]); + cells[379]->set_neighbors(cells[20],cells[494],cells[644],cells[474]); + set_offsets(cells[379],0,0,0,0); + cells[380]->set_vertices(vertices[21],vertices[30],vertices[70],vertices[78]); + cells[380]->set_neighbors(cells[334],cells[46],cells[404],cells[406]); + set_offsets(cells[380],0,0,0,0); + cells[381]->set_vertices(vertices[138],vertices[89],vertices[129],vertices[81]); + cells[381]->set_neighbors(cells[299],cells[78],cells[789],cells[161]); + set_offsets(cells[381],0,0,0,0); + cells[382]->set_vertices(vertices[100],vertices[53],vertices[101],vertices[108]); + cells[382]->set_neighbors(cells[51],cells[734],cells[438],cells[887]); + set_offsets(cells[382],0,0,0,0); + cells[383]->set_vertices(vertices[13],vertices[62],vertices[61],vertices[70]); + cells[383]->set_neighbors(cells[677],cells[367],cells[288],cells[296]); + set_offsets(cells[383],0,0,0,0); + cells[384]->set_vertices(vertices[94],vertices[39],vertices[47],vertices[46]); + cells[384]->set_neighbors(cells[1021],cells[582],cells[500],cells[530]); + set_offsets(cells[384],0,0,0,0); + cells[385]->set_vertices(vertices[15],vertices[8],vertices[56],vertices[16]); + cells[385]->set_neighbors(cells[101],cells[184],cells[587],cells[112]); + set_offsets(cells[385],0,1,1,1); + cells[386]->set_vertices(vertices[59],vertices[19],vertices[68],vertices[67]); + cells[386]->set_neighbors(cells[480],cells[549],cells[470],cells[433]); + set_offsets(cells[386],0,0,0,0); + cells[387]->set_vertices(vertices[86],vertices[39],vertices[31],vertices[79]); + cells[387]->set_neighbors(cells[251],cells[435],cells[578],cells[552]); + set_offsets(cells[387],0,0,0,0); + cells[388]->set_vertices(vertices[90],vertices[82],vertices[130],vertices[83]); + cells[388]->set_neighbors(cells[68],cells[776],cells[293],cells[794]); + set_offsets(cells[388],0,0,0,0); + cells[389]->set_vertices(vertices[142],vertices[85],vertices[133],vertices[134]); + cells[389]->set_neighbors(cells[109],cells[1105],cells[880],cells[834]); + set_offsets(cells[389],0,0,0,0); + cells[390]->set_vertices(vertices[148],vertices[101],vertices[141],vertices[189]); + cells[390]->set_neighbors(cells[1104],cells[116],cells[1146],cells[707]); + set_offsets(cells[390],2,2,0,0); + cells[391]->set_vertices(vertices[211],vertices[258],vertices[251],vertices[203]); + cells[391]->set_neighbors(cells[1549],cells[1252],cells[1048],cells[1520]); + set_offsets(cells[391],0,0,0,0); + cells[392]->set_vertices(vertices[31],vertices[30],vertices[23],vertices[271]); + cells[392]->set_neighbors(cells[1593],cells[1261],cells[1395],cells[405]); + set_offsets(cells[392],4,4,4,0); + cells[393]->set_vertices(vertices[78],vertices[79],vertices[31],vertices[71]); + cells[393]->set_neighbors(cells[401],cells[356],cells[544],cells[435]); + set_offsets(cells[393],0,0,0,0); + cells[394]->set_vertices(vertices[81],vertices[73],vertices[128],vertices[121]); + cells[394]->set_neighbors(cells[659],cells[617],cells[764],cells[774]); + set_offsets(cells[394],0,0,0,0); + cells[395]->set_vertices(vertices[104],vertices[49],vertices[57],vertices[56]); + cells[395]->set_neighbors(cells[412],cells[215],cells[637],cells[588]); + set_offsets(cells[395],0,0,0,0); + cells[396]->set_vertices(vertices[70],vertices[22],vertices[23],vertices[30]); + cells[396]->set_neighbors(cells[974],cells[334],cells[406],cells[447]); + set_offsets(cells[396],0,0,0,0); + cells[397]->set_vertices(vertices[114],vertices[74],vertices[67],vertices[122]); + cells[397]->set_neighbors(cells[644],cells[20],cells[353],cells[63]); + set_offsets(cells[397],0,0,0,0); + cells[398]->set_vertices(vertices[101],vertices[110],vertices[158],vertices[109]); + cells[398]->set_neighbors(cells[739],cells[691],cells[639],cells[740]); + set_offsets(cells[398],0,0,0,0); + cells[399]->set_vertices(vertices[90],vertices[50],vertices[89],vertices[41]); + cells[399]->set_neighbors(cells[289],cells[198],cells[564],cells[821]); + set_offsets(cells[399],0,2,0,0); + cells[400]->set_vertices(vertices[77],vertices[125],vertices[126],vertices[117]); + cells[400]->set_neighbors(cells[933],cells[655],cells[796],cells[799]); + set_offsets(cells[400],0,0,0,0); + cells[401]->set_vertices(vertices[31],vertices[79],vertices[72],vertices[71]); + cells[401]->set_neighbors(cells[732],cells[428],cells[393],cells[38]); + set_offsets(cells[401],0,0,1,0); + cells[402]->set_vertices(vertices[80],vertices[32],vertices[25],vertices[33]); + cells[402]->set_neighbors(cells[1412],cells[467],cells[160],cells[437]); + set_offsets(cells[402],0,0,0,0); + cells[403]->set_vertices(vertices[88],vertices[33],vertices[81],vertices[41]); + cells[403]->set_neighbors(cells[560],cells[378],cells[507],cells[534]); + set_offsets(cells[403],0,0,0,0); + cells[404]->set_vertices(vertices[21],vertices[30],vertices[78],vertices[29]); + cells[404]->set_neighbors(cells[26],cells[452],cells[1584],cells[380]); + set_offsets(cells[404],0,0,0,0); + cells[405]->set_vertices(vertices[78],vertices[30],vertices[23],vertices[31]); + cells[405]->set_neighbors(cells[392],cells[356],cells[464],cells[334]); + set_offsets(cells[405],0,0,0,0); + cells[406]->set_vertices(vertices[21],vertices[22],vertices[70],vertices[30]); + cells[406]->set_neighbors(cells[396],cells[380],cells[1535],cells[178]); + set_offsets(cells[406],0,0,0,0); + cells[407]->set_vertices(vertices[37],vertices[86],vertices[85],vertices[94]); + cells[407]->set_neighbors(cells[142],cells[573],cells[555],cells[496]); + set_offsets(cells[407],0,0,0,0); + cells[408]->set_vertices(vertices[178],vertices[121],vertices[170],vertices[130]); + cells[408]->set_neighbors(cells[521],cells[1051],cells[1065],cells[634]); + set_offsets(cells[408],0,0,0,0); + cells[409]->set_vertices(vertices[158],vertices[103],vertices[151],vertices[111]); + cells[409]->set_neighbors(cells[898],cells[585],cells[702],cells[670]); + set_offsets(cells[409],0,0,0,0); + cells[410]->set_vertices(vertices[124],vertices[116],vertices[117],vertices[69]); + cells[410]->set_neighbors(cells[752],cells[721],cells[375],cells[693]); + set_offsets(cells[410],0,0,0,0); + cells[411]->set_vertices(vertices[53],vertices[54],vertices[102],vertices[62]); + cells[411]->set_neighbors(cells[371],cells[627],cells[207],cells[668]); + set_offsets(cells[411],0,0,0,0); + cells[412]->set_vertices(vertices[56],vertices[57],vertices[9],vertices[49]); + cells[412]->set_neighbors(cells[177],cells[131],cells[395],cells[420]); + set_offsets(cells[412],0,0,0,0); + cells[413]->set_vertices(vertices[139],vertices[186],vertices[138],vertices[98]); + cells[413]->set_neighbors(cells[688],cells[147],cells[1081],cells[1126]); + set_offsets(cells[413],0,0,0,2); + cells[414]->set_vertices(vertices[134],vertices[86],vertices[126],vertices[79]); + cells[414]->set_neighbors(cells[440],cells[807],cells[55],cells[777]); + set_offsets(cells[414],0,0,0,0); + cells[415]->set_vertices(vertices[113],vertices[105],vertices[162],vertices[114]); + cells[415]->set_neighbors(cells[793],cells[748],cells[504],cells[512]); + set_offsets(cells[415],0,0,0,0); + cells[416]->set_vertices(vertices[140],vertices[91],vertices[83],vertices[92]); + cells[416]->set_neighbors(cells[211],cells[369],cells[349],cells[835]); + set_offsets(cells[416],0,0,0,0); + cells[417]->set_vertices(vertices[148],vertices[101],vertices[149],vertices[156]); + cells[417]->set_neighbors(cells[747],cells[852],cells[471],cells[1146]); + set_offsets(cells[417],0,0,0,0); + cells[418]->set_vertices(vertices[75],vertices[124],vertices[123],vertices[132]); + cells[418]->set_neighbors(cells[572],cells[801],cells[89],cells[548]); + set_offsets(cells[418],0,0,0,0); + cells[419]->set_vertices(vertices[183],vertices[238],vertices[230],vertices[190]); + cells[419]->set_neighbors(cells[348],cells[1164],cells[325],cells[972]); + set_offsets(cells[419],0,0,0,0); + cells[420]->set_vertices(vertices[56],vertices[64],vertices[9],vertices[57]); + cells[420]->set_neighbors(cells[270],cells[412],cells[215],cells[199]); + set_offsets(cells[420],0,0,0,0); + cells[421]->set_vertices(vertices[259],vertices[258],vertices[18],vertices[251]); + cells[421]->set_neighbors(cells[749],cells[1518],cells[1520],cells[214]); + set_offsets(cells[421],0,0,4,0); + cells[422]->set_vertices(vertices[182],vertices[174],vertices[175],vertices[127]); + cells[422]->set_neighbors(cells[1077],cells[1076],cells[780],cells[847]); + set_offsets(cells[422],0,0,0,0); + cells[423]->set_vertices(vertices[19],vertices[66],vertices[11],vertices[18]); + cells[423]->set_neighbors(cells[202],cells[1568],cells[370],cells[318]); + set_offsets(cells[423],0,0,0,0); + cells[424]->set_vertices(vertices[58],vertices[11],vertices[51],vertices[59]); + cells[424]->set_neighbors(cells[3],cells[681],cells[451],cells[15]); + set_offsets(cells[424],0,0,0,0); + cells[425]->set_vertices(vertices[128],vertices[88],vertices[81],vertices[136]); + cells[425]->set_neighbors(cells[765],cells[357],cells[273],cells[773]); + set_offsets(cells[425],0,0,0,0); + cells[426]->set_vertices(vertices[54],vertices[47],vertices[6],vertices[94]); + cells[426]->set_neighbors(cells[582],cells[175],cells[605],cells[103]); + set_offsets(cells[426],2,0,2,0); + cells[427]->set_vertices(vertices[53],vertices[102],vertices[101],vertices[110]); + cells[427]->set_neighbors(cells[831],cells[281],cells[627],cells[888]); + set_offsets(cells[427],0,0,0,0); + cells[428]->set_vertices(vertices[23],vertices[31],vertices[72],vertices[71]); + cells[428]->set_neighbors(cells[401],cells[203],cells[356],cells[2]); + set_offsets(cells[428],0,0,1,0); + cells[429]->set_vertices(vertices[106],vertices[66],vertices[59],vertices[114]); + cells[429]->set_neighbors(cells[82],cells[282],cells[679],cells[96]); + set_offsets(cells[429],0,0,0,0); + cells[430]->set_vertices(vertices[71],vertices[118],vertices[111],vertices[63]); + cells[430]->set_neighbors(cells[225],cells[682],cells[294],cells[716]); + set_offsets(cells[430],0,0,0,0); + cells[431]->set_vertices(vertices[58],vertices[57],vertices[106],vertices[49]); + cells[431]->set_neighbors(cells[352],cells[260],cells[177],cells[17]); + set_offsets(cells[431],0,0,0,0); + cells[432]->set_vertices(vertices[74],vertices[19],vertices[67],vertices[27]); + cells[432]->set_neighbors(cells[283],cells[515],cells[285],cells[32]); + set_offsets(cells[432],0,0,0,0); + cells[433]->set_vertices(vertices[19],vertices[68],vertices[11],vertices[59]); + cells[433]->set_neighbors(cells[298],cells[318],cells[386],cells[144]); + set_offsets(cells[433],0,0,0,0); + cells[434]->set_vertices(vertices[13],vertices[68],vertices[20],vertices[21]); + cells[434]->set_neighbors(cells[104],cells[1573],cells[243],cells[239]); + set_offsets(cells[434],0,0,0,0); + cells[435]->set_vertices(vertices[78],vertices[86],vertices[31],vertices[79]); + cells[435]->set_neighbors(cells[387],cells[393],cells[440],cells[551]); + set_offsets(cells[435],0,0,0,0); + cells[436]->set_vertices(vertices[112],vertices[152],vertices[111],vertices[160]); + cells[436]->set_neighbors(cells[767],cells[762],cells[678],cells[680]); + set_offsets(cells[436],1,1,0,1); + cells[437]->set_vertices(vertices[72],vertices[32],vertices[25],vertices[80]); + cells[437]->set_neighbors(cells[402],cells[305],cells[508],cells[92]); + set_offsets(cells[437],0,0,0,0); + cells[438]->set_vertices(vertices[60],vertices[108],vertices[53],vertices[100]); + cells[438]->set_neighbors(cells[382],cells[650],cells[658],cells[247]); + set_offsets(cells[438],0,0,0,0); + cells[439]->set_vertices(vertices[28],vertices[29],vertices[21],vertices[76]); + cells[439]->set_neighbors(cells[300],cells[481],cells[107],cells[1464]); + set_offsets(cells[439],0,0,0,0); + cells[440]->set_vertices(vertices[126],vertices[86],vertices[78],vertices[79]); + cells[440]->set_neighbors(cells[435],cells[544],cells[414],cells[442]); + set_offsets(cells[440],0,0,0,0); + cells[441]->set_vertices(vertices[163],vertices[155],vertices[203],vertices[212]); + cells[441]->set_neighbors(cells[1281],cells[905],cells[57],cells[968]); + set_offsets(cells[441],0,0,0,0); + cells[442]->set_vertices(vertices[77],vertices[86],vertices[78],vertices[126]); + cells[442]->set_neighbors(cells[440],cells[561],cells[777],cells[279]); + set_offsets(cells[442],0,0,0,0); + cells[443]->set_vertices(vertices[197],vertices[204],vertices[157],vertices[205]); + cells[443]->set_neighbors(cells[265],cells[460],cells[1470],cells[35]); + set_offsets(cells[443],0,0,0,0); + cells[444]->set_vertices(vertices[169],vertices[121],vertices[161],vertices[170]); + cells[444]->set_neighbors(cells[139],cells[165],cells[634],cells[1044]); + set_offsets(cells[444],0,0,0,0); + cells[445]->set_vertices(vertices[129],vertices[137],vertices[184],vertices[136]); + cells[445]->set_neighbors(cells[685],cells[965],cells[815],cells[853]); + set_offsets(cells[445],0,0,0,0); + cells[446]->set_vertices(vertices[79],vertices[126],vertices[119],vertices[71]); + cells[446]->set_neighbors(cells[755],cells[728],cells[544],cells[759]); + set_offsets(cells[446],0,0,0,0); + cells[447]->set_vertices(vertices[70],vertices[22],vertices[15],vertices[23]); + cells[447]->set_neighbors(cells[1525],cells[122],cells[396],cells[5]); + set_offsets(cells[447],0,0,0,0); + cells[448]->set_vertices(vertices[50],vertices[58],vertices[51],vertices[98]); + cells[448]->set_neighbors(cells[312],cells[187],cells[320],cells[249]); + set_offsets(cells[448],0,0,0,0); + cells[449]->set_vertices(vertices[42],vertices[82],vertices[34],vertices[33]); + cells[449]->set_neighbors(cells[74],cells[1438],cells[303],cells[497]); + set_offsets(cells[449],0,0,0,0); + cells[450]->set_vertices(vertices[57],vertices[114],vertices[105],vertices[65]); + cells[450]->set_neighbors(cells[504],cells[510],cells[257],cells[212]); + set_offsets(cells[450],0,0,0,0); + cells[451]->set_vertices(vertices[58],vertices[11],vertices[59],vertices[66]); + cells[451]->set_neighbors(cells[318],cells[96],cells[202],cells[424]); + set_offsets(cells[451],0,0,0,0); + cells[452]->set_vertices(vertices[21],vertices[78],vertices[69],vertices[29]); + cells[452]->set_neighbors(cells[71],cells[300],cells[404],cells[46]); + set_offsets(cells[452],0,0,0,0); + cells[453]->set_vertices(vertices[15],vertices[16],vertices[64],vertices[23]); + cells[453]->set_neighbors(cells[297],cells[135],cells[1235],cells[184]); + set_offsets(cells[453],0,1,1,0); + cells[454]->set_vertices(vertices[64],vertices[65],vertices[17],vertices[57]); + cells[454]->set_neighbors(cells[338],cells[270],cells[569],cells[213]); + set_offsets(cells[454],0,0,0,0); + cells[455]->set_vertices(vertices[151],vertices[192],vertices[200],vertices[152]); + cells[455]->set_neighbors(cells[1079],cells[941],cells[893],cells[1221]); + set_offsets(cells[455],0,1,1,1); + cells[456]->set_vertices(vertices[65],vertices[72],vertices[120],vertices[112]); + cells[456]->set_neighbors(cells[730],cells[272],cells[180],cells[738]); + set_offsets(cells[456],0,0,0,0); + cells[457]->set_vertices(vertices[145],vertices[146],vertices[154],vertices[97]); + cells[457]->set_neighbors(cells[333],cells[557],cells[1091],cells[719]); + set_offsets(cells[457],0,0,0,0); + cells[458]->set_vertices(vertices[84],vertices[75],vertices[76],vertices[27]); + cells[458]->set_neighbors(cells[205],cells[220],cells[565],cells[80]); + set_offsets(cells[458],0,0,0,0); + cells[459]->set_vertices(vertices[125],vertices[172],vertices[117],vertices[124]); + cells[459]->set_neighbors(cells[984],cells[796],cells[928],cells[91]); + set_offsets(cells[459],0,0,0,0); + cells[460]->set_vertices(vertices[205],vertices[157],vertices[197],vertices[206]); + cells[460]->set_neighbors(cells[558],cells[1225],cells[1294],cells[443]); + set_offsets(cells[460],0,0,0,0); + cells[461]->set_vertices(vertices[147],vertices[99],vertices[154],vertices[146]); + cells[461]->set_neighbors(cells[754],cells[922],cells[1136],cells[704]); + set_offsets(cells[461],0,0,0,0); + cells[462]->set_vertices(vertices[77],vertices[85],vertices[134],vertices[125]); + cells[462]->set_neighbors(cells[109],cells[799],cells[795],cells[311]); + set_offsets(cells[462],0,0,0,0); + cells[463]->set_vertices(vertices[174],vertices[117],vertices[166],vertices[126]); + cells[463]->set_neighbors(cells[844],cells[785],cells[933],cells[1042]); + set_offsets(cells[463],0,0,0,0); + cells[464]->set_vertices(vertices[78],vertices[30],vertices[31],vertices[38]); + cells[464]->set_neighbors(cells[1395],cells[551],cells[26],cells[405]); + set_offsets(cells[464],0,0,0,0); + cells[465]->set_vertices(vertices[33],vertices[73],vertices[82],vertices[25]); + cells[465]->set_neighbors(cells[377],cells[74],cells[467],cells[60]); + set_offsets(cells[465],0,0,0,0); + cells[466]->set_vertices(vertices[72],vertices[25],vertices[17],vertices[65]); + cells[466]->set_neighbors(cells[90],cells[213],cells[505],cells[287]); + set_offsets(cells[466],0,0,0,0); + cells[467]->set_vertices(vertices[80],vertices[33],vertices[25],vertices[73]); + cells[467]->set_neighbors(cells[465],cells[305],cells[556],cells[402]); + set_offsets(cells[467],0,0,0,0); + cells[468]->set_vertices(vertices[262],vertices[214],vertices[254],vertices[207]); + cells[468]->set_neighbors(cells[1493],cells[1538],cells[1350],cells[1483]); + set_offsets(cells[468],0,0,0,0); + cells[469]->set_vertices(vertices[67],vertices[114],vertices[107],vertices[59]); + cells[469]->set_neighbors(cells[282],cells[154],cells[82],cells[742]); + set_offsets(cells[469],0,0,0,0); + cells[470]->set_vertices(vertices[66],vertices[19],vertices[59],vertices[67]); + cells[470]->set_neighbors(cells[386],cells[82],cells[32],cells[318]); + set_offsets(cells[470],0,0,0,0); + cells[471]->set_vertices(vertices[156],vertices[148],vertices[101],vertices[108]); + cells[471]->set_neighbors(cells[734],cells[705],cells[720],cells[417]); + set_offsets(cells[471],0,0,0,0); + cells[472]->set_vertices(vertices[132],vertices[124],vertices[125],vertices[77]); + cells[472]->set_neighbors(cells[796],cells[795],cells[365],cells[928]); + set_offsets(cells[472],0,0,0,0); + cells[473]->set_vertices(vertices[3],vertices[51],vertices[91],vertices[50]); + cells[473]->set_neighbors(cells[187],cells[519],cells[249],cells[592]); + set_offsets(cells[473],2,2,0,2); + cells[474]->set_vertices(vertices[123],vertices[122],vertices[115],vertices[75]); + cells[474]->set_neighbors(cells[379],cells[548],cells[594],cells[924]); + set_offsets(cells[474],0,0,0,0); + cells[475]->set_vertices(vertices[112],vertices[104],vertices[63],vertices[111]); + cells[475]->set_neighbors(cells[698],cells[682],cells[680],cells[726]); + set_offsets(cells[475],1,1,0,0); + cells[476]->set_vertices(vertices[52],vertices[45],vertices[4],vertices[92]); + cells[476]->set_neighbors(cells[575],cells[525],cells[597],cells[276]); + set_offsets(cells[476],2,0,2,0); + cells[477]->set_vertices(vertices[90],vertices[43],vertices[2],vertices[42]); + cells[477]->set_neighbors(cells[931],cells[52],cells[313],cells[536]); + set_offsets(cells[477],0,0,2,0); + cells[478]->set_vertices(vertices[108],vertices[116],vertices[107],vertices[59]); + cells[478]->set_neighbors(cells[154],cells[630],cells[6],cells[756]); + set_offsets(cells[478],0,0,0,0); + cells[479]->set_vertices(vertices[60],vertices[68],vertices[61],vertices[108]); + cells[479]->set_neighbors(cells[193],cells[247],cells[498],cells[274]); + set_offsets(cells[479],0,0,0,0); + cells[480]->set_vertices(vertices[76],vertices[68],vertices[19],vertices[67]); + cells[480]->set_neighbors(cells[386],cells[283],cells[181],cells[86]); + set_offsets(cells[480],0,0,0,0); + cells[481]->set_vertices(vertices[28],vertices[76],vertices[21],vertices[68]); + cells[481]->set_neighbors(cells[22],cells[104],cells[86],cells[439]); + set_offsets(cells[481],0,0,0,0); + cells[482]->set_vertices(vertices[82],vertices[27],vertices[34],vertices[74]); + cells[482]->set_neighbors(cells[186],cells[520],cells[40],cells[310]); + set_offsets(cells[482],0,0,0,0); + cells[483]->set_vertices(vertices[98],vertices[106],vertices[97],vertices[49]); + cells[483]->set_neighbors(cells[352],cells[860],cells[260],cells[626]); + set_offsets(cells[483],0,0,0,0); + cells[484]->set_vertices(vertices[26],vertices[74],vertices[19],vertices[66]); + cells[484]->set_neighbors(cells[32],cells[370],cells[485],cells[285]); + set_offsets(cells[484],0,0,0,0); + cells[485]->set_vertices(vertices[74],vertices[26],vertices[17],vertices[66]); + cells[485]->set_neighbors(cells[361],cells[486],cells[484],cells[242]); + set_offsets(cells[485],0,0,0,0); + cells[486]->set_vertices(vertices[74],vertices[66],vertices[17],vertices[65]); + cells[486]->set_neighbors(cells[338],cells[90],cells[240],cells[485]); + set_offsets(cells[486],0,0,0,0); + cells[487]->set_vertices(vertices[110],vertices[63],vertices[62],vertices[55]); + cells[487]->set_neighbors(cells[21],cells[23],cells[699],cells[373]); + set_offsets(cells[487],0,0,0,0); + cells[488]->set_vertices(vertices[68],vertices[69],vertices[21],vertices[61]); + cells[488]->set_neighbors(cells[201],cells[243],cells[45],cells[22]); + set_offsets(cells[488],0,0,0,0); + cells[489]->set_vertices(vertices[144],vertices[96],vertices[103],vertices[143]); + cells[489]->set_neighbors(cells[838],cells[892],cells[1120],cells[638]); + set_offsets(cells[489],3,3,2,0); + cells[490]->set_vertices(vertices[180],vertices[188],vertices[133],vertices[181]); + cells[490]->set_neighbors(cells[825],cells[1107],cells[1325],cells[1123]); + set_offsets(cells[490],0,0,0,0); + cells[491]->set_vertices(vertices[73],vertices[74],vertices[122],vertices[82]); + cells[491]->set_neighbors(cells[697],cells[778],cells[377],cells[616]); + set_offsets(cells[491],0,0,0,0); + cells[492]->set_vertices(vertices[100],vertices[91],vertices[140],vertices[52]); + cells[492]->set_neighbors(cells[349],cells[788],cells[162],cells[827]); + set_offsets(cells[492],2,0,0,2); + cells[493]->set_vertices(vertices[35],vertices[92],vertices[83],vertices[43]); + cells[493]->set_neighbors(cells[211],cells[329],cells[41],cells[302]); + set_offsets(cells[493],0,0,0,0); + cells[494]->set_vertices(vertices[67],vertices[75],vertices[124],vertices[115]); + cells[494]->set_neighbors(cells[548],cells[663],cells[379],cells[624]); + set_offsets(cells[494],0,0,0,0); + cells[495]->set_vertices(vertices[31],vertices[32],vertices[80],vertices[39]); + cells[495]->set_neighbors(cells[539],cells[251],cells[0],cells[508]); + set_offsets(cells[495],0,1,1,0); + cells[496]->set_vertices(vertices[77],vertices[37],vertices[86],vertices[85]); + cells[496]->set_neighbors(cells[407],cells[311],cells[568],cells[518]); + set_offsets(cells[496],0,0,0,0); + cells[497]->set_vertices(vertices[42],vertices[35],vertices[34],vertices[82]); + cells[497]->set_neighbors(cells[310],cells[449],cells[118],cells[1618]); + set_offsets(cells[497],0,0,0,0); + cells[498]->set_vertices(vertices[60],vertices[68],vertices[108],vertices[59]); + cells[498]->set_neighbors(cells[6],cells[7],cells[298],cells[479]); + set_offsets(cells[498],0,0,0,0); + cells[499]->set_vertices(vertices[31],vertices[24],vertices[72],vertices[32]); + cells[499]->set_neighbors(cells[92],cells[508],cells[1413],cells[2]); + set_offsets(cells[499],0,1,1,1); + cells[500]->set_vertices(vertices[86],vertices[39],vertices[94],vertices[46]); + cells[500]->set_neighbors(cells[384],cells[555],cells[315],cells[596]); + set_offsets(cells[500],0,0,0,0); + cells[501]->set_vertices(vertices[114],vertices[154],vertices[107],vertices[106]); + cells[501]->set_neighbors(cells[541],cells[282],cells[950],cells[622]); + set_offsets(cells[501],0,0,0,0); + cells[502]->set_vertices(vertices[84],vertices[29],vertices[36],vertices[76]); + cells[502]->set_neighbors(cells[107],cells[220],cells[526],cells[119]); + set_offsets(cells[502],0,0,0,0); + cells[503]->set_vertices(vertices[35],vertices[84],vertices[36],vertices[27]); + cells[503]->set_neighbors(cells[220],cells[1424],cells[565],cells[538]); + set_offsets(cells[503],0,0,0,0); + cells[504]->set_vertices(vertices[65],vertices[114],vertices[105],vertices[113]); + cells[504]->set_neighbors(cells[415],cells[729],cells[231],cells[450]); + set_offsets(cells[504],0,0,0,0); + cells[505]->set_vertices(vertices[72],vertices[73],vertices[25],vertices[65]); + cells[505]->set_neighbors(cells[358],cells[466],cells[738],cells[305]); + set_offsets(cells[505],0,0,0,0); + cells[506]->set_vertices(vertices[166],vertices[158],vertices[159],vertices[111]); + cells[506]->set_neighbors(cells[585],cells[750],cells[690],cells[1031]); + set_offsets(cells[506],0,0,0,0); + cells[507]->set_vertices(vertices[88],vertices[40],vertices[33],vertices[41]); + cells[507]->set_neighbors(cells[1653],cells[403],cells[235],cells[562]); + set_offsets(cells[507],0,0,0,0); + cells[508]->set_vertices(vertices[31],vertices[32],vertices[72],vertices[80]); + cells[508]->set_neighbors(cells[437],cells[38],cells[495],cells[499]); + set_offsets(cells[508],0,1,1,1); + cells[509]->set_vertices(vertices[104],vertices[57],vertices[112],vertices[64]); + cells[509]->set_neighbors(cells[569],cells[726],cells[215],cells[227]); + set_offsets(cells[509],0,0,0,0); + cells[510]->set_vertices(vertices[65],vertices[57],vertices[112],vertices[105]); + cells[510]->set_neighbors(cells[227],cells[729],cells[450],cells[569]); + set_offsets(cells[510],0,0,0,0); + cells[511]->set_vertices(vertices[99],vertices[51],vertices[106],vertices[98]); + cells[511]->set_neighbors(cells[312],cells[595],cells[872],cells[635]); + set_offsets(cells[511],0,0,0,0); + cells[512]->set_vertices(vertices[113],vertices[105],vertices[153],vertices[162]); + cells[512]->set_neighbors(cells[969],cells[746],cells[415],cells[955]); + set_offsets(cells[512],0,0,0,0); + cells[513]->set_vertices(vertices[92],vertices[37],vertices[85],vertices[45]); + cells[513]->set_neighbors(cells[573],cells[598],cells[535],cells[129]); + set_offsets(cells[513],0,0,0,0); + cells[514]->set_vertices(vertices[82],vertices[27],vertices[75],vertices[35]); + cells[514]->set_neighbors(cells[565],cells[566],cells[310],cells[40]); + set_offsets(cells[514],0,0,0,0); + cells[515]->set_vertices(vertices[74],vertices[27],vertices[67],vertices[75]); + cells[515]->set_neighbors(cells[205],cells[644],cells[40],cells[432]); + set_offsets(cells[515],0,0,0,0); + cells[516]->set_vertices(vertices[129],vertices[128],vertices[176],vertices[121]); + cells[516]->set_neighbors(cells[990],cells[713],cells[617],cells[1073]); + set_offsets(cells[516],0,0,0,0); + cells[517]->set_vertices(vertices[122],vertices[162],vertices[115],vertices[114]); + cells[517]->set_neighbors(cells[790],cells[20],cells[748],cells[841]); + set_offsets(cells[517],0,0,0,0); + cells[518]->set_vertices(vertices[29],vertices[86],vertices[77],vertices[37]); + cells[518]->set_neighbors(cells[496],cells[527],cells[553],cells[279]); + set_offsets(cells[518],0,0,0,0); + cells[519]->set_vertices(vertices[3],vertices[91],vertices[43],vertices[50]); + cells[519]->set_neighbors(cells[156],cells[374],cells[473],cells[563]); + set_offsets(cells[519],2,0,0,2); + cells[520]->set_vertices(vertices[82],vertices[74],vertices[34],vertices[25]); + cells[520]->set_neighbors(cells[30],cells[74],cells[377],cells[482]); + set_offsets(cells[520],0,0,0,0); + cells[521]->set_vertices(vertices[130],vertices[121],vertices[170],vertices[122]); + cells[521]->set_neighbors(cells[792],cells[854],cells[115],cells[408]); + set_offsets(cells[521],0,0,0,0); + cells[522]->set_vertices(vertices[268],vertices[260],vertices[261],vertices[213]); + cells[522]->set_neighbors(cells[1344],cells[891],cells[262],cells[217]); + set_offsets(cells[522],0,0,0,0); + cells[523]->set_vertices(vertices[43],vertices[92],vertices[4],vertices[44]); + cells[523]->set_neighbors(cells[575],cells[1364],cells[41],cells[525]); + set_offsets(cells[523],0,0,2,0); + cells[524]->set_vertices(vertices[84],vertices[37],vertices[92],vertices[44]); + cells[524]->set_neighbors(cells[535],cells[143],cells[368],cells[129]); + set_offsets(cells[524],0,0,0,0); + cells[525]->set_vertices(vertices[43],vertices[52],vertices[4],vertices[92]); + cells[525]->set_neighbors(cells[476],cells[523],cells[167],cells[331]); + set_offsets(cells[525],0,2,2,0); + cells[526]->set_vertices(vertices[76],vertices[29],vertices[77],vertices[84]); + cells[526]->set_neighbors(cells[527],cells[545],cells[502],cells[528]); + set_offsets(cells[526],0,0,0,0); + cells[527]->set_vertices(vertices[84],vertices[29],vertices[77],vertices[37]); + cells[527]->set_neighbors(cells[518],cells[568],cells[119],cells[526]); + set_offsets(cells[527],0,0,0,0); + cells[528]->set_vertices(vertices[76],vertices[29],vertices[69],vertices[77]); + cells[528]->set_neighbors(cells[71],cells[666],cells[526],cells[300]); + set_offsets(cells[528],0,0,0,0); + cells[529]->set_vertices(vertices[274],vertices[226],vertices[266],vertices[219]); + cells[529]->set_neighbors(cells[1373],cells[1152],cells[916],cells[1178]); + set_offsets(cells[529],0,0,0,0); + cells[530]->set_vertices(vertices[94],vertices[47],vertices[39],vertices[87]); + cells[530]->set_neighbors(cells[554],cells[596],cells[606],cells[384]); + set_offsets(cells[530],0,0,0,0); + cells[531]->set_vertices(vertices[136],vertices[95],vertices[135],vertices[87]); + cells[531]->set_neighbors(cells[848],cells[174],cells[806],cells[672]); + set_offsets(cells[531],1,0,0,0); + cells[532]->set_vertices(vertices[85],vertices[94],vertices[93],vertices[45]); + cells[532]->set_neighbors(cells[255],cells[598],cells[573],cells[667]); + set_offsets(cells[532],0,0,0,0); + cells[533]->set_vertices(vertices[119],vertices[112],vertices[71],vertices[111]); + cells[533]->set_neighbors(cells[682],cells[716],cells[762],cells[731]); + set_offsets(cells[533],0,1,0,0); + cells[534]->set_vertices(vertices[80],vertices[33],vertices[81],vertices[88]); + cells[534]->set_neighbors(cells[403],cells[773],cells[562],cells[556]); + set_offsets(cells[534],0,0,0,0); + cells[535]->set_vertices(vertices[92],vertices[37],vertices[45],vertices[44]); + cells[535]->set_neighbors(cells[1354],cells[575],cells[524],cells[513]); + set_offsets(cells[535],0,0,0,0); + cells[536]->set_vertices(vertices[50],vertices[43],vertices[2],vertices[90]); + cells[536]->set_neighbors(cells[477],cells[564],cells[156],cells[374]); + set_offsets(cells[536],2,0,2,0); + cells[537]->set_vertices(vertices[83],vertices[75],vertices[84],vertices[35]); + cells[537]->set_neighbors(cells[565],cells[302],cells[566],cells[633]); + set_offsets(cells[537],0,0,0,0); + cells[538]->set_vertices(vertices[44],vertices[84],vertices[36],vertices[35]); + cells[538]->set_neighbors(cells[503],cells[267],cells[143],cells[368]); + set_offsets(cells[538],0,0,0,0); + cells[539]->set_vertices(vertices[39],vertices[32],vertices[80],vertices[40]); + cells[539]->set_neighbors(cells[160],cells[163],cells[1220],cells[495]); + set_offsets(cells[539],0,1,1,1); + cells[540]->set_vertices(vertices[173],vertices[125],vertices[165],vertices[174]); + cells[540]->set_neighbors(cells[982],cells[246],cells[589],cells[953]); + set_offsets(cells[540],0,0,0,0); + cells[541]->set_vertices(vertices[107],vertices[154],vertices[99],vertices[106]); + cells[541]->set_neighbors(cells[754],cells[649],cells[501],cells[704]); + set_offsets(cells[541],0,0,0,0); + cells[542]->set_vertices(vertices[176],vertices[184],vertices[129],vertices[177]); + cells[542]->set_neighbors(cells[853],cells[1043],cells[1084],cells[965]); + set_offsets(cells[542],0,0,0,0); + cells[543]->set_vertices(vertices[140],vertices[93],vertices[85],vertices[133]); + cells[543]->set_neighbors(cells[834],cells[625],cells[884],cells[812]); + set_offsets(cells[543],0,0,0,0); + cells[544]->set_vertices(vertices[126],vertices[79],vertices[78],vertices[71]); + cells[544]->set_neighbors(cells[393],cells[362],cells[446],cells[440]); + set_offsets(cells[544],0,0,0,0); + cells[545]->set_vertices(vertices[124],vertices[76],vertices[77],vertices[84]); + cells[545]->set_neighbors(cells[526],cells[365],cells[80],cells[666]); + set_offsets(cells[545],0,0,0,0); + cells[546]->set_vertices(vertices[87],vertices[88],vertices[39],vertices[80]); + cells[546]->set_neighbors(cells[163],cells[577],cells[745],cells[554]); + set_offsets(cells[546],0,1,0,1); + cells[547]->set_vertices(vertices[61],vertices[69],vertices[118],vertices[109]); + cells[547]->set_neighbors(cells[580],cells[284],cells[317],cells[722]); + set_offsets(cells[547],0,0,0,0); + cells[548]->set_vertices(vertices[75],vertices[124],vertices[115],vertices[123]); + cells[548]->set_neighbors(cells[845],cells[474],cells[418],cells[494]); + set_offsets(cells[548],0,0,0,0); + cells[549]->set_vertices(vertices[68],vertices[67],vertices[116],vertices[59]); + cells[549]->set_neighbors(cells[154],cells[6],cells[386],cells[181]); + set_offsets(cells[549],0,0,0,0); + cells[550]->set_vertices(vertices[39],vertices[40],vertices[88],vertices[47]); + cells[550]->set_neighbors(cells[93],cells[554],cells[1595],cells[163]); + set_offsets(cells[550],0,1,1,0); + cells[551]->set_vertices(vertices[31],vertices[78],vertices[38],vertices[86]); + cells[551]->set_neighbors(cells[359],cells[552],cells[435],cells[464]); + set_offsets(cells[551],0,0,0,0); + cells[552]->set_vertices(vertices[31],vertices[86],vertices[38],vertices[39]); + cells[552]->set_neighbors(cells[315],cells[1015],cells[387],cells[551]); + set_offsets(cells[552],0,0,0,0); + cells[553]->set_vertices(vertices[29],vertices[38],vertices[86],vertices[37]); + cells[553]->set_neighbors(cells[275],cells[518],cells[1246],cells[359]); + set_offsets(cells[553],0,0,0,0); + cells[554]->set_vertices(vertices[87],vertices[47],vertices[39],vertices[88]); + cells[554]->set_neighbors(cells[550],cells[546],cells[607],cells[530]); + set_offsets(cells[554],0,0,0,1); + cells[555]->set_vertices(vertices[94],vertices[86],vertices[46],vertices[37]); + cells[555]->set_neighbors(cells[275],cells[219],cells[407],cells[500]); + set_offsets(cells[555],0,0,0,0); + cells[556]->set_vertices(vertices[80],vertices[33],vertices[73],vertices[81]); + cells[556]->set_neighbors(cells[60],cells[774],cells[534],cells[467]); + set_offsets(cells[556],0,0,0,0); + cells[557]->set_vertices(vertices[145],vertices[154],vertices[105],vertices[97]); + cells[557]->set_neighbors(cells[366],cells[906],cells[457],cells[73]); + set_offsets(cells[557],0,0,0,0); + cells[558]->set_vertices(vertices[149],vertices[206],vertices[197],vertices[157]); + cells[558]->set_neighbors(cells[460],cells[35],cells[692],cells[77]); + set_offsets(cells[558],0,0,0,0); + cells[559]->set_vertices(vertices[257],vertices[18],vertices[17],vertices[26]); + cells[559]->set_neighbors(cells[361],cells[1613],cells[1560],cells[1555]); + set_offsets(cells[559],0,4,4,4); + cells[560]->set_vertices(vertices[33],vertices[90],vertices[81],vertices[41]); + cells[560]->set_neighbors(cells[198],cells[403],cells[102],cells[290]); + set_offsets(cells[560],0,0,0,0); + cells[561]->set_vertices(vertices[69],vertices[77],vertices[78],vertices[126]); + cells[561]->set_neighbors(cells[442],cells[640],cells[655],cells[71]); + set_offsets(cells[561],0,0,0,0); + cells[562]->set_vertices(vertices[80],vertices[40],vertices[33],vertices[88]); + cells[562]->set_neighbors(cells[507],cells[534],cells[163],cells[160]); + set_offsets(cells[562],0,0,0,0); + cells[563]->set_vertices(vertices[3],vertices[91],vertices[52],vertices[43]); + cells[563]->set_neighbors(cells[167],cells[331],cells[519],cells[592]); + set_offsets(cells[563],2,0,2,0); + cells[564]->set_vertices(vertices[41],vertices[50],vertices[2],vertices[90]); + cells[564]->set_neighbors(cells[536],cells[52],cells[399],cells[328]); + set_offsets(cells[564],0,2,2,0); + cells[565]->set_vertices(vertices[35],vertices[75],vertices[84],vertices[27]); + cells[565]->set_neighbors(cells[458],cells[503],cells[514],cells[537]); + set_offsets(cells[565],0,0,0,0); + cells[566]->set_vertices(vertices[82],vertices[35],vertices[75],vertices[83]); + cells[566]->set_neighbors(cells[537],cells[68],cells[293],cells[514]); + set_offsets(cells[566],0,0,0,0); + cells[567]->set_vertices(vertices[48],vertices[88],vertices[41],vertices[0]); + cells[567]->set_neighbors(cells[235],cells[1],cells[363],cells[70]); + set_offsets(cells[567],2,0,0,2); + cells[568]->set_vertices(vertices[84],vertices[37],vertices[77],vertices[85]); + cells[568]->set_neighbors(cells[496],cells[579],cells[129],cells[527]); + set_offsets(cells[568],0,0,0,0); + cells[569]->set_vertices(vertices[112],vertices[57],vertices[65],vertices[64]); + cells[569]->set_neighbors(cells[454],cells[180],cells[509],cells[510]); + set_offsets(cells[569],0,0,0,0); + cells[570]->set_vertices(vertices[265],vertices[257],vertices[26],vertices[266]); + cells[570]->set_neighbors(cells[1560],cells[1385],cells[1059],cells[1613]); + set_offsets(cells[570],0,0,4,0); + cells[571]->set_vertices(vertices[176],vertices[121],vertices[168],vertices[169]); + cells[571]->set_neighbors(cells[1044],cells[16],cells[713],cells[990]); + set_offsets(cells[571],0,0,0,0); + cells[572]->set_vertices(vertices[132],vertices[123],vertices[172],vertices[124]); + cells[572]->set_neighbors(cells[845],cells[928],cells[418],cells[660]); + set_offsets(cells[572],0,0,0,0); + cells[573]->set_vertices(vertices[37],vertices[94],vertices[85],vertices[45]); + cells[573]->set_neighbors(cells[532],cells[513],cells[219],cells[407]); + set_offsets(cells[573],0,0,0,0); + cells[574]->set_vertices(vertices[5],vertices[93],vertices[54],vertices[45]); + cells[574]->set_neighbors(cells[255],cells[12],cells[108],cells[600]); + set_offsets(cells[574],2,0,2,0); + cells[575]->set_vertices(vertices[92],vertices[45],vertices[4],vertices[44]); + cells[575]->set_neighbors(cells[1471],cells[523],cells[535],cells[476]); + set_offsets(cells[575],0,0,2,0); + cells[576]->set_vertices(vertices[95],vertices[48],vertices[96],vertices[55]); + cells[576]->set_neighbors(cells[200],cells[899],cells[610],cells[839]); + set_offsets(cells[576],0,3,3,2); + cells[577]->set_vertices(vertices[79],vertices[87],vertices[39],vertices[80]); + cells[577]->set_neighbors(cells[546],cells[251],cells[661],cells[578]); + set_offsets(cells[577],0,0,0,1); + cells[578]->set_vertices(vertices[86],vertices[87],vertices[39],vertices[79]); + cells[578]->set_neighbors(cells[577],cells[387],cells[55],cells[596]); + set_offsets(cells[578],0,0,0,0); + cells[579]->set_vertices(vertices[85],vertices[84],vertices[132],vertices[77]); + cells[579]->set_neighbors(cells[365],cells[795],cells[568],cells[632]); + set_offsets(cells[579],0,0,0,0); + cells[580]->set_vertices(vertices[69],vertices[117],vertices[118],vertices[109]); + cells[580]->set_neighbors(cells[224],cells[547],cells[752],cells[603]); + set_offsets(cells[580],0,0,0,0); + cells[581]->set_vertices(vertices[45],vertices[94],vertices[6],vertices[46]); + cells[581]->set_neighbors(cells[582],cells[1628],cells[219],cells[175]); + set_offsets(cells[581],0,0,2,0); + cells[582]->set_vertices(vertices[94],vertices[47],vertices[6],vertices[46]); + cells[582]->set_neighbors(cells[1488],cells[581],cells[384],cells[426]); + set_offsets(cells[582],0,0,2,0); + cells[583]->set_vertices(vertices[1],vertices[49],vertices[50],vertices[89]); + cells[583]->set_neighbors(cells[631],cells[289],cells[584],cells[49]); + set_offsets(cells[583],2,2,2,0); + cells[584]->set_vertices(vertices[1],vertices[49],vertices[89],vertices[48]); + cells[584]->set_neighbors(cells[111],cells[123],cells[97],cells[583]); + set_offsets(cells[584],2,2,0,2); + cells[585]->set_vertices(vertices[159],vertices[158],vertices[151],vertices[111]); + cells[585]->set_neighbors(cells[409],cells[241],cells[506],cells[1111]); + set_offsets(cells[585],0,0,0,0); + cells[586]->set_vertices(vertices[281],vertices[40],vertices[33],vertices[273]); + cells[586]->set_neighbors(cells[1439],cells[628],cells[1651],cells[1653]); + set_offsets(cells[586],0,4,4,0); + cells[587]->set_vertices(vertices[255],vertices[16],vertices[8],vertices[15]); + cells[587]->set_neighbors(cells[385],cells[1304],cells[1491],cells[1266]); + set_offsets(cells[587],0,5,5,4); + cells[588]->set_vertices(vertices[97],vertices[49],vertices[57],vertices[104]); + cells[588]->set_neighbors(cells[395],cells[683],cells[636],cells[352]); + set_offsets(cells[588],0,0,0,0); + cells[589]->set_vertices(vertices[182],vertices[125],vertices[173],vertices[174]); + cells[589]->set_neighbors(cells[540],cells[1071],cells[1070],cells[846]); + set_offsets(cells[589],0,0,0,0); + cells[590]->set_vertices(vertices[133],vertices[125],vertices[182],vertices[134]); + cells[590]->set_neighbors(cells[1070],cells[1105],cells[109],cells[846]); + set_offsets(cells[590],0,0,0,0); + cells[591]->set_vertices(vertices[130],vertices[138],vertices[81],vertices[90]); + cells[591]->set_neighbors(cells[789],cells[794],cells[776],cells[78]); + set_offsets(cells[591],0,0,0,0); + cells[592]->set_vertices(vertices[3],vertices[51],vertices[52],vertices[91]); + cells[592]->set_neighbors(cells[162],cells[563],cells[473],cells[223]); + set_offsets(cells[592],2,2,2,0); + cells[593]->set_vertices(vertices[104],vertices[97],vertices[152],vertices[105]); + cells[593]->set_neighbors(cells[906],cells[842],cells[683],cells[797]); + set_offsets(cells[593],0,0,0,0); + cells[594]->set_vertices(vertices[130],vertices[122],vertices[123],vertices[75]); + cells[594]->set_neighbors(cells[474],cells[781],cells[814],cells[854]); + set_offsets(cells[594],0,0,0,0); + cells[595]->set_vertices(vertices[99],vertices[98],vertices[106],vertices[146]); + cells[595]->set_neighbors(cells[626],cells[754],cells[824],cells[511]); + set_offsets(cells[595],0,0,0,0); + cells[596]->set_vertices(vertices[86],vertices[94],vertices[39],vertices[87]); + cells[596]->set_neighbors(cells[530],cells[578],cells[218],cells[500]); + set_offsets(cells[596],0,0,0,0); + cells[597]->set_vertices(vertices[52],vertices[92],vertices[93],vertices[45]); + cells[597]->set_neighbors(cells[598],cells[108],cells[476],cells[50]); + set_offsets(cells[597],2,0,0,0); + cells[598]->set_vertices(vertices[93],vertices[92],vertices[85],vertices[45]); + cells[598]->set_neighbors(cells[513],cells[532],cells[597],cells[812]); + set_offsets(cells[598],0,0,0,0); + cells[599]->set_vertices(vertices[5],vertices[53],vertices[93],vertices[52]); + cells[599]->set_neighbors(cells[651],cells[108],cells[149],cells[600]); + set_offsets(cells[599],2,2,0,2); + cells[600]->set_vertices(vertices[5],vertices[53],vertices[54],vertices[93]); + cells[600]->set_neighbors(cells[668],cells[574],cells[599],cells[207]); + set_offsets(cells[600],2,2,2,0); + cells[601]->set_vertices(vertices[73],vertices[82],vertices[130],vertices[81]); + cells[601]->set_neighbors(cells[794],cells[764],cells[60],cells[778]); + set_offsets(cells[601],0,0,0,0); + cells[602]->set_vertices(vertices[185],vertices[145],vertices[146],vertices[194]); + cells[602]->set_neighbors(cells[719],cells[1414],cells[1408],cells[1091]); + set_offsets(cells[602],0,2,2,2); + cells[603]->set_vertices(vertices[69],vertices[126],vertices[118],vertices[117]); + cells[603]->set_neighbors(cells[844],cells[580],cells[655],cells[640]); + set_offsets(cells[603],0,0,0,0); + cells[604]->set_vertices(vertices[96],vertices[56],vertices[48],vertices[49]); + cells[604]->set_neighbors(cells[97],cells[111],cells[637],cells[200]); + set_offsets(cells[604],0,0,0,0); + cells[605]->set_vertices(vertices[54],vertices[47],vertices[94],vertices[95]); + cells[605]->set_neighbors(cells[606],cells[351],cells[612],cells[426]); + set_offsets(cells[605],2,0,0,0); + cells[606]->set_vertices(vertices[95],vertices[47],vertices[94],vertices[87]); + cells[606]->set_neighbors(cells[530],cells[849],cells[607],cells[605]); + set_offsets(cells[606],0,0,0,0); + cells[607]->set_vertices(vertices[87],vertices[47],vertices[88],vertices[95]); + cells[607]->set_neighbors(cells[608],cells[806],cells[606],cells[554]); + set_offsets(cells[607],0,0,1,0); + cells[608]->set_vertices(vertices[95],vertices[47],vertices[88],vertices[48]); + cells[608]->set_neighbors(cells[363],cells[727],cells[609],cells[607]); + set_offsets(cells[608],0,0,1,3); + cells[609]->set_vertices(vertices[95],vertices[7],vertices[47],vertices[48]); + cells[609]->set_neighbors(cells[27],cells[608],cells[610],cells[612]); + set_offsets(cells[609],0,2,0,3); + cells[610]->set_vertices(vertices[55],vertices[7],vertices[95],vertices[48]); + cells[610]->set_neighbors(cells[609],cells[576],cells[230],cells[611]); + set_offsets(cells[610],2,2,0,3); + cells[611]->set_vertices(vertices[54],vertices[7],vertices[95],vertices[55]); + cells[611]->set_neighbors(cells[610],cells[669],cells[114],cells[612]); + set_offsets(cells[611],2,2,0,2); + cells[612]->set_vertices(vertices[54],vertices[7],vertices[47],vertices[95]); + cells[612]->set_neighbors(cells[609],cells[605],cells[611],cells[103]); + set_offsets(cells[612],2,2,0,0); + cells[613]->set_vertices(vertices[239],vertices[191],vertices[232],vertices[192]); + cells[613]->set_neighbors(cells[1259],cells[1394],cells[345],cells[1437]); + set_offsets(cells[613],0,0,1,3); + cells[614]->set_vertices(vertices[145],vertices[97],vertices[152],vertices[144]); + cells[614]->set_neighbors(cells[797],cells[686],cells[1130],cells[906]); + set_offsets(cells[614],0,0,0,0); + cells[615]->set_vertices(vertices[119],vertices[166],vertices[111],vertices[118]); + cells[615]->set_neighbors(cells[690],cells[716],cells[1013],cells[750]); + set_offsets(cells[615],0,0,0,0); + cells[616]->set_vertices(vertices[65],vertices[74],vertices[122],vertices[73]); + cells[616]->set_neighbors(cells[491],cells[618],cells[358],cells[353]); + set_offsets(cells[616],0,0,0,0); + cells[617]->set_vertices(vertices[128],vertices[129],vertices[81],vertices[121]); + cells[617]->set_neighbors(cells[98],cells[394],cells[516],cells[357]); + set_offsets(cells[617],0,0,0,0); + cells[618]->set_vertices(vertices[65],vertices[122],vertices[113],vertices[73]); + cells[618]->set_neighbors(cells[94],cells[19],cells[616],cells[231]); + set_offsets(cells[618],0,0,0,0); + cells[619]->set_vertices(vertices[67],vertices[124],vertices[76],vertices[116]); + cells[619]->set_neighbors(cells[375],cells[181],cells[663],cells[624]); + set_offsets(cells[619],0,0,0,0); + cells[620]->set_vertices(vertices[188],vertices[139],vertices[131],vertices[140]); + cells[620]->set_neighbors(cells[836],cells[621],cells[1096],cells[1061]); + set_offsets(cells[620],0,0,0,0); + cells[621]->set_vertices(vertices[180],vertices[188],vertices[131],vertices[140]); + cells[621]->set_neighbors(cells[620],cells[1068],cells[1123],cells[896]); + set_offsets(cells[621],0,0,0,0); + cells[622]->set_vertices(vertices[162],vertices[154],vertices[107],vertices[114]); + cells[622]->set_neighbors(cells[501],cells[790],cells[793],cells[770]); + set_offsets(cells[622],0,0,0,0); + cells[623]->set_vertices(vertices[286],vertices[237],vertices[277],vertices[229]); + cells[623]->set_neighbors(cells[1003],cells[1480],cells[1627],cells[1635]); + set_offsets(cells[623],0,0,0,0); + cells[624]->set_vertices(vertices[67],vertices[75],vertices[76],vertices[124]); + cells[624]->set_neighbors(cells[80],cells[619],cells[494],cells[205]); + set_offsets(cells[624],0,0,0,0); + cells[625]->set_vertices(vertices[132],vertices[140],vertices[85],vertices[133]); + cells[625]->set_neighbors(cells[543],cells[828],cells[927],cells[871]); + set_offsets(cells[625],0,0,0,0); + cells[626]->set_vertices(vertices[146],vertices[98],vertices[106],vertices[97]); + cells[626]->set_neighbors(cells[483],cells[333],cells[915],cells[595]); + set_offsets(cells[626],0,0,0,0); + cells[627]->set_vertices(vertices[53],vertices[62],vertices[102],vertices[110]); + cells[627]->set_neighbors(cells[23],cells[427],cells[676],cells[411]); + set_offsets(cells[627],0,0,0,0); + cells[628]->set_vertices(vertices[281],vertices[273],vertices[33],vertices[42]); + cells[628]->set_neighbors(cells[1438],cells[1183],cells[1689],cells[586]); + set_offsets(cells[628],0,0,4,4); + cells[629]->set_vertices(vertices[110],vertices[118],vertices[70],vertices[63]); + cells[629]->set_neighbors(cells[294],cells[373],cells[225],cells[204]); + set_offsets(cells[629],0,0,0,0); + cells[630]->set_vertices(vertices[108],vertices[107],vertices[99],vertices[59]); + cells[630]->set_neighbors(cells[649],cells[210],cells[478],cells[907]); + set_offsets(cells[630],0,0,0,0); + cells[631]->set_vertices(vertices[98],vertices[49],vertices[89],vertices[50]); + cells[631]->set_neighbors(cells[583],cells[855],cells[320],cells[859]); + set_offsets(cells[631],2,2,0,2); + cells[632]->set_vertices(vertices[92],vertices[84],vertices[132],vertices[85]); + cells[632]->set_neighbors(cells[579],cells[871],cells[129],cells[800]); + set_offsets(cells[632],0,0,0,0); + cells[633]->set_vertices(vertices[75],vertices[84],vertices[132],vertices[83]); + cells[633]->set_neighbors(cells[800],cells[801],cells[537],cells[89]); + set_offsets(cells[633],0,0,0,0); + cells[634]->set_vertices(vertices[178],vertices[121],vertices[169],vertices[170]); + cells[634]->set_neighbors(cells[444],cells[959],cells[408],cells[1092]); + set_offsets(cells[634],0,0,0,0); + cells[635]->set_vertices(vertices[99],vertices[51],vertices[59],vertices[106]); + cells[635]->set_neighbors(cells[681],cells[649],cells[511],cells[210]); + set_offsets(cells[635],0,0,0,0); + cells[636]->set_vertices(vertices[97],vertices[49],vertices[104],vertices[96]); + cells[636]->set_neighbors(cells[637],cells[674],cells[861],cells[588]); + set_offsets(cells[636],0,0,0,0); + cells[637]->set_vertices(vertices[96],vertices[49],vertices[104],vertices[56]); + cells[637]->set_neighbors(cells[395],cells[150],cells[604],cells[636]); + set_offsets(cells[637],0,0,0,0); + cells[638]->set_vertices(vertices[103],vertices[104],vertices[96],vertices[144]); + cells[638]->set_neighbors(cells[674],cells[489],cells[908],cells[132]); + set_offsets(cells[638],0,1,1,1); + cells[639]->set_vertices(vertices[61],vertices[109],vertices[110],vertices[101]); + cells[639]->set_neighbors(cells[398],cells[281],cells[706],cells[284]); + set_offsets(cells[639],0,0,0,0); + cells[640]->set_vertices(vertices[69],vertices[126],vertices[78],vertices[118]); + cells[640]->set_neighbors(cells[362],cells[292],cells[603],cells[561]); + set_offsets(cells[640],0,0,0,0); + cells[641]->set_vertices(vertices[198],vertices[150],vertices[151],vertices[158]); + cells[641]->set_neighbors(cells[670],cells[146],cells[643],cells[1215]); + set_offsets(cells[641],0,0,0,0); + cells[642]->set_vertices(vertices[117],vertices[164],vertices[109],vertices[116]); + cells[642]->set_neighbors(cells[308],cells[752],cells[693],cells[191]); + set_offsets(cells[642],0,0,0,0); + cells[643]->set_vertices(vertices[149],vertices[150],vertices[198],vertices[158]); + cells[643]->set_neighbors(cells[641],cells[151],cells[942],cells[1216]); + set_offsets(cells[643],0,0,0,0); + cells[644]->set_vertices(vertices[122],vertices[74],vertices[67],vertices[75]); + cells[644]->set_neighbors(cells[515],cells[379],cells[697],cells[397]); + set_offsets(cells[644],0,0,0,0); + cells[645]->set_vertices(vertices[115],vertices[162],vertices[155],vertices[107]); + cells[645]->set_neighbors(cells[770],cells[715],cells[790],cells[1001]); + set_offsets(cells[645],0,0,0,0); + cells[646]->set_vertices(vertices[129],vertices[177],vertices[178],vertices[169]); + cells[646]->set_neighbors(cells[47],cells[1092],cells[1043],cells[946]); + set_offsets(cells[646],0,0,0,0); + cells[647]->set_vertices(vertices[164],vertices[156],vertices[157],vertices[109]); + cells[647]->set_neighbors(cells[971],cells[191],cells[308],cells[1014]); + set_offsets(cells[647],0,0,0,0); + cells[648]->set_vertices(vertices[148],vertices[99],vertices[139],vertices[100]); + cells[648]->set_neighbors(cells[791],cells[1135],cells[894],cells[786]); + set_offsets(cells[648],2,2,0,2); + cells[649]->set_vertices(vertices[107],vertices[106],vertices[99],vertices[59]); + cells[649]->set_neighbors(cells[635],cells[630],cells[282],cells[541]); + set_offsets(cells[649],0,0,0,0); + cells[650]->set_vertices(vertices[52],vertices[60],vertices[53],vertices[100]); + cells[650]->set_neighbors(cells[438],cells[651],cells[372],cells[149]); + set_offsets(cells[650],0,0,0,0); + cells[651]->set_vertices(vertices[53],vertices[100],vertices[93],vertices[52]); + cells[651]->set_neighbors(cells[788],cells[599],cells[650],cells[886]); + set_offsets(cells[651],2,2,0,2); + cells[652]->set_vertices(vertices[186],vertices[137],vertices[129],vertices[138]); + cells[652]->set_neighbors(cells[161],cells[656],cells[688],cells[878]); + set_offsets(cells[652],0,0,0,0); + cells[653]->set_vertices(vertices[186],vertices[139],vertices[131],vertices[179]); + cells[653]->set_neighbors(cells[1061],cells[817],cells[1098],cells[1126]); + set_offsets(cells[653],0,0,0,0); + cells[654]->set_vertices(vertices[127],vertices[120],vertices[79],vertices[119]); + cells[654]->set_neighbors(cells[728],cells[759],cells[1019],cells[88]); + set_offsets(cells[654],0,1,0,0); + cells[655]->set_vertices(vertices[69],vertices[77],vertices[126],vertices[117]); + cells[655]->set_neighbors(cells[400],cells[603],cells[721],cells[561]); + set_offsets(cells[655],0,0,0,0); + cells[656]->set_vertices(vertices[178],vertices[186],vertices[129],vertices[138]); + cells[656]->set_neighbors(cells[652],cells[1017],cells[1127],cells[946]); + set_offsets(cells[656],0,0,0,0); + cells[657]->set_vertices(vertices[102],vertices[55],vertices[103],vertices[110]); + cells[657]->set_neighbors(cells[699],cells[932],cells[23],cells[903]); + set_offsets(cells[657],0,0,0,0); + cells[658]->set_vertices(vertices[60],vertices[108],vertices[100],vertices[51]); + cells[658]->set_neighbors(cells[64],cells[372],cells[7],cells[438]); + set_offsets(cells[658],0,0,0,0); + cells[659]->set_vertices(vertices[128],vertices[73],vertices[120],vertices[121]); + cells[659]->set_neighbors(cells[766],cells[733],cells[394],cells[735]); + set_offsets(cells[659],0,0,0,0); + cells[660]->set_vertices(vertices[180],vertices[123],vertices[172],vertices[132]); + cells[660]->set_neighbors(cells[572],cells[711],cells[1069],cells[1063]); + set_offsets(cells[660],0,0,0,0); + cells[661]->set_vertices(vertices[79],vertices[80],vertices[128],vertices[87]); + cells[661]->set_neighbors(cells[745],cells[737],cells[577],cells[813]); + set_offsets(cells[661],0,1,1,0); + cells[662]->set_vertices(vertices[120],vertices[113],vertices[160],vertices[168]); + cells[662]->set_neighbors(cells[744],cells[987],cells[991],cells[949]); + set_offsets(cells[662],0,0,0,0); + cells[663]->set_vertices(vertices[67],vertices[124],vertices[116],vertices[115]); + cells[663]->set_neighbors(cells[970],cells[286],cells[494],cells[619]); + set_offsets(cells[663],0,0,0,0); + cells[664]->set_vertices(vertices[276],vertices[267],vertices[28],vertices[268]); + cells[664]->set_neighbors(cells[1526],cells[1631],cells[1624],cells[1045]); + set_offsets(cells[664],0,0,4,0); + cells[665]->set_vertices(vertices[195],vertices[202],vertices[203],vertices[250]); + cells[665]->set_neighbors(cells[947],cells[1242],cells[1513],cells[1237]); + set_offsets(cells[665],0,0,0,0); + cells[666]->set_vertices(vertices[124],vertices[76],vertices[69],vertices[77]); + cells[666]->set_neighbors(cells[528],cells[721],cells[545],cells[375]); + set_offsets(cells[666],0,0,0,0); + cells[667]->set_vertices(vertices[93],vertices[94],vertices[85],vertices[142]); + cells[667]->set_neighbors(cells[880],cells[834],cells[881],cells[532]); + set_offsets(cells[667],0,0,0,0); + cells[668]->set_vertices(vertices[53],vertices[54],vertices[93],vertices[102]); + cells[668]->set_neighbors(cells[798],cells[885],cells[411],cells[600]); + set_offsets(cells[668],2,2,0,2); + cells[669]->set_vertices(vertices[102],vertices[54],vertices[95],vertices[55]); + cells[669]->set_neighbors(cells[611],cells[900],cells[371],cells[675]); + set_offsets(cells[669],2,2,0,2); + cells[670]->set_vertices(vertices[150],vertices[103],vertices[151],vertices[158]); + cells[670]->set_neighbors(cells[409],cells[641],cells[253],cells[1157]); + set_offsets(cells[670],0,0,0,0); + cells[671]->set_vertices(vertices[96],vertices[95],vertices[143],vertices[136]); + cells[671]->set_neighbors(cells[672],cells[316],cells[839],cells[899]); + set_offsets(cells[671],3,0,0,1); + cells[672]->set_vertices(vertices[143],vertices[95],vertices[135],vertices[136]); + cells[672]->set_neighbors(cells[531],cells[816],cells[671],cells[902]); + set_offsets(cells[672],0,0,0,1); + cells[673]->set_vertices(vertices[230],vertices[221],vertices[270],vertices[222]); + cells[673]->set_neighbors(cells[1586],cells[1276],cells[1116],cells[1303]); + set_offsets(cells[673],0,0,0,0); + cells[674]->set_vertices(vertices[144],vertices[104],vertices[96],vertices[97]); + cells[674]->set_neighbors(cells[636],cells[67],cells[797],cells[638]); + set_offsets(cells[674],0,0,0,0); + cells[675]->set_vertices(vertices[102],vertices[54],vertices[142],vertices[95]); + cells[675]->set_neighbors(cells[351],cells[901],cells[669],cells[798]); + set_offsets(cells[675],2,2,0,0); + cells[676]->set_vertices(vertices[53],vertices[62],vertices[110],vertices[61]); + cells[676]->set_neighbors(cells[677],cells[281],cells[296],cells[627]); + set_offsets(cells[676],0,0,0,0); + cells[677]->set_vertices(vertices[61],vertices[70],vertices[62],vertices[110]); + cells[677]->set_neighbors(cells[373],cells[676],cells[204],cells[383]); + set_offsets(cells[677],0,0,0,0); + cells[678]->set_vertices(vertices[112],vertices[105],vertices[152],vertices[160]); + cells[678]->set_neighbors(cells[43],cells[436],cells[956],cells[842]); + set_offsets(cells[678],0,0,0,0); + cells[679]->set_vertices(vertices[57],vertices[66],vertices[106],vertices[114]); + cells[679]->set_neighbors(cells[429],cells[212],cells[257],cells[17]); + set_offsets(cells[679],0,0,0,0); + cells[680]->set_vertices(vertices[152],vertices[112],vertices[111],vertices[104]); + cells[680]->set_neighbors(cells[475],cells[867],cells[842],cells[436]); + set_offsets(cells[680],1,1,0,1); + cells[681]->set_vertices(vertices[106],vertices[58],vertices[51],vertices[59]); + cells[681]->set_neighbors(cells[424],cells[635],cells[96],cells[312]); + set_offsets(cells[681],0,0,0,0); + cells[682]->set_vertices(vertices[71],vertices[112],vertices[63],vertices[111]); + cells[682]->set_neighbors(cells[475],cells[430],cells[533],cells[725]); + set_offsets(cells[682],0,1,0,0); + cells[683]->set_vertices(vertices[105],vertices[57],vertices[104],vertices[97]); + cells[683]->set_neighbors(cells[588],cells[593],cells[304],cells[227]); + set_offsets(cells[683],0,0,0,0); + cells[684]->set_vertices(vertices[79],vertices[80],vertices[72],vertices[120]); + cells[684]->set_neighbors(cells[228],cells[732],cells[813],cells[38]); + set_offsets(cells[684],0,1,1,1); + cells[685]->set_vertices(vertices[137],vertices[96],vertices[184],vertices[136]); + cells[685]->set_neighbors(cells[316],cells[445],cells[857],cells[1072]); + set_offsets(cells[685],0,2,0,0); + cells[686]->set_vertices(vertices[192],vertices[144],vertices[145],vertices[152]); + cells[686]->set_neighbors(cells[614],cells[1079],cells[893],cells[914]); + set_offsets(cells[686],0,0,0,0); + cells[687]->set_vertices(vertices[123],vertices[170],vertices[163],vertices[115]); + cells[687]->set_neighbors(cells[804],cells[826],cells[924],cells[1055]); + set_offsets(cells[687],0,0,0,0); + cells[688]->set_vertices(vertices[186],vertices[137],vertices[138],vertices[98]); + cells[688]->set_neighbors(cells[856],cells[413],cells[1124],cells[652]); + set_offsets(cells[688],0,0,0,2); + cells[689]->set_vertices(vertices[176],vertices[128],vertices[127],vertices[168]); + cells[689]->set_neighbors(cells[1038],cells[977],cells[990],cells[1035]); + set_offsets(cells[689],1,1,0,1); + cells[690]->set_vertices(vertices[166],vertices[158],vertices[111],vertices[118]); + cells[690]->set_neighbors(cells[354],cells[615],cells[29],cells[506]); + set_offsets(cells[690],0,0,0,0); + cells[691]->set_vertices(vertices[101],vertices[158],vertices[149],vertices[109]); + cells[691]->set_neighbors(cells[164],cells[747],cells[398],cells[942]); + set_offsets(cells[691],0,0,0,0); + cells[692]->set_vertices(vertices[149],vertices[158],vertices[206],vertices[157]); + cells[692]->set_neighbors(cells[1041],cells[558],cells[164],cells[151]); + set_offsets(cells[692],0,0,0,0); + cells[693]->set_vertices(vertices[124],vertices[164],vertices[117],vertices[116]); + cells[693]->set_neighbors(cells[642],cells[410],cells[970],cells[984]); + set_offsets(cells[693],0,0,0,0); + cells[694]->set_vertices(vertices[190],vertices[133],vertices[181],vertices[182]); + cells[694]->set_neighbors(cells[986],cells[1165],cells[935],cells[934]); + set_offsets(cells[694],0,0,0,0); + cells[695]->set_vertices(vertices[133],vertices[188],vertices[140],vertices[141]); + cells[695]->set_neighbors(cells[1113],cells[884],cells[825],cells[1123]); + set_offsets(cells[695],0,0,0,0); + cells[696]->set_vertices(vertices[91],vertices[98],vertices[138],vertices[50]); + cells[696]->set_neighbors(cells[855],cells[14],cells[187],cells[147]); + set_offsets(cells[696],0,2,0,2); + cells[697]->set_vertices(vertices[122],vertices[74],vertices[75],vertices[82]); + cells[697]->set_neighbors(cells[40],cells[814],cells[491],cells[644]); + set_offsets(cells[697],0,0,0,0); + cells[698]->set_vertices(vertices[111],vertices[104],vertices[63],vertices[103]); + cells[698]->set_neighbors(cells[330],cells[717],cells[867],cells[475]); + set_offsets(cells[698],0,1,0,0); + cells[699]->set_vertices(vertices[110],vertices[55],vertices[103],vertices[63]); + cells[699]->set_neighbors(cells[330],cells[717],cells[487],cells[657]); + set_offsets(cells[699],0,0,0,0); + cells[700]->set_vertices(vertices[116],vertices[108],vertices[109],vertices[61]); + cells[700]->set_neighbors(cells[706],cells[317],cells[193],cells[751]); + set_offsets(cells[700],0,0,0,0); + cells[701]->set_vertices(vertices[161],vertices[113],vertices[160],vertices[153]); + cells[701]->set_neighbors(cells[955],cells[1217],cells[746],cells[744]); + set_offsets(cells[701],0,0,0,0); + cells[702]->set_vertices(vertices[111],vertices[158],vertices[103],vertices[110]); + cells[702]->set_neighbors(cells[253],cells[717],cells[354],cells[409]); + set_offsets(cells[702],0,0,0,0); + cells[703]->set_vertices(vertices[163],vertices[115],vertices[155],vertices[164]); + cells[703]->set_neighbors(cells[715],cells[57],cells[772],cells[1001]); + set_offsets(cells[703],0,0,0,0); + cells[704]->set_vertices(vertices[147],vertices[99],vertices[107],vertices[154]); + cells[704]->set_neighbors(cells[541],cells[961],cells[461],cells[153]); + set_offsets(cells[704],0,0,0,0); + cells[705]->set_vertices(vertices[109],vertices[156],vertices[101],vertices[108]); + cells[705]->set_neighbors(cells[471],cells[706],cells[751],cells[747]); + set_offsets(cells[705],0,0,0,0); + cells[706]->set_vertices(vertices[109],vertices[108],vertices[101],vertices[61]); + cells[706]->set_neighbors(cells[51],cells[639],cells[700],cells[705]); + set_offsets(cells[706],0,0,0,0); + cells[707]->set_vertices(vertices[101],vertices[148],vertices[141],vertices[100]); + cells[707]->set_neighbors(cells[332],cells[887],cells[734],cells[390]); + set_offsets(cells[707],2,2,0,2); + cells[708]->set_vertices(vertices[255],vertices[14],vertices[7],vertices[247]); + cells[708]->set_neighbors(cells[266],cells[1263],cells[944],cells[1495]); + set_offsets(cells[708],0,4,4,0); + cells[709]->set_vertices(vertices[231],vertices[230],vertices[278],vertices[223]); + cells[709]->set_neighbors(cells[1636],cells[1643],cells[1297],cells[1675]); + set_offsets(cells[709],0,0,0,0); + cells[710]->set_vertices(vertices[134],vertices[174],vertices[127],vertices[126]); + cells[710]->set_neighbors(cells[196],cells[807],cells[736],cells[780]); + set_offsets(cells[710],0,0,0,0); + cells[711]->set_vertices(vertices[172],vertices[180],vertices[132],vertices[125]); + cells[711]->set_neighbors(cells[1064],cells[928],cells[993],cells[660]); + set_offsets(cells[711],0,0,0,0); + cells[712]->set_vertices(vertices[172],vertices[164],vertices[165],vertices[117]); + cells[712]->set_neighbors(cells[1018],cells[91],cells[984],cells[983]); + set_offsets(cells[712],0,0,0,0); + cells[713]->set_vertices(vertices[129],vertices[121],vertices[176],vertices[169]); + cells[713]->set_neighbors(cells[571],cells[1043],cells[1092],cells[516]); + set_offsets(cells[713],0,0,0,0); + cells[714]->set_vertices(vertices[229],vertices[236],vertices[276],vertices[228]); + cells[714]->set_neighbors(cells[1362],cells[1664],cells[1184],cells[1665]); + set_offsets(cells[714],0,0,0,0); + cells[715]->set_vertices(vertices[115],vertices[107],vertices[155],vertices[164]); + cells[715]->set_neighbors(cells[866],cells[703],cells[802],cells[645]); + set_offsets(cells[715],0,0,0,0); + cells[716]->set_vertices(vertices[119],vertices[118],vertices[111],vertices[71]); + cells[716]->set_neighbors(cells[430],cells[533],cells[755],cells[615]); + set_offsets(cells[716],0,0,0,0); + cells[717]->set_vertices(vertices[111],vertices[110],vertices[103],vertices[63]); + cells[717]->set_neighbors(cells[699],cells[698],cells[225],cells[702]); + set_offsets(cells[717],0,0,0,0); + cells[718]->set_vertices(vertices[192],vertices[145],vertices[193],vertices[200]); + cells[718]->set_neighbors(cells[1142],cells[1143],cells[1079],cells[1361]); + set_offsets(cells[718],0,0,0,0); + cells[719]->set_vertices(vertices[194],vertices[146],vertices[154],vertices[145]); + cells[719]->set_neighbors(cells[457],cells[1150],cells[602],cells[922]); + set_offsets(cells[719],0,0,0,0); + cells[720]->set_vertices(vertices[99],vertices[108],vertices[148],vertices[156]); + cells[720]->set_neighbors(cells[471],cells[130],cells[907],cells[894]); + set_offsets(cells[720],0,0,0,0); + cells[721]->set_vertices(vertices[77],vertices[124],vertices[117],vertices[69]); + cells[721]->set_neighbors(cells[410],cells[655],cells[666],cells[796]); + set_offsets(cells[721],0,0,0,0); + cells[722]->set_vertices(vertices[61],vertices[69],vertices[70],vertices[118]); + cells[722]->set_neighbors(cells[292],cells[204],cells[547],cells[201]); + set_offsets(cells[722],0,0,0,0); + cells[723]->set_vertices(vertices[118],vertices[78],vertices[70],vertices[71]); + cells[723]->set_neighbors(cells[355],cells[294],cells[362],cells[292]); + set_offsets(cells[723],0,0,0,0); + cells[724]->set_vertices(vertices[71],vertices[72],vertices[64],vertices[112]); + cells[724]->set_neighbors(cells[180],cells[725],cells[730],cells[203]); + set_offsets(cells[724],0,1,1,1); + cells[725]->set_vertices(vertices[63],vertices[112],vertices[71],vertices[64]); + cells[725]->set_neighbors(cells[724],cells[169],cells[726],cells[682]); + set_offsets(cells[725],0,1,0,1); + cells[726]->set_vertices(vertices[63],vertices[104],vertices[112],vertices[64]); + cells[726]->set_neighbors(cells[509],cells[725],cells[209],cells[475]); + set_offsets(cells[726],0,1,1,1); + cells[727]->set_vertices(vertices[95],vertices[88],vertices[136],vertices[48]); + cells[727]->set_neighbors(cells[787],cells[839],cells[608],cells[806]); + set_offsets(cells[727],0,1,1,3); + cells[728]->set_vertices(vertices[79],vertices[120],vertices[71],vertices[119]); + cells[728]->set_neighbors(cells[731],cells[446],cells[654],cells[732]); + set_offsets(cells[728],0,1,0,0); + cells[729]->set_vertices(vertices[113],vertices[65],vertices[112],vertices[105]); + cells[729]->set_neighbors(cells[510],cells[956],cells[504],cells[272]); + set_offsets(cells[729],0,0,0,0); + cells[730]->set_vertices(vertices[112],vertices[72],vertices[120],vertices[71]); + cells[730]->set_neighbors(cells[732],cells[731],cells[724],cells[456]); + set_offsets(cells[730],1,1,1,0); + cells[731]->set_vertices(vertices[120],vertices[112],vertices[71],vertices[119]); + cells[731]->set_neighbors(cells[533],cells[728],cells[978],cells[730]); + set_offsets(cells[731],1,1,0,0); + cells[732]->set_vertices(vertices[120],vertices[72],vertices[79],vertices[71]); + cells[732]->set_neighbors(cells[401],cells[728],cells[730],cells[684]); + set_offsets(cells[732],1,1,0,0); + cells[733]->set_vertices(vertices[121],vertices[128],vertices[168],vertices[120]); + cells[733]->set_neighbors(cells[1038],cells[991],cells[659],cells[990]); + set_offsets(cells[733],0,0,0,0); + cells[734]->set_vertices(vertices[148],vertices[100],vertices[101],vertices[108]); + cells[734]->set_neighbors(cells[382],cells[471],cells[894],cells[707]); + set_offsets(cells[734],0,0,0,0); + cells[735]->set_vertices(vertices[120],vertices[80],vertices[73],vertices[128]); + cells[735]->set_neighbors(cells[774],cells[659],cells[813],cells[228]); + set_offsets(cells[735],0,0,0,0); + cells[736]->set_vertices(vertices[134],vertices[125],vertices[174],vertices[126]); + cells[736]->set_neighbors(cells[933],cells[710],cells[799],cells[1070]); + set_offsets(cells[736],0,0,0,0); + cells[737]->set_vertices(vertices[87],vertices[128],vertices[79],vertices[127]); + cells[737]->set_neighbors(cells[88],cells[808],cells[758],cells[661]); + set_offsets(cells[737],0,1,0,0); + cells[738]->set_vertices(vertices[65],vertices[72],vertices[73],vertices[120]); + cells[738]->set_neighbors(cells[228],cells[19],cells[456],cells[505]); + set_offsets(cells[738],0,0,0,0); + cells[739]->set_vertices(vertices[118],vertices[109],vertices[158],vertices[110]); + cells[739]->set_neighbors(cells[398],cells[354],cells[284],cells[29]); + set_offsets(cells[739],0,0,0,0); + cells[740]->set_vertices(vertices[101],vertices[110],vertices[150],vertices[158]); + cells[740]->set_neighbors(cells[253],cells[942],cells[398],cells[831]); + set_offsets(cells[740],0,0,0,0); + cells[741]->set_vertices(vertices[168],vertices[160],vertices[119],vertices[167]); + cells[741]->set_neighbors(cells[1036],cells[809],cells[1269],cells[987]); + set_offsets(cells[741],1,1,0,0); + cells[742]->set_vertices(vertices[115],vertices[114],vertices[107],vertices[67]); + cells[742]->set_neighbors(cells[469],cells[286],cells[20],cells[790]); + set_offsets(cells[742],0,0,0,0); + cells[743]->set_vertices(vertices[132],vertices[140],vertices[131],vertices[83]); + cells[743]->set_neighbors(cells[835],cells[763],cells[369],cells[1068]); + set_offsets(cells[743],0,0,0,0); + cells[744]->set_vertices(vertices[168],vertices[113],vertices[160],vertices[161]); + cells[744]->set_neighbors(cells[701],cells[1087],cells[992],cells[662]); + set_offsets(cells[744],0,0,0,0); + cells[745]->set_vertices(vertices[87],vertices[80],vertices[128],vertices[88]); + cells[745]->set_neighbors(cells[773],cells[273],cells[546],cells[661]); + set_offsets(cells[745],0,1,1,1); + cells[746]->set_vertices(vertices[161],vertices[113],vertices[153],vertices[162]); + cells[746]->set_neighbors(cells[512],cells[158],cells[954],cells[701]); + set_offsets(cells[746],0,0,0,0); + cells[747]->set_vertices(vertices[156],vertices[101],vertices[149],vertices[109]); + cells[747]->set_neighbors(cells[691],cells[971],cells[705],cells[417]); + set_offsets(cells[747],0,0,0,0); + cells[748]->set_vertices(vertices[122],vertices[113],vertices[162],vertices[114]); + cells[748]->set_neighbors(cells[415],cells[517],cells[231],cells[818]); + set_offsets(cells[748],0,0,0,0); + cells[749]->set_vertices(vertices[251],vertices[258],vertices[18],vertices[10]); + cells[749]->set_neighbors(cells[44],cells[912],cells[1277],cells[421]); + set_offsets(cells[749],0,0,4,4); + cells[750]->set_vertices(vertices[119],vertices[166],vertices[159],vertices[111]); + cells[750]->set_neighbors(cells[506],cells[360],cells[615],cells[1037]); + set_offsets(cells[750],0,0,0,0); + cells[751]->set_vertices(vertices[116],vertices[156],vertices[109],vertices[108]); + cells[751]->set_neighbors(cells[705],cells[700],cells[756],cells[308]); + set_offsets(cells[751],0,0,0,0); + cells[752]->set_vertices(vertices[117],vertices[116],vertices[109],vertices[69]); + cells[752]->set_neighbors(cells[317],cells[580],cells[410],cells[642]); + set_offsets(cells[752],0,0,0,0); + cells[753]->set_vertices(vertices[183],vertices[224],vertices[175],vertices[223]); + cells[753]->set_neighbors(cells[1085],cells[851],cells[981],cells[1359]); + set_offsets(cells[753],0,1,0,0); + cells[754]->set_vertices(vertices[154],vertices[146],vertices[99],vertices[106]); + cells[754]->set_neighbors(cells[595],cells[541],cells[333],cells[461]); + set_offsets(cells[754],0,0,0,0); + cells[755]->set_vertices(vertices[126],vertices[118],vertices[119],vertices[71]); + cells[755]->set_neighbors(cells[716],cells[446],cells[362],cells[1013]); + set_offsets(cells[755],0,0,0,0); + cells[756]->set_vertices(vertices[116],vertices[107],vertices[156],vertices[108]); + cells[756]->set_neighbors(cells[907],cells[751],cells[478],cells[761]); + set_offsets(cells[756],0,0,0,0); + cells[757]->set_vertices(vertices[150],vertices[102],vertices[190],vertices[143]); + cells[757]->set_neighbors(cells[1118],cells[1156],cells[938],cells[895]); + set_offsets(cells[757],2,2,0,0); + cells[758]->set_vertices(vertices[128],vertices[135],vertices[127],vertices[87]); + cells[758]->set_neighbors(cells[822],cells[737],cells[174],cells[1035]); + set_offsets(cells[758],1,0,0,0); + cells[759]->set_vertices(vertices[127],vertices[126],vertices[119],vertices[79]); + cells[759]->set_neighbors(cells[446],cells[654],cells[807],cells[196]); + set_offsets(cells[759],0,0,0,0); + cells[760]->set_vertices(vertices[183],vertices[190],vertices[182],vertices[135]); + cells[760]->set_neighbors(cells[1083],cells[996],cells[920],cells[1164]); + set_offsets(cells[760],0,0,0,0); + cells[761]->set_vertices(vertices[164],vertices[107],vertices[156],vertices[116]); + cells[761]->set_neighbors(cells[756],cells[308],cells[802],cells[866]); + set_offsets(cells[761],0,0,0,0); + cells[762]->set_vertices(vertices[112],vertices[160],vertices[111],vertices[119]); + cells[762]->set_neighbors(cells[360],cells[533],cells[978],cells[436]); + set_offsets(cells[762],1,1,0,0); + cells[763]->set_vertices(vertices[131],vertices[132],vertices[83],vertices[123]); + cells[763]->set_neighbors(cells[801],cells[819],cells[1069],cells[743]); + set_offsets(cells[763],0,0,0,0); + cells[764]->set_vertices(vertices[73],vertices[130],vertices[121],vertices[81]); + cells[764]->set_neighbors(cells[98],cells[394],cells[601],cells[115]); + set_offsets(cells[764],0,0,0,0); + cells[765]->set_vertices(vertices[136],vertices[88],vertices[81],vertices[89]); + cells[765]->set_neighbors(cells[378],cells[299],cells[787],cells[425]); + set_offsets(cells[765],0,0,0,0); + cells[766]->set_vertices(vertices[121],vertices[73],vertices[120],vertices[113]); + cells[766]->set_neighbors(cells[19],cells[991],cells[94],cells[659]); + set_offsets(cells[766],0,0,0,0); + cells[767]->set_vertices(vertices[160],vertices[152],vertices[111],vertices[159]); + cells[767]->set_neighbors(cells[241],cells[360],cells[1214],cells[436]); + set_offsets(cells[767],1,1,0,0); + cells[768]->set_vertices(vertices[187],vertices[148],vertices[236],vertices[196]); + cells[768]->set_neighbors(cells[126],cells[1196],cells[1133],cells[1327]); + set_offsets(cells[768],0,2,0,2); + cells[769]->set_vertices(vertices[247],vertices[246],vertices[199],vertices[254]); + cells[769]->set_neighbors(cells[1300],cells[173],cells[1485],cells[1722]); + set_offsets(cells[769],0,0,0,0); + cells[770]->set_vertices(vertices[162],vertices[154],vertices[155],vertices[107]); + cells[770]->set_neighbors(cells[961],cells[645],cells[622],cells[1179]); + set_offsets(cells[770],0,0,0,0); + cells[771]->set_vertices(vertices[178],vertices[186],vertices[179],vertices[226]); + cells[771]->set_neighbors(cells[1384],cells[1332],cells[1039],cells[817]); + set_offsets(cells[771],0,0,0,0); + cells[772]->set_vertices(vertices[172],vertices[115],vertices[163],vertices[164]); + cells[772]->set_neighbors(cells[703],cells[833],cells[56],cells[826]); + set_offsets(cells[772],0,0,0,0); + cells[773]->set_vertices(vertices[128],vertices[80],vertices[81],vertices[88]); + cells[773]->set_neighbors(cells[534],cells[425],cells[745],cells[774]); + set_offsets(cells[773],0,0,0,0); + cells[774]->set_vertices(vertices[128],vertices[80],vertices[73],vertices[81]); + cells[774]->set_neighbors(cells[556],cells[394],cells[773],cells[735]); + set_offsets(cells[774],0,0,0,0); + cells[775]->set_vertices(vertices[170],vertices[210],vertices[163],vertices[162]); + cells[775]->set_neighbors(cells[1010],cells[804],cells[1008],cells[1289]); + set_offsets(cells[775],0,0,0,0); + cells[776]->set_vertices(vertices[83],vertices[130],vertices[90],vertices[138]); + cells[776]->set_neighbors(cells[591],cells[820],cells[829],cells[388]); + set_offsets(cells[776],0,0,0,0); + cells[777]->set_vertices(vertices[77],vertices[134],vertices[86],vertices[126]); + cells[777]->set_neighbors(cells[414],cells[442],cells[799],cells[311]); + set_offsets(cells[777],0,0,0,0); + cells[778]->set_vertices(vertices[73],vertices[82],vertices[122],vertices[130]); + cells[778]->set_neighbors(cells[814],cells[115],cells[601],cells[491]); + set_offsets(cells[778],0,0,0,0); + cells[779]->set_vertices(vertices[270],vertices[262],vertices[263],vertices[215]); + cells[779]->set_neighbors(cells[1308],cells[1296],cells[1591],cells[264]); + set_offsets(cells[779],0,0,0,0); + cells[780]->set_vertices(vertices[127],vertices[182],vertices[174],vertices[134]); + cells[780]->set_neighbors(cells[1070],cells[710],cells[159],cells[422]); + set_offsets(cells[780],0,0,0,0); + cells[781]->set_vertices(vertices[83],vertices[130],vertices[123],vertices[75]); + cells[781]->set_neighbors(cells[594],cells[801],cells[68],cells[819]); + set_offsets(cells[781],0,0,0,0); + cells[782]->set_vertices(vertices[176],vertices[136],vertices[135],vertices[128]); + cells[782]->set_neighbors(cells[174],cells[1035],cells[1073],cells[1074]); + set_offsets(cells[782],1,1,0,1); + cells[783]->set_vertices(vertices[162],vertices[153],vertices[202],vertices[154]); + cells[783]->set_neighbors(cells[1151],cells[1179],cells[969],cells[208]); + set_offsets(cells[783],0,0,0,0); + cells[784]->set_vertices(vertices[211],vertices[251],vertices[259],vertices[260]); + cells[784]->set_neighbors(cells[1280],cells[1331],cells[1252],cells[1520]); + set_offsets(cells[784],0,0,0,0); + cells[785]->set_vertices(vertices[174],vertices[166],vertices[119],vertices[126]); + cells[785]->set_neighbors(cells[1013],cells[196],cells[463],cells[24]); + set_offsets(cells[785],0,0,0,0); + cells[786]->set_vertices(vertices[187],vertices[99],vertices[139],vertices[148]); + cells[786]->set_neighbors(cells[648],cells[1134],cells[1099],cells[1137]); + set_offsets(cells[786],0,2,0,2); + cells[787]->set_vertices(vertices[136],vertices[88],vertices[89],vertices[48]); + cells[787]->set_neighbors(cells[70],cells[350],cells[727],cells[765]); + set_offsets(cells[787],0,0,0,2); + cells[788]->set_vertices(vertices[93],vertices[100],vertices[140],vertices[52]); + cells[788]->set_neighbors(cells[492],cells[50],cells[651],cells[883]); + set_offsets(cells[788],0,2,0,2); + cells[789]->set_vertices(vertices[138],vertices[89],vertices[81],vertices[90]); + cells[789]->set_neighbors(cells[198],cells[591],cells[821],cells[381]); + set_offsets(cells[789],0,0,0,0); + cells[790]->set_vertices(vertices[115],vertices[162],vertices[107],vertices[114]); + cells[790]->set_neighbors(cells[622],cells[742],cells[517],cells[645]); + set_offsets(cells[790],0,0,0,0); + cells[791]->set_vertices(vertices[99],vertices[51],vertices[139],vertices[100]); + cells[791]->set_neighbors(cells[823],cells[648],cells[64],cells[872]); + set_offsets(cells[791],2,2,0,2); + cells[792]->set_vertices(vertices[121],vertices[113],vertices[170],vertices[122]); + cells[792]->set_neighbors(cells[818],cells[521],cells[94],cells[139]); + set_offsets(cells[792],0,0,0,0); + cells[793]->set_vertices(vertices[162],vertices[105],vertices[154],vertices[114]); + cells[793]->set_neighbors(cells[950],cells[622],cells[415],cells[969]); + set_offsets(cells[793],0,0,0,0); + cells[794]->set_vertices(vertices[90],vertices[82],vertices[81],vertices[130]); + cells[794]->set_neighbors(cells[601],cells[591],cells[388],cells[290]); + set_offsets(cells[794],0,0,0,0); + cells[795]->set_vertices(vertices[85],vertices[132],vertices[125],vertices[77]); + cells[795]->set_neighbors(cells[472],cells[462],cells[579],cells[828]); + set_offsets(cells[795],0,0,0,0); + cells[796]->set_vertices(vertices[125],vertices[124],vertices[117],vertices[77]); + cells[796]->set_neighbors(cells[721],cells[400],cells[472],cells[459]); + set_offsets(cells[796],0,0,0,0); + cells[797]->set_vertices(vertices[104],vertices[97],vertices[144],vertices[152]); + cells[797]->set_neighbors(cells[614],cells[908],cells[593],cells[674]); + set_offsets(cells[797],0,0,0,0); + cells[798]->set_vertices(vertices[93],vertices[54],vertices[142],vertices[102]); + cells[798]->set_neighbors(cells[675],cells[879],cells[668],cells[881]); + set_offsets(cells[798],0,2,0,2); + cells[799]->set_vertices(vertices[77],vertices[134],vertices[126],vertices[125]); + cells[799]->set_neighbors(cells[736],cells[400],cells[462],cells[777]); + set_offsets(cells[799],0,0,0,0); + cells[800]->set_vertices(vertices[92],vertices[84],vertices[83],vertices[132]); + cells[800]->set_neighbors(cells[633],cells[369],cells[632],cells[302]); + set_offsets(cells[800],0,0,0,0); + cells[801]->set_vertices(vertices[75],vertices[132],vertices[123],vertices[83]); + cells[801]->set_neighbors(cells[763],cells[781],cells[633],cells[418]); + set_offsets(cells[801],0,0,0,0); + cells[802]->set_vertices(vertices[115],vertices[107],vertices[164],vertices[116]); + cells[802]->set_neighbors(cells[761],cells[970],cells[286],cells[715]); + set_offsets(cells[802],0,0,0,0); + cells[803]->set_vertices(vertices[3],vertices[12],vertices[11],vertices[251]); + cells[803]->set_neighbors(cells[183],cells[9],cells[1468],cells[105]); + set_offsets(cells[803],4,4,4,0); + cells[804]->set_vertices(vertices[170],vertices[162],vertices[163],vertices[115]); + cells[804]->set_neighbors(cells[1001],cells[687],cells[841],cells[775]); + set_offsets(cells[804],0,0,0,0); + cells[805]->set_vertices(vertices[141],vertices[142],vertices[133],vertices[190]); + cells[805]->set_neighbors(cells[935],cells[934],cells[1046],cells[882]); + set_offsets(cells[805],0,0,0,0); + cells[806]->set_vertices(vertices[87],vertices[88],vertices[136],vertices[95]); + cells[806]->set_neighbors(cells[727],cells[531],cells[607],cells[273]); + set_offsets(cells[806],0,1,1,0); + cells[807]->set_vertices(vertices[134],vertices[126],vertices[127],vertices[79]); + cells[807]->set_neighbors(cells[759],cells[808],cells[414],cells[710]); + set_offsets(cells[807],0,0,0,0); + cells[808]->set_vertices(vertices[87],vertices[134],vertices[127],vertices[79]); + cells[808]->set_neighbors(cells[807],cells[737],cells[55],cells[822]); + set_offsets(cells[808],0,0,0,0); + cells[809]->set_vertices(vertices[127],vertices[168],vertices[119],vertices[167]); + cells[809]->set_neighbors(cells[741],cells[869],cells[1078],cells[1019]); + set_offsets(cells[809],0,1,0,0); + cells[810]->set_vertices(vertices[175],vertices[222],vertices[215],vertices[167]); + cells[810]->set_neighbors(cells[1306],cells[69],cells[1310],cells[989]); + set_offsets(cells[810],0,0,0,0); + cells[811]->set_vertices(vertices[210],vertices[153],vertices[201],vertices[202]); + cells[811]->set_neighbors(cells[48],cells[1500],cells[208],cells[1027]); + set_offsets(cells[811],0,0,0,0); + cells[812]->set_vertices(vertices[85],vertices[140],vertices[92],vertices[93]); + cells[812]->set_neighbors(cells[50],cells[598],cells[543],cells[871]); + set_offsets(cells[812],0,0,0,0); + cells[813]->set_vertices(vertices[79],vertices[80],vertices[120],vertices[128]); + cells[813]->set_neighbors(cells[735],cells[88],cells[661],cells[684]); + set_offsets(cells[813],0,1,1,1); + cells[814]->set_vertices(vertices[130],vertices[82],vertices[122],vertices[75]); + cells[814]->set_neighbors(cells[697],cells[594],cells[68],cells[778]); + set_offsets(cells[814],0,0,0,0); + cells[815]->set_vertices(vertices[137],vertices[89],vertices[136],vertices[129]); + cells[815]->set_neighbors(cells[299],cells[445],cells[161],cells[857]); + set_offsets(cells[815],0,0,0,0); + cells[816]->set_vertices(vertices[184],vertices[143],vertices[135],vertices[136]); + cells[816]->set_neighbors(cells[672],cells[1074],cells[316],cells[904]); + set_offsets(cells[816],1,0,0,1); + cells[817]->set_vertices(vertices[178],vertices[186],vertices[131],vertices[179]); + cells[817]->set_neighbors(cells[653],cells[1097],cells[771],cells[1127]); + set_offsets(cells[817],0,0,0,0); + cells[818]->set_vertices(vertices[170],vertices[113],vertices[162],vertices[122]); + cells[818]->set_neighbors(cells[748],cells[841],cells[792],cells[954]); + set_offsets(cells[818],0,0,0,0); + cells[819]->set_vertices(vertices[130],vertices[131],vertices[83],vertices[123]); + cells[819]->set_neighbors(cells[763],cells[781],cells[1050],cells[829]); + set_offsets(cells[819],0,0,0,0); + cells[820]->set_vertices(vertices[83],vertices[138],vertices[90],vertices[91]); + cells[820]->set_neighbors(cells[14],cells[152],cells[340],cells[776]); + set_offsets(cells[820],0,0,0,0); + cells[821]->set_vertices(vertices[138],vertices[89],vertices[90],vertices[50]); + cells[821]->set_neighbors(cells[399],cells[14],cells[855],cells[789]); + set_offsets(cells[821],0,0,0,2); + cells[822]->set_vertices(vertices[127],vertices[135],vertices[134],vertices[87]); + cells[822]->set_neighbors(cells[140],cells[808],cells[758],cells[159]); + set_offsets(cells[822],0,0,0,0); + cells[823]->set_vertices(vertices[139],vertices[51],vertices[91],vertices[100]); + cells[823]->set_neighbors(cells[162],cells[827],cells[791],cells[54]); + set_offsets(cells[823],0,2,0,2); + cells[824]->set_vertices(vertices[99],vertices[146],vertices[139],vertices[98]); + cells[824]->set_neighbors(cells[1081],cells[872],cells[595],cells[1137]); + set_offsets(cells[824],2,2,0,2); + cells[825]->set_vertices(vertices[188],vertices[141],vertices[133],vertices[181]); + cells[825]->set_neighbors(cells[934],cells[490],cells[926],cells[695]); + set_offsets(cells[825],0,0,0,0); + cells[826]->set_vertices(vertices[123],vertices[115],vertices[163],vertices[172]); + cells[826]->set_neighbors(cells[772],cells[917],cells[845],cells[687]); + set_offsets(cells[826],0,0,0,0); + cells[827]->set_vertices(vertices[100],vertices[91],vertices[139],vertices[140]); + cells[827]->set_neighbors(cells[836],cells[1096],cells[492],cells[823]); + set_offsets(cells[827],2,0,0,0); + cells[828]->set_vertices(vertices[132],vertices[133],vertices[85],vertices[125]); + cells[828]->set_neighbors(cells[109],cells[795],cells[1064],cells[625]); + set_offsets(cells[828],0,0,0,0); + cells[829]->set_vertices(vertices[130],vertices[138],vertices[83],vertices[131]); + cells[829]->set_neighbors(cells[340],cells[819],cells[999],cells[776]); + set_offsets(cells[829],0,0,0,0); + cells[830]->set_vertices(vertices[229],vertices[236],vertices[181],vertices[189]); + cells[830]->set_neighbors(cells[1114],cells[1163],cells[1427],cells[1184]); + set_offsets(cells[830],0,0,0,0); + cells[831]->set_vertices(vertices[101],vertices[102],vertices[150],vertices[110]); + cells[831]->set_neighbors(cells[932],cells[740],cells[427],cells[937]); + set_offsets(cells[831],0,0,0,0); + cells[832]->set_vertices(vertices[220],vertices[211],vertices[260],vertices[212]); + cells[832]->set_neighbors(cells[1336],cells[1284],cells[1062],cells[1365]); + set_offsets(cells[832],0,0,0,0); + cells[833]->set_vertices(vertices[172],vertices[163],vertices[212],vertices[164]); + cells[833]->set_neighbors(cells[57],cells[983],cells[772],cells[81]); + set_offsets(cells[833],0,0,0,0); + cells[834]->set_vertices(vertices[93],vertices[85],vertices[133],vertices[142]); + cells[834]->set_neighbors(cells[389],cells[882],cells[667],cells[543]); + set_offsets(cells[834],0,0,0,0); + cells[835]->set_vertices(vertices[140],vertices[91],vertices[131],vertices[83]); + cells[835]->set_neighbors(cells[340],cells[743],cells[416],cells[836]); + set_offsets(cells[835],0,0,0,0); + cells[836]->set_vertices(vertices[140],vertices[91],vertices[139],vertices[131]); + cells[836]->set_neighbors(cells[376],cells[620],cells[835],cells[827]); + set_offsets(cells[836],0,0,0,0); + cells[837]->set_vertices(vertices[223],vertices[216],vertices[175],vertices[215]); + cells[837]->set_neighbors(cells[69],cells[989],cells[1604],cells[1085]); + set_offsets(cells[837],0,1,0,0); + cells[838]->set_vertices(vertices[103],vertices[55],vertices[143],vertices[96]); + cells[838]->set_neighbors(cells[899],cells[489],cells[132],cells[903]); + set_offsets(cells[838],2,2,0,3); + cells[839]->set_vertices(vertices[95],vertices[136],vertices[96],vertices[48]); + cells[839]->set_neighbors(cells[350],cells[576],cells[727],cells[671]); + set_offsets(cells[839],0,1,3,3); + cells[840]->set_vertices(vertices[187],vertices[194],vertices[146],vertices[147]); + cells[840]->set_neighbors(cells[922],cells[1136],cells[1420],cells[1115]); + set_offsets(cells[840],0,2,2,2); + cells[841]->set_vertices(vertices[170],vertices[162],vertices[115],vertices[122]); + cells[841]->set_neighbors(cells[517],cells[924],cells[818],cells[804]); + set_offsets(cells[841],0,0,0,0); + cells[842]->set_vertices(vertices[105],vertices[112],vertices[152],vertices[104]); + cells[842]->set_neighbors(cells[680],cells[593],cells[227],cells[678]); + set_offsets(cells[842],0,0,0,0); + cells[843]->set_vertices(vertices[155],vertices[107],vertices[147],vertices[156]); + cells[843]->set_neighbors(cells[153],cells[1029],cells[866],cells[961]); + set_offsets(cells[843],0,0,0,0); + cells[844]->set_vertices(vertices[126],vertices[117],vertices[166],vertices[118]); + cells[844]->set_neighbors(cells[224],cells[1013],cells[603],cells[463]); + set_offsets(cells[844],0,0,0,0); + cells[845]->set_vertices(vertices[123],vertices[115],vertices[172],vertices[124]); + cells[845]->set_neighbors(cells[56],cells[572],cells[548],cells[826]); + set_offsets(cells[845],0,0,0,0); + cells[846]->set_vertices(vertices[133],vertices[125],vertices[173],vertices[182]); + cells[846]->set_neighbors(cells[589],cells[986],cells[590],cells[1016]); + set_offsets(cells[846],0,0,0,0); + cells[847]->set_vertices(vertices[182],vertices[222],vertices[175],vertices[174]); + cells[847]->set_neighbors(cells[1310],cells[422],cells[1071],cells[1357]); + set_offsets(cells[847],0,0,0,0); + cells[848]->set_vertices(vertices[135],vertices[95],vertices[142],vertices[87]); + cells[848]->set_neighbors(cells[849],cells[140],cells[531],cells[902]); + set_offsets(cells[848],0,0,0,0); + cells[849]->set_vertices(vertices[142],vertices[95],vertices[94],vertices[87]); + cells[849]->set_neighbors(cells[606],cells[850],cells[848],cells[351]); + set_offsets(cells[849],0,0,0,0); + cells[850]->set_vertices(vertices[134],vertices[142],vertices[94],vertices[87]); + cells[850]->set_neighbors(cells[849],cells[218],cells[140],cells[880]); + set_offsets(cells[850],0,0,0,0); + cells[851]->set_vertices(vertices[183],vertices[230],vertices[223],vertices[175]); + cells[851]->set_neighbors(cells[1351],cells[753],cells[1356],cells[1297]); + set_offsets(cells[851],0,0,0,0); + cells[852]->set_vertices(vertices[196],vertices[148],vertices[149],vertices[156]); + cells[852]->set_neighbors(cells[417],cells[37],cells[1192],cells[862]); + set_offsets(cells[852],0,0,0,0); + cells[853]->set_vertices(vertices[184],vertices[137],vertices[129],vertices[177]); + cells[853]->set_neighbors(cells[878],cells[542],cells[1090],cells[445]); + set_offsets(cells[853],0,0,0,0); + cells[854]->set_vertices(vertices[130],vertices[170],vertices[123],vertices[122]); + cells[854]->set_neighbors(cells[924],cells[594],cells[521],cells[1051]); + set_offsets(cells[854],0,0,0,0); + cells[855]->set_vertices(vertices[98],vertices[89],vertices[138],vertices[50]); + cells[855]->set_neighbors(cells[821],cells[696],cells[631],cells[856]); + set_offsets(cells[855],2,0,0,2); + cells[856]->set_vertices(vertices[98],vertices[89],vertices[137],vertices[138]); + cells[856]->set_neighbors(cells[161],cells[688],cells[855],cells[859]); + set_offsets(cells[856],2,0,0,0); + cells[857]->set_vertices(vertices[96],vertices[89],vertices[136],vertices[137]); + cells[857]->set_neighbors(cells[815],cells[685],cells[858],cells[350]); + set_offsets(cells[857],2,0,0,0); + cells[858]->set_vertices(vertices[96],vertices[49],vertices[89],vertices[137]); + cells[858]->set_neighbors(cells[859],cells[857],cells[861],cells[111]); + set_offsets(cells[858],2,2,0,0); + cells[859]->set_vertices(vertices[137],vertices[49],vertices[89],vertices[98]); + cells[859]->set_neighbors(cells[631],cells[856],cells[860],cells[858]); + set_offsets(cells[859],0,2,0,2); + cells[860]->set_vertices(vertices[97],vertices[49],vertices[137],vertices[98]); + cells[860]->set_neighbors(cells[859],cells[915],cells[483],cells[861]); + set_offsets(cells[860],2,2,0,2); + cells[861]->set_vertices(vertices[96],vertices[49],vertices[137],vertices[97]); + cells[861]->set_neighbors(cells[860],cells[67],cells[636],cells[858]); + set_offsets(cells[861],2,2,0,2); + cells[862]->set_vertices(vertices[189],vertices[196],vertices[148],vertices[149]); + cells[862]->set_neighbors(cells[852],cells[1146],cells[1429],cells[126]); + set_offsets(cells[862],0,2,2,2); + cells[863]->set_vertices(vertices[229],vertices[181],vertices[221],vertices[230]); + cells[863]->set_neighbors(cells[1109],cells[1166],cells[1168],cells[1375]); + set_offsets(cells[863],0,0,0,0); + cells[864]->set_vertices(vertices[194],vertices[147],vertices[235],vertices[195]); + cells[864]->set_neighbors(cells[1376],cells[1002],cells[1227],cells[1420]); + set_offsets(cells[864],2,2,0,2); + cells[865]->set_vertices(vertices[165],vertices[157],vertices[205],vertices[214]); + cells[865]->set_neighbors(cells[1294],cells[1250],cells[985],cells[1255]); + set_offsets(cells[865],0,0,0,0); + cells[866]->set_vertices(vertices[164],vertices[107],vertices[155],vertices[156]); + cells[866]->set_neighbors(cells[843],cells[1030],cells[761],cells[715]); + set_offsets(cells[866],0,0,0,0); + cells[867]->set_vertices(vertices[104],vertices[152],vertices[103],vertices[111]); + cells[867]->set_neighbors(cells[898],cells[698],cells[680],cells[908]); + set_offsets(cells[867],1,1,0,0); + cells[868]->set_vertices(vertices[151],vertices[103],vertices[144],vertices[152]); + cells[868]->set_neighbors(cells[908],cells[893],cells[898],cells[1033]); + set_offsets(cells[868],0,0,1,1); + cells[869]->set_vertices(vertices[127],vertices[174],vertices[167],vertices[119]); + cells[869]->set_neighbors(cells[24],cells[809],cells[196],cells[1077]); + set_offsets(cells[869],0,0,0,0); + cells[870]->set_vertices(vertices[180],vertices[171],vertices[220],vertices[172]); + cells[870]->set_neighbors(cells[233],cells[155],cells[1063],cells[259]); + set_offsets(cells[870],0,0,0,0); + cells[871]->set_vertices(vertices[85],vertices[132],vertices[92],vertices[140]); + cells[871]->set_neighbors(cells[369],cells[812],cells[625],cells[632]); + set_offsets(cells[871],0,0,0,0); + cells[872]->set_vertices(vertices[98],vertices[51],vertices[139],vertices[99]); + cells[872]->set_neighbors(cells[791],cells[824],cells[511],cells[54]); + set_offsets(cells[872],2,2,0,2); + cells[873]->set_vertices(vertices[226],vertices[169],vertices[217],vertices[218]); + cells[873]->set_neighbors(cells[1307],cells[1131],cells[4],cells[1186]); + set_offsets(cells[873],0,0,0,0); + cells[874]->set_vertices(vertices[34],vertices[275],vertices[267],vertices[27]); + cells[874]->set_neighbors(cells[1389],cells[1565],cells[1660],cells[1524]); + set_offsets(cells[874],4,0,0,4); + cells[875]->set_vertices(vertices[14],vertices[262],vertices[255],vertices[22]); + cells[875]->set_neighbors(cells[1025],cells[1494],cells[222],cells[1234]); + set_offsets(cells[875],4,0,0,4); + cells[876]->set_vertices(vertices[258],vertices[201],vertices[250],vertices[210]); + cells[876]->set_neighbors(cells[1500],cells[1285],cells[1288],cells[1562]); + set_offsets(cells[876],0,0,0,0); + cells[877]->set_vertices(vertices[186],vertices[137],vertices[185],vertices[177]); + cells[877]->set_neighbors(cells[1090],cells[1173],cells[878],cells[1125]); + set_offsets(cells[877],0,0,0,0); + cells[878]->set_vertices(vertices[186],vertices[137],vertices[177],vertices[129]); + cells[878]->set_neighbors(cells[853],cells[946],cells[652],cells[877]); + set_offsets(cells[878],0,0,0,0); + cells[879]->set_vertices(vertices[93],vertices[142],vertices[141],vertices[102]); + cells[879]->set_neighbors(cells[1046],cells[885],cells[798],cells[882]); + set_offsets(cells[879],0,0,0,2); + cells[880]->set_vertices(vertices[142],vertices[94],vertices[85],vertices[134]); + cells[880]->set_neighbors(cells[142],cells[389],cells[850],cells[667]); + set_offsets(cells[880],0,0,0,0); + cells[881]->set_vertices(vertices[93],vertices[54],vertices[94],vertices[142]); + cells[881]->set_neighbors(cells[351],cells[667],cells[798],cells[255]); + set_offsets(cells[881],0,2,0,0); + cells[882]->set_vertices(vertices[93],vertices[133],vertices[141],vertices[142]); + cells[882]->set_neighbors(cells[805],cells[879],cells[834],cells[884]); + set_offsets(cells[882],0,0,0,0); + cells[883]->set_vertices(vertices[100],vertices[93],vertices[140],vertices[141]); + cells[883]->set_neighbors(cells[884],cells[1113],cells[886],cells[788]); + set_offsets(cells[883],2,0,0,0); + cells[884]->set_vertices(vertices[141],vertices[93],vertices[140],vertices[133]); + cells[884]->set_neighbors(cells[543],cells[695],cells[882],cells[883]); + set_offsets(cells[884],0,0,0,0); + cells[885]->set_vertices(vertices[53],vertices[102],vertices[93],vertices[141]); + cells[885]->set_neighbors(cells[879],cells[886],cells[888],cells[668]); + set_offsets(cells[885],2,2,0,0); + cells[886]->set_vertices(vertices[53],vertices[141],vertices[93],vertices[100]); + cells[886]->set_neighbors(cells[883],cells[651],cells[887],cells[885]); + set_offsets(cells[886],2,0,0,2); + cells[887]->set_vertices(vertices[53],vertices[101],vertices[141],vertices[100]); + cells[887]->set_neighbors(cells[707],cells[886],cells[382],cells[888]); + set_offsets(cells[887],2,2,0,2); + cells[888]->set_vertices(vertices[53],vertices[102],vertices[141],vertices[101]); + cells[888]->set_neighbors(cells[937],cells[887],cells[427],cells[885]); + set_offsets(cells[888],2,2,0,2); + cells[889]->set_vertices(vertices[225],vertices[234],vertices[177],vertices[226]); + cells[889]->set_neighbors(cells[1185],cells[1187],cells[1655],cells[1416]); + set_offsets(cells[889],0,0,0,0); + cells[890]->set_vertices(vertices[243],vertices[4],vertices[43],vertices[3]); + cells[890]->set_neighbors(cells[331],cells[1228],cells[1457],cells[1456]); + set_offsets(cells[890],2,6,4,6); + cells[891]->set_vertices(vertices[221],vertices[268],vertices[261],vertices[213]); + cells[891]->set_neighbors(cells[522],cells[127],cells[1381],cells[1633]); + set_offsets(cells[891],0,0,0,0); + cells[892]->set_vertices(vertices[191],vertices[103],vertices[143],vertices[144]); + cells[892]->set_neighbors(cells[489],cells[1153],cells[1033],cells[1158]); + set_offsets(cells[892],0,2,0,3); + cells[893]->set_vertices(vertices[151],vertices[144],vertices[192],vertices[152]); + cells[893]->set_neighbors(cells[686],cells[455],cells[868],cells[909]); + set_offsets(cells[893],0,1,1,1); + cells[894]->set_vertices(vertices[99],vertices[100],vertices[148],vertices[108]); + cells[894]->set_neighbors(cells[734],cells[720],cells[64],cells[648]); + set_offsets(cells[894],0,0,0,0); + cells[895]->set_vertices(vertices[141],vertices[102],vertices[190],vertices[150]); + cells[895]->set_neighbors(cells[757],cells[1145],cells[937],cells[1046]); + set_offsets(cells[895],0,2,0,2); + cells[896]->set_vertices(vertices[180],vertices[188],vertices[179],vertices[131]); + cells[896]->set_neighbors(cells[1061],cells[1095],cells[621],cells[925]); + set_offsets(cells[896],0,0,0,0); + cells[897]->set_vertices(vertices[188],vertices[139],vertices[187],vertices[179]); + cells[897]->set_neighbors(cells[1098],cells[1392],cells[1061],cells[1134]); + set_offsets(cells[897],0,0,0,0); + cells[898]->set_vertices(vertices[151],vertices[103],vertices[152],vertices[111]); + cells[898]->set_neighbors(cells[867],cells[241],cells[409],cells[868]); + set_offsets(cells[898],0,0,1,0); + cells[899]->set_vertices(vertices[143],vertices[55],vertices[95],vertices[96]); + cells[899]->set_neighbors(cells[576],cells[671],cells[838],cells[900]); + set_offsets(cells[899],0,2,0,3); + cells[900]->set_vertices(vertices[102],vertices[55],vertices[95],vertices[143]); + cells[900]->set_neighbors(cells[899],cells[901],cells[903],cells[669]); + set_offsets(cells[900],2,2,0,0); + cells[901]->set_vertices(vertices[143],vertices[95],vertices[102],vertices[142]); + cells[901]->set_neighbors(cells[675],cells[1118],cells[902],cells[900]); + set_offsets(cells[901],0,0,2,0); + cells[902]->set_vertices(vertices[135],vertices[95],vertices[143],vertices[142]); + cells[902]->set_neighbors(cells[901],cells[1082],cells[848],cells[672]); + set_offsets(cells[902],0,0,0,0); + cells[903]->set_vertices(vertices[102],vertices[55],vertices[143],vertices[103]); + cells[903]->set_neighbors(cells[838],cells[938],cells[657],cells[900]); + set_offsets(cells[903],2,2,0,2); + cells[904]->set_vertices(vertices[184],vertices[143],vertices[183],vertices[135]); + cells[904]->set_neighbors(cells[920],cells[998],cells[816],cells[1154]); + set_offsets(cells[904],1,0,0,0); + cells[905]->set_vertices(vertices[211],vertices[163],vertices[203],vertices[212]); + cells[905]->set_neighbors(cells[441],cells[1336],cells[1062],cells[364]); + set_offsets(cells[905],0,0,0,0); + cells[906]->set_vertices(vertices[145],vertices[97],vertices[105],vertices[152]); + cells[906]->set_neighbors(cells[593],cells[951],cells[614],cells[557]); + set_offsets(cells[906],0,0,0,0); + cells[907]->set_vertices(vertices[99],vertices[108],vertices[156],vertices[107]); + cells[907]->set_neighbors(cells[756],cells[153],cells[630],cells[720]); + set_offsets(cells[907],0,0,0,0); + cells[908]->set_vertices(vertices[104],vertices[144],vertices[103],vertices[152]); + cells[908]->set_neighbors(cells[868],cells[867],cells[797],cells[638]); + set_offsets(cells[908],1,1,0,1); + cells[909]->set_vertices(vertices[192],vertices[144],vertices[151],vertices[191]); + cells[909]->set_neighbors(cells[1033],cells[345],cells[1259],cells[893]); + set_offsets(cells[909],3,3,2,0); + cells[910]->set_vertices(vertices[32],vertices[265],vertices[272],vertices[24]); + cells[910]->set_neighbors(cells[1318],cells[1492],cells[1610],cells[1657]); + set_offsets(cells[910],4,0,0,4); + cells[911]->set_vertices(vertices[278],vertices[269],vertices[30],vertices[270]); + cells[911]->set_neighbors(cells[1390],cells[1589],cells[1479],cells[346]); + set_offsets(cells[911],0,0,4,0); + cells[912]->set_vertices(vertices[251],vertices[18],vertices[11],vertices[10]); + cells[912]->set_neighbors(cells[106],cells[9],cells[749],cells[1518]); + set_offsets(cells[912],0,4,4,4); + cells[913]->set_vertices(vertices[232],vertices[184],vertices[224],vertices[177]); + cells[913]->set_neighbors(cells[1084],cells[1396],cells[1347],cells[1398]); + set_offsets(cells[913],0,0,0,0); + cells[914]->set_vertices(vertices[185],vertices[144],vertices[145],vertices[192]); + cells[914]->set_neighbors(cells[686],cells[1409],cells[1053],cells[1130]); + set_offsets(cells[914],0,2,2,2); + cells[915]->set_vertices(vertices[146],vertices[97],vertices[137],vertices[98]); + cells[915]->set_neighbors(cells[860],cells[1124],cells[626],cells[1089]); + set_offsets(cells[915],2,2,0,2); + cells[916]->set_vertices(vertices[227],vertices[226],vertices[274],vertices[219]); + cells[916]->set_neighbors(cells[529],cells[1440],cells[1372],cells[1654]); + set_offsets(cells[916],0,0,0,0); + cells[917]->set_vertices(vertices[171],vertices[123],vertices[163],vertices[172]); + cells[917]->set_neighbors(cells[826],cells[233],cells[1063],cells[1055]); + set_offsets(cells[917],0,0,0,0); + cells[918]->set_vertices(vertices[174],vertices[165],vertices[214],vertices[166]); + cells[918]->set_neighbors(cells[985],cells[1075],cells[1042],cells[256]); + set_offsets(cells[918],0,0,0,0); + cells[919]->set_vertices(vertices[216],vertices[208],vertices[167],vertices[215]); + cells[919]->set_neighbors(cells[1204],cells[69],cells[1545],cells[1312]); + set_offsets(cells[919],1,1,0,0); + cells[920]->set_vertices(vertices[183],vertices[143],vertices[190],vertices[135]); + cells[920]->set_neighbors(cells[1082],cells[760],cells[904],cells[1155]); + set_offsets(cells[920],0,0,0,0); + cells[921]->set_vertices(vertices[238],vertices[190],vertices[189],vertices[181]); + cells[921]->set_neighbors(cells[1067],cells[1163],cells[348],cells[1167]); + set_offsets(cells[921],0,0,0,0); + cells[922]->set_vertices(vertices[147],vertices[146],vertices[154],vertices[194]); + cells[922]->set_neighbors(cells[719],cells[1191],cells[840],cells[461]); + set_offsets(cells[922],0,0,0,0); + cells[923]->set_vertices(vertices[178],vertices[170],vertices[171],vertices[123]); + cells[923]->set_neighbors(cells[1055],cells[1054],cells[1051],cells[1080]); + set_offsets(cells[923],0,0,0,0); + cells[924]->set_vertices(vertices[123],vertices[170],vertices[115],vertices[122]); + cells[924]->set_neighbors(cells[841],cells[474],cells[854],cells[687]); + set_offsets(cells[924],0,0,0,0); + cells[925]->set_vertices(vertices[180],vertices[188],vertices[228],vertices[179]); + cells[925]->set_neighbors(cells[133],cells[261],cells[896],cells[1325]); + set_offsets(cells[925],0,0,0,0); + cells[926]->set_vertices(vertices[189],vertices[141],vertices[188],vertices[181]); + cells[926]->set_neighbors(cells[825],cells[1114],cells[1067],cells[116]); + set_offsets(cells[926],0,0,0,0); + cells[927]->set_vertices(vertices[180],vertices[140],vertices[132],vertices[133]); + cells[927]->set_neighbors(cells[625],cells[1064],cells[1123],cells[1068]); + set_offsets(cells[927],0,0,0,0); + cells[928]->set_vertices(vertices[132],vertices[172],vertices[125],vertices[124]); + cells[928]->set_neighbors(cells[459],cells[472],cells[572],cells[711]); + set_offsets(cells[928],0,0,0,0); + cells[929]->set_vertices(vertices[4],vertices[243],vertices[244],vertices[252]); + cells[929]->set_neighbors(cells[1453],cells[1523],cells[1379],cells[1283]); + set_offsets(cells[929],4,0,0,0); + cells[930]->set_vertices(vertices[225],vertices[265],vertices[273],vertices[274]); + cells[930]->set_neighbors(cells[83],cells[1692],cells[1330],cells[1656]); + set_offsets(cells[930],0,0,0,0); + cells[931]->set_vertices(vertices[2],vertices[283],vertices[42],vertices[43]); + cells[931]->set_neighbors(cells[1139],cells[477],cells[1445],cells[1699]); + set_offsets(cells[931],6,0,4,4); + cells[932]->set_vertices(vertices[150],vertices[102],vertices[103],vertices[110]); + cells[932]->set_neighbors(cells[657],cells[253],cells[831],cells[938]); + set_offsets(cells[932],0,0,0,0); + cells[933]->set_vertices(vertices[125],vertices[117],vertices[174],vertices[126]); + cells[933]->set_neighbors(cells[463],cells[736],cells[400],cells[982]); + set_offsets(cells[933],0,0,0,0); + cells[934]->set_vertices(vertices[141],vertices[133],vertices[181],vertices[190]); + cells[934]->set_neighbors(cells[694],cells[1067],cells[805],cells[825]); + set_offsets(cells[934],0,0,0,0); + cells[935]->set_vertices(vertices[190],vertices[142],vertices[133],vertices[182]); + cells[935]->set_neighbors(cells[1105],cells[694],cells[1083],cells[805]); + set_offsets(cells[935],0,0,0,0); + cells[936]->set_vertices(vertices[231],vertices[278],vertices[279],vertices[271]); + cells[936]->set_neighbors(cells[1245],cells[1093],cells[1643],cells[1715]); + set_offsets(cells[936],0,0,0,0); + cells[937]->set_vertices(vertices[101],vertices[102],vertices[141],vertices[150]); + cells[937]->set_neighbors(cells[895],cells[1104],cells[831],cells[888]); + set_offsets(cells[937],2,2,0,2); + cells[938]->set_vertices(vertices[150],vertices[102],vertices[143],vertices[103]); + cells[938]->set_neighbors(cells[903],cells[1158],cells[932],cells[757]); + set_offsets(cells[938],2,2,0,2); + cells[939]->set_vertices(vertices[23],vertices[263],vertices[16],vertices[24]); + cells[939]->set_neighbors(cells[1233],cells[297],cells[1590],cells[1235]); + set_offsets(cells[939],4,0,5,5); + cells[940]->set_vertices(vertices[256],vertices[201],vertices[208],vertices[248]); + cells[940]->set_neighbors(cells[1210],cells[1508],cells[1543],cells[176]); + set_offsets(cells[940],0,0,0,0); + cells[941]->set_vertices(vertices[151],vertices[200],vertices[159],vertices[152]); + cells[941]->set_neighbors(cells[1214],cells[241],cells[455],cells[1222]); + set_offsets(cells[941],0,1,0,1); + cells[942]->set_vertices(vertices[101],vertices[150],vertices[149],vertices[158]); + cells[942]->set_neighbors(cells[643],cells[691],cells[740],cells[1147]); + set_offsets(cells[942],0,0,0,0); + cells[943]->set_vertices(vertices[228],vertices[219],vertices[268],vertices[220]); + cells[943]->set_neighbors(cells[1386],cells[1366],cells[962],cells[1374]); + set_offsets(cells[943],0,0,0,0); + cells[944]->set_vertices(vertices[14],vertices[254],vertices[247],vertices[255]); + cells[944]->set_neighbors(cells[1291],cells[708],cells[1234],cells[1239]); + set_offsets(cells[944],4,0,0,0); + cells[945]->set_vertices(vertices[3],vertices[243],vertices[251],vertices[10]); + cells[945]->set_neighbors(cells[1007],cells[9],cells[1423],cells[1468]); + set_offsets(cells[945],4,0,0,4); + cells[946]->set_vertices(vertices[178],vertices[186],vertices[177],vertices[129]); + cells[946]->set_neighbors(cells[878],cells[646],cells[656],cells[1039]); + set_offsets(cells[946],0,0,0,0); + cells[947]->set_vertices(vertices[210],vertices[250],vertices[203],vertices[202]); + cells[947]->set_neighbors(cells[665],cells[1236],cells[1500],cells[1285]); + set_offsets(cells[947],0,0,0,0); + cells[948]->set_vertices(vertices[273],vertices[34],vertices[25],vertices[33]); + cells[948]->set_neighbors(cells[74],cells[1412],cells[1438],cells[1659]); + set_offsets(cells[948],0,4,4,4); + cells[949]->set_vertices(vertices[113],vertices[120],vertices[160],vertices[112]); + cells[949]->set_neighbors(cells[978],cells[956],cells[272],cells[662]); + set_offsets(cells[949],0,0,0,0); + cells[950]->set_vertices(vertices[114],vertices[105],vertices[154],vertices[106]); + cells[950]->set_neighbors(cells[366],cells[501],cells[212],cells[793]); + set_offsets(cells[950],0,0,0,0); + cells[951]->set_vertices(vertices[153],vertices[105],vertices[152],vertices[145]); + cells[951]->set_neighbors(cells[906],cells[1102],cells[73],cells[43]); + set_offsets(cells[951],0,0,0,0); + cells[952]->set_vertices(vertices[244],vertices[195],vertices[196],vertices[204]); + cells[952]->set_neighbors(cells[309],cells[1244],cells[1377],cells[1458]); + set_offsets(cells[952],0,0,0,0); + cells[953]->set_vertices(vertices[173],vertices[172],vertices[165],vertices[125]); + cells[953]->set_neighbors(cells[91],cells[540],cells[993],cells[1302]); + set_offsets(cells[953],0,0,0,0); + cells[954]->set_vertices(vertices[170],vertices[113],vertices[161],vertices[162]); + cells[954]->set_neighbors(cells[746],cells[1008],cells[818],cells[139]); + set_offsets(cells[954],0,0,0,0); + cells[955]->set_vertices(vertices[113],vertices[105],vertices[160],vertices[153]); + cells[955]->set_neighbors(cells[43],cells[701],cells[512],cells[956]); + set_offsets(cells[955],0,0,0,0); + cells[956]->set_vertices(vertices[112],vertices[105],vertices[160],vertices[113]); + cells[956]->set_neighbors(cells[955],cells[949],cells[729],cells[678]); + set_offsets(cells[956],0,0,0,0); + cells[957]->set_vertices(vertices[279],vertices[287],vertices[239],vertices[280]); + cells[957]->set_neighbors(cells[1676],cells[1247],cells[1180],cells[1725]); + set_offsets(cells[957],0,0,0,1); + cells[958]->set_vertices(vertices[219],vertices[266],vertices[259],vertices[211]); + cells[958]->set_neighbors(cells[1564],cells[1575],cells[1334],cells[1622]); + set_offsets(cells[958],0,0,0,0); + cells[959]->set_vertices(vertices[178],vertices[169],vertices[218],vertices[170]); + cells[959]->set_neighbors(cells[165],cells[1080],cells[634],cells[4]); + set_offsets(cells[959],0,0,0,0); + cells[960]->set_vertices(vertices[209],vertices[161],vertices[201],vertices[210]); + cells[960]->set_neighbors(cells[1027],cells[1288],cells[979],cells[138]); + set_offsets(cells[960],0,0,0,0); + cells[961]->set_vertices(vertices[155],vertices[154],vertices[147],vertices[107]); + cells[961]->set_neighbors(cells[704],cells[843],cells[770],cells[100]); + set_offsets(cells[961],0,0,0,0); + cells[962]->set_vertices(vertices[228],vertices[171],vertices[219],vertices[220]); + cells[962]->set_neighbors(cells[1272],cells[943],cells[259],cells[1122]); + set_offsets(cells[962],0,0,0,0); + cells[963]->set_vertices(vertices[247],vertices[8],vertices[0],vertices[7]); + cells[963]->set_neighbors(cells[10],cells[1353],cells[1263],cells[1442]); + set_offsets(cells[963],0,5,5,4); + cells[964]->set_vertices(vertices[213],vertices[212],vertices[260],vertices[205]); + cells[964]->set_neighbors(cells[95],cells[1319],cells[1241],cells[1284]); + set_offsets(cells[964],0,0,0,0); + cells[965]->set_vertices(vertices[129],vertices[184],vertices[176],vertices[136]); + cells[965]->set_neighbors(cells[1074],cells[1073],cells[445],cells[542]); + set_offsets(cells[965],0,0,0,0); + cells[966]->set_vertices(vertices[4],vertices[12],vertices[245],vertices[5]); + cells[966]->set_neighbors(cells[1531],cells[236],cells[337],cells[1175]); + set_offsets(cells[966],4,4,0,4); + cells[967]->set_vertices(vertices[208],vertices[153],vertices[200],vertices[201]); + cells[967]->set_neighbors(cells[1229],cells[1210],cells[25],cells[997]); + set_offsets(cells[967],0,0,0,0); + cells[968]->set_vertices(vertices[163],vertices[210],vertices[203],vertices[155]); + cells[968]->set_neighbors(cells[1236],cells[441],cells[1010],cells[364]); + set_offsets(cells[968],0,0,0,0); + cells[969]->set_vertices(vertices[162],vertices[105],vertices[153],vertices[154]); + cells[969]->set_neighbors(cells[73],cells[783],cells[793],cells[512]); + set_offsets(cells[969],0,0,0,0); + cells[970]->set_vertices(vertices[124],vertices[115],vertices[164],vertices[116]); + cells[970]->set_neighbors(cells[802],cells[693],cells[663],cells[56]); + set_offsets(cells[970],0,0,0,0); + cells[971]->set_vertices(vertices[157],vertices[156],vertices[149],vertices[109]); + cells[971]->set_neighbors(cells[747],cells[164],cells[647],cells[1190]); + set_offsets(cells[971],0,0,0,0); + cells[972]->set_vertices(vertices[238],vertices[230],vertices[231],vertices[183]); + cells[972]->set_neighbors(cells[1297],cells[323],cells[419],cells[1675]); + set_offsets(cells[972],0,0,0,0); + cells[973]->set_vertices(vertices[191],vertices[150],vertices[238],vertices[190]); + cells[973]->set_neighbors(cells[1167],cells[325],cells[1156],cells[1431]); + set_offsets(cells[973],0,2,0,0); + cells[974]->set_vertices(vertices[23],vertices[22],vertices[263],vertices[30]); + cells[974]->set_neighbors(cells[1202],cells[1593],cells[396],cells[1525]); + set_offsets(cells[974],4,4,0,4); + cells[975]->set_vertices(vertices[0],vertices[248],vertices[241],vertices[8]); + cells[975]->set_neighbors(cells[1503],cells[1101],cells[1442],cells[229]); + set_offsets(cells[975],4,0,0,4); + cells[976]->set_vertices(vertices[147],vertices[156],vertices[196],vertices[204]); + cells[976]->set_neighbors(cells[37],cells[309],cells[1029],cells[1192]); + set_offsets(cells[976],0,0,0,0); + cells[977]->set_vertices(vertices[176],vertices[168],vertices[127],vertices[175]); + cells[977]->set_neighbors(cells[1078],cells[1032],cells[1314],cells[689]); + set_offsets(cells[977],1,1,0,0); + cells[978]->set_vertices(vertices[160],vertices[120],vertices[119],vertices[112]); + cells[978]->set_neighbors(cells[731],cells[762],cells[949],cells[987]); + set_offsets(cells[978],1,1,0,1); + cells[979]->set_vertices(vertices[218],vertices[161],vertices[209],vertices[210]); + cells[979]->set_neighbors(cells[960],cells[1517],cells[248],cells[1049]); + set_offsets(cells[979],0,0,0,0); + cells[980]->set_vertices(vertices[165],vertices[117],vertices[157],vertices[166]); + cells[980]->set_neighbors(cells[268],cells[985],cells[1042],cells[1018]); + set_offsets(cells[980],0,0,0,0); + cells[981]->set_vertices(vertices[231],vertices[224],vertices[183],vertices[223]); + cells[981]->set_neighbors(cells[753],cells[1297],cells[995],cells[1393]); + set_offsets(cells[981],0,1,0,0); + cells[982]->set_vertices(vertices[125],vertices[117],vertices[165],vertices[174]); + cells[982]->set_neighbors(cells[1042],cells[540],cells[933],cells[91]); + set_offsets(cells[982],0,0,0,0); + cells[983]->set_vertices(vertices[172],vertices[212],vertices[165],vertices[164]); + cells[983]->set_neighbors(cells[1254],cells[712],cells[833],cells[1301]); + set_offsets(cells[983],0,0,0,0); + cells[984]->set_vertices(vertices[172],vertices[164],vertices[117],vertices[124]); + cells[984]->set_neighbors(cells[693],cells[459],cells[56],cells[712]); + set_offsets(cells[984],0,0,0,0); + cells[985]->set_vertices(vertices[165],vertices[157],vertices[214],vertices[166]); + cells[985]->set_neighbors(cells[1040],cells[918],cells[980],cells[865]); + set_offsets(cells[985],0,0,0,0); + cells[986]->set_vertices(vertices[173],vertices[181],vertices[133],vertices[182]); + cells[986]->set_neighbors(cells[694],cells[846],cells[194],cells[1107]); + set_offsets(cells[986],0,0,0,0); + cells[987]->set_vertices(vertices[120],vertices[160],vertices[119],vertices[168]); + cells[987]->set_neighbors(cells[741],cells[1019],cells[662],cells[978]); + set_offsets(cells[987],1,1,0,1); + cells[988]->set_vertices(vertices[225],vertices[185],vertices[232],vertices[177]); + cells[988]->set_neighbors(cells[1347],cells[1396],cells[1416],cells[1407]); + set_offsets(cells[988],0,0,0,0); + cells[989]->set_vertices(vertices[223],vertices[222],vertices[215],vertices[175]); + cells[989]->set_neighbors(cells[810],cells[837],cells[1351],cells[1592]); + set_offsets(cells[989],0,0,0,0); + cells[990]->set_vertices(vertices[176],vertices[128],vertices[168],vertices[121]); + cells[990]->set_neighbors(cells[733],cells[571],cells[516],cells[689]); + set_offsets(cells[990],0,0,0,0); + cells[991]->set_vertices(vertices[120],vertices[113],vertices[168],vertices[121]); + cells[991]->set_neighbors(cells[992],cells[733],cells[766],cells[662]); + set_offsets(cells[991],0,0,0,0); + cells[992]->set_vertices(vertices[121],vertices[113],vertices[168],vertices[161]); + cells[992]->set_neighbors(cells[744],cells[1044],cells[139],cells[991]); + set_offsets(cells[992],0,0,0,0); + cells[993]->set_vertices(vertices[180],vertices[172],vertices[173],vertices[125]); + cells[993]->set_neighbors(cells[953],cells[1016],cells[711],cells[155]); + set_offsets(cells[993],0,0,0,0); + cells[994]->set_vertices(vertices[168],vertices[161],vertices[216],vertices[169]); + cells[994]->set_neighbors(cells[1274],cells[16],cells[1044],cells[216]); + set_offsets(cells[994],0,0,0,0); + cells[995]->set_vertices(vertices[231],vertices[224],vertices[223],vertices[272]); + cells[995]->set_neighbors(cells[1170],cells[1299],cells[1410],cells[981]); + set_offsets(cells[995],0,1,0,1); + cells[996]->set_vertices(vertices[175],vertices[183],vertices[182],vertices[135]); + cells[996]->set_neighbors(cells[760],cells[1076],cells[1117],cells[1356]); + set_offsets(cells[996],0,0,0,0); + cells[997]->set_vertices(vertices[160],vertices[153],vertices[200],vertices[208]); + cells[997]->set_neighbors(cells[967],cells[1267],cells[1217],cells[1112]); + set_offsets(cells[997],0,0,0,0); + cells[998]->set_vertices(vertices[176],vertices[184],vertices[183],vertices[135]); + cells[998]->set_neighbors(cells[904],cells[1117],cells[1074],cells[1352]); + set_offsets(cells[998],1,1,0,0); + cells[999]->set_vertices(vertices[178],vertices[138],vertices[130],vertices[131]); + cells[999]->set_neighbors(cells[829],cells[1050],cells[1127],cells[1017]); + set_offsets(cells[999],0,0,0,0); + cells[1000]->set_vertices(vertices[193],vertices[194],vertices[202],vertices[145]); + cells[1000]->set_neighbors(cells[1150],cells[1149],cells[1371],cells[1454]); + set_offsets(cells[1000],0,0,0,0); + cells[1001]->set_vertices(vertices[163],vertices[162],vertices[155],vertices[115]); + cells[1001]->set_neighbors(cells[645],cells[703],cells[804],cells[1010]); + set_offsets(cells[1001],0,0,0,0); + cells[1002]->set_vertices(vertices[242],vertices[194],vertices[235],vertices[195]); + cells[1002]->set_neighbors(cells[864],cells[1700],cells[1132],cells[84]); + set_offsets(cells[1002],2,2,0,2); + cells[1003]->set_vertices(vertices[277],vertices[237],vertices[284],vertices[229]); + cells[1003]->set_neighbors(cells[1463],cells[1661],cells[623],cells[1707]); + set_offsets(cells[1003],0,0,0,0); + cells[1004]->set_vertices(vertices[43],vertices[44],vertices[283],vertices[35]); + cells[1004]->set_neighbors(cells[1666],cells[1139],cells[41],cells[1364]); + set_offsets(cells[1004],4,4,0,4); + cells[1005]->set_vertices(vertices[235],vertices[187],vertices[227],vertices[236]); + cells[1005]->set_neighbors(cells[1200],cells[1459],cells[1196],cells[1418]); + set_offsets(cells[1005],0,0,0,0); + cells[1006]->set_vertices(vertices[249],vertices[10],vertices[9],vertices[18]); + cells[1006]->set_neighbors(cells[28],cells[1556],cells[44],cells[1507]); + set_offsets(cells[1006],0,4,4,4); + cells[1007]->set_vertices(vertices[243],vertices[250],vertices[251],vertices[10]); + cells[1007]->set_neighbors(cells[1277],cells[945],cells[1223],cells[1519]); + set_offsets(cells[1007],0,0,0,4); + cells[1008]->set_vertices(vertices[170],vertices[161],vertices[210],vertices[162]); + cells[1008]->set_neighbors(cells[158],cells[775],cells[954],cells[248]); + set_offsets(cells[1008],0,0,0,0); + cells[1009]->set_vertices(vertices[2],vertices[242],vertices[243],vertices[250]); + cells[1009]->set_neighbors(cells[280],cells[1223],cells[1511],cells[1619]); + set_offsets(cells[1009],4,0,0,0); + cells[1010]->set_vertices(vertices[163],vertices[210],vertices[155],vertices[162]); + cells[1010]->set_neighbors(cells[250],cells[1001],cells[775],cells[968]); + set_offsets(cells[1010],0,0,0,0); + cells[1011]->set_vertices(vertices[203],vertices[155],vertices[195],vertices[204]); + cells[1011]->set_neighbors(cells[1012],cells[1159],cells[1281],cells[1237]); + set_offsets(cells[1011],0,0,0,0); + cells[1012]->set_vertices(vertices[147],vertices[204],vertices[195],vertices[155]); + cells[1012]->set_neighbors(cells[1011],cells[1034],cells[1029],cells[309]); + set_offsets(cells[1012],0,0,0,0); + cells[1013]->set_vertices(vertices[126],vertices[166],vertices[119],vertices[118]); + cells[1013]->set_neighbors(cells[615],cells[755],cells[844],cells[785]); + set_offsets(cells[1013],0,0,0,0); + cells[1014]->set_vertices(vertices[164],vertices[204],vertices[157],vertices[156]); + cells[1014]->set_neighbors(cells[1190],cells[647],cells[1030],cells[1258]); + set_offsets(cells[1014],0,0,0,0); + cells[1015]->set_vertices(vertices[31],vertices[38],vertices[279],vertices[39]); + cells[1015]->set_neighbors(cells[1671],cells[0],cells[552],cells[1238]); + set_offsets(cells[1015],4,4,0,4); + cells[1016]->set_vertices(vertices[133],vertices[180],vertices[173],vertices[125]); + cells[1016]->set_neighbors(cells[993],cells[846],cells[1064],cells[1107]); + set_offsets(cells[1016],0,0,0,0); + cells[1017]->set_vertices(vertices[129],vertices[138],vertices[130],vertices[178]); + cells[1017]->set_neighbors(cells[999],cells[1065],cells[656],cells[78]); + set_offsets(cells[1017],0,0,0,0); + cells[1018]->set_vertices(vertices[165],vertices[164],vertices[157],vertices[117]); + cells[1018]->set_neighbors(cells[191],cells[980],cells[712],cells[1254]); + set_offsets(cells[1018],0,0,0,0); + cells[1019]->set_vertices(vertices[120],vertices[168],vertices[119],vertices[127]); + cells[1019]->set_neighbors(cells[809],cells[654],cells[1038],cells[987]); + set_offsets(cells[1019],1,1,0,0); + cells[1020]->set_vertices(vertices[260],vertices[203],vertices[251],vertices[252]); + cells[1020]->set_neighbors(cells[1257],cells[1576],cells[1024],cells[1252]); + set_offsets(cells[1020],0,0,0,0); + cells[1021]->set_vertices(vertices[39],vertices[46],vertices[287],vertices[47]); + cells[1021]->set_neighbors(cells[1488],cells[1595],cells[384],cells[1727]); + set_offsets(cells[1021],4,4,0,4); + cells[1022]->set_vertices(vertices[286],vertices[198],vertices[239],vertices[246]); + cells[1022]->set_neighbors(cells[1486],cells[1634],cells[1478],cells[1473]); + set_offsets(cells[1022],0,2,0,2); + cells[1023]->set_vertices(vertices[268],vertices[259],vertices[20],vertices[260]); + cells[1023]->set_neighbors(cells[1280],cells[217],cells[1331],cells[1298]); + set_offsets(cells[1023],0,0,4,0); + cells[1024]->set_vertices(vertices[260],vertices[203],vertices[252],vertices[212]); + cells[1024]->set_neighbors(cells[1066],cells[95],cells[1336],cells[1020]); + set_offsets(cells[1024],0,0,0,0); + cells[1025]->set_vertices(vertices[263],vertices[262],vertices[22],vertices[255]); + cells[1025]->set_neighbors(cells[875],cells[1537],cells[1308],cells[264]); + set_offsets(cells[1025],0,0,4,0); + cells[1026]->set_vertices(vertices[245],vertices[197],vertices[246],vertices[254]); + cells[1026]->set_neighbors(cells[1212],cells[197],cells[1265],cells[1669]); + set_offsets(cells[1026],0,0,0,0); + cells[1027]->set_vertices(vertices[161],vertices[153],vertices[201],vertices[210]); + cells[1027]->set_neighbors(cells[811],cells[960],cells[158],cells[25]); + set_offsets(cells[1027],0,0,0,0); + cells[1028]->set_vertices(vertices[199],vertices[246],vertices[198],vertices[206]); + cells[1028]->set_neighbors(cells[1213],cells[1240],cells[1300],cells[1486]); + set_offsets(cells[1028],0,0,0,0); + cells[1029]->set_vertices(vertices[147],vertices[156],vertices[204],vertices[155]); + cells[1029]->set_neighbors(cells[1030],cells[1012],cells[843],cells[976]); + set_offsets(cells[1029],0,0,0,0); + cells[1030]->set_vertices(vertices[164],vertices[155],vertices[204],vertices[156]); + cells[1030]->set_neighbors(cells[1029],cells[1014],cells[866],cells[59]); + set_offsets(cells[1030],0,0,0,0); + cells[1031]->set_vertices(vertices[166],vertices[206],vertices[159],vertices[158]); + cells[1031]->set_neighbors(cells[1111],cells[506],cells[1041],cells[1264]); + set_offsets(cells[1031],0,0,0,0); + cells[1032]->set_vertices(vertices[135],vertices[176],vertices[127],vertices[175]); + cells[1032]->set_neighbors(cells[977],cells[1076],cells[1117],cells[1035]); + set_offsets(cells[1032],0,1,0,0); + cells[1033]->set_vertices(vertices[151],vertices[103],vertices[191],vertices[144]); + cells[1033]->set_neighbors(cells[892],cells[909],cells[868],cells[1157]); + set_offsets(cells[1033],2,2,0,3); + cells[1034]->set_vertices(vertices[147],vertices[202],vertices[155],vertices[195]); + cells[1034]->set_neighbors(cells[1237],cells[1012],cells[1227],cells[100]); + set_offsets(cells[1034],0,0,0,0); + cells[1035]->set_vertices(vertices[135],vertices[128],vertices[127],vertices[176]); + cells[1035]->set_neighbors(cells[689],cells[1032],cells[782],cells[758]); + set_offsets(cells[1035],0,1,0,1); + cells[1036]->set_vertices(vertices[167],vertices[160],vertices[119],vertices[159]); + cells[1036]->set_neighbors(cells[360],cells[1037],cells[1268],cells[741]); + set_offsets(cells[1036],0,1,0,0); + cells[1037]->set_vertices(vertices[167],vertices[166],vertices[159],vertices[119]); + cells[1037]->set_neighbors(cells[750],cells[1036],cells[24],cells[1160]); + set_offsets(cells[1037],0,0,0,0); + cells[1038]->set_vertices(vertices[168],vertices[128],vertices[127],vertices[120]); + cells[1038]->set_neighbors(cells[88],cells[1019],cells[733],cells[689]); + set_offsets(cells[1038],1,1,0,1); + cells[1039]->set_vertices(vertices[178],vertices[186],vertices[226],vertices[177]); + cells[1039]->set_neighbors(cells[1185],cells[47],cells[946],cells[771]); + set_offsets(cells[1039],0,0,0,0); + cells[1040]->set_vertices(vertices[214],vertices[157],vertices[206],vertices[166]); + cells[1040]->set_neighbors(cells[1041],cells[1264],cells[985],cells[1294]); + set_offsets(cells[1040],0,0,0,0); + cells[1041]->set_vertices(vertices[166],vertices[157],vertices[206],vertices[158]); + cells[1041]->set_neighbors(cells[692],cells[1031],cells[182],cells[1040]); + set_offsets(cells[1041],0,0,0,0); + cells[1042]->set_vertices(vertices[174],vertices[117],vertices[165],vertices[166]); + cells[1042]->set_neighbors(cells[980],cells[918],cells[463],cells[982]); + set_offsets(cells[1042],0,0,0,0); + cells[1043]->set_vertices(vertices[176],vertices[177],vertices[129],vertices[169]); + cells[1043]->set_neighbors(cells[646],cells[713],cells[1358],cells[542]); + set_offsets(cells[1043],0,0,0,0); + cells[1044]->set_vertices(vertices[169],vertices[121],vertices[168],vertices[161]); + cells[1044]->set_neighbors(cells[992],cells[994],cells[444],cells[571]); + set_offsets(cells[1044],0,0,0,0); + cells[1045]->set_vertices(vertices[36],vertices[267],vertices[28],vertices[276]); + cells[1045]->set_neighbors(cells[664],cells[1632],cells[1382],cells[1574]); + set_offsets(cells[1045],4,0,4,0); + cells[1046]->set_vertices(vertices[141],vertices[102],vertices[142],vertices[190]); + cells[1046]->set_neighbors(cells[1118],cells[805],cells[895],cells[879]); + set_offsets(cells[1046],0,2,0,0); + cells[1047]->set_vertices(vertices[221],vertices[220],vertices[213],vertices[173]); + cells[1047]->set_neighbors(cells[76],cells[1103],cells[1339],cells[1381]); + set_offsets(cells[1047],0,0,0,0); + cells[1048]->set_vertices(vertices[211],vertices[210],vertices[258],vertices[203]); + cells[1048]->set_neighbors(cells[1285],cells[391],cells[364],cells[1516]); + set_offsets(cells[1048],0,0,0,0); + cells[1049]->set_vertices(vertices[169],vertices[161],vertices[209],vertices[218]); + cells[1049]->set_neighbors(cells[979],cells[1307],cells[165],cells[1274]); + set_offsets(cells[1049],0,0,0,0); + cells[1050]->set_vertices(vertices[178],vertices[131],vertices[130],vertices[123]); + cells[1050]->set_neighbors(cells[819],cells[1051],cells[1054],cells[999]); + set_offsets(cells[1050],0,0,0,0); + cells[1051]->set_vertices(vertices[170],vertices[178],vertices[130],vertices[123]); + cells[1051]->set_neighbors(cells[1050],cells[854],cells[923],cells[408]); + set_offsets(cells[1051],0,0,0,0); + cells[1052]->set_vertices(vertices[240],vertices[233],vertices[192],vertices[280]); + cells[1052]->set_neighbors(cells[1642],cells[1678],cells[1681],cells[1443]); + set_offsets(cells[1052],2,0,2,0); + cells[1053]->set_vertices(vertices[185],vertices[144],vertices[192],vertices[232]); + cells[1053]->set_neighbors(cells[1259],cells[1406],cells[1086],cells[914]); + set_offsets(cells[1053],0,2,2,0); + cells[1054]->set_vertices(vertices[131],vertices[178],vertices[171],vertices[123]); + cells[1054]->set_neighbors(cells[923],cells[1094],cells[1050],cells[1097]); + set_offsets(cells[1054],0,0,0,0); + cells[1055]->set_vertices(vertices[171],vertices[170],vertices[163],vertices[123]); + cells[1055]->set_neighbors(cells[687],cells[917],cells[923],cells[1286]); + set_offsets(cells[1055],0,0,0,0); + cells[1056]->set_vertices(vertices[246],vertices[6],vertices[285],vertices[245]); + cells[1056]->set_neighbors(cells[1197],cells[1669],cells[197],cells[1340]); + set_offsets(cells[1056],2,6,0,2); + cells[1057]->set_vertices(vertices[270],vertices[213],vertices[262],vertices[222]); + cells[1057]->set_neighbors(cells[172],cells[1591],cells[1586],cells[1585]); + set_offsets(cells[1057],0,0,0,0); + cells[1058]->set_vertices(vertices[259],vertices[28],vertices[19],vertices[267]); + cells[1058]->set_neighbors(cells[1195],cells[1370],cells[1526],cells[1467]); + set_offsets(cells[1058],0,4,4,0); + cells[1059]->set_vertices(vertices[217],vertices[257],vertices[265],vertices[266]); + cells[1059]->set_neighbors(cells[570],cells[1367],cells[1514],cells[1608]); + set_offsets(cells[1059],0,0,0,0); + cells[1060]->set_vertices(vertices[173],vertices[165],vertices[213],vertices[222]); + cells[1060]->set_neighbors(cells[1338],cells[1103],cells[246],cells[76]); + set_offsets(cells[1060],0,0,0,0); + cells[1061]->set_vertices(vertices[188],vertices[139],vertices[179],vertices[131]); + cells[1061]->set_neighbors(cells[653],cells[896],cells[620],cells[897]); + set_offsets(cells[1061],0,0,0,0); + cells[1062]->set_vertices(vertices[220],vertices[163],vertices[211],vertices[212]); + cells[1062]->set_neighbors(cells[905],cells[832],cells[81],cells[1322]); + set_offsets(cells[1062],0,0,0,0); + cells[1063]->set_vertices(vertices[180],vertices[123],vertices[171],vertices[172]); + cells[1063]->set_neighbors(cells[917],cells[870],cells[660],cells[1094]); + set_offsets(cells[1063],0,0,0,0); + cells[1064]->set_vertices(vertices[180],vertices[133],vertices[132],vertices[125]); + cells[1064]->set_neighbors(cells[828],cells[711],cells[1016],cells[927]); + set_offsets(cells[1064],0,0,0,0); + cells[1065]->set_vertices(vertices[129],vertices[121],vertices[178],vertices[130]); + cells[1065]->set_neighbors(cells[408],cells[1017],cells[98],cells[1092]); + set_offsets(cells[1065],0,0,0,0); + cells[1066]->set_vertices(vertices[212],vertices[203],vertices[252],vertices[204]); + cells[1066]->set_neighbors(cells[1159],cells[1243],cells[1281],cells[1024]); + set_offsets(cells[1066],0,0,0,0); + cells[1067]->set_vertices(vertices[141],vertices[181],vertices[189],vertices[190]); + cells[1067]->set_neighbors(cells[921],cells[1145],cells[934],cells[926]); + set_offsets(cells[1067],0,0,0,0); + cells[1068]->set_vertices(vertices[131],vertices[140],vertices[132],vertices[180]); + cells[1068]->set_neighbors(cells[927],cells[1069],cells[621],cells[743]); + set_offsets(cells[1068],0,0,0,0); + cells[1069]->set_vertices(vertices[131],vertices[123],vertices[180],vertices[132]); + cells[1069]->set_neighbors(cells[660],cells[1068],cells[763],cells[1094]); + set_offsets(cells[1069],0,0,0,0); + cells[1070]->set_vertices(vertices[182],vertices[125],vertices[174],vertices[134]); + cells[1070]->set_neighbors(cells[736],cells[780],cells[590],cells[589]); + set_offsets(cells[1070],0,0,0,0); + cells[1071]->set_vertices(vertices[182],vertices[173],vertices[222],vertices[174]); + cells[1071]->set_neighbors(cells[246],cells[847],cells[589],cells[244]); + set_offsets(cells[1071],0,0,0,0); + cells[1072]->set_vertices(vertices[137],vertices[96],vertices[144],vertices[184]); + cells[1072]->set_neighbors(cells[1120],cells[1128],cells[685],cells[67]); + set_offsets(cells[1072],0,2,2,0); + cells[1073]->set_vertices(vertices[129],vertices[136],vertices[176],vertices[128]); + cells[1073]->set_neighbors(cells[782],cells[516],cells[357],cells[965]); + set_offsets(cells[1073],0,0,0,0); + cells[1074]->set_vertices(vertices[176],vertices[184],vertices[135],vertices[136]); + cells[1074]->set_neighbors(cells[816],cells[782],cells[965],cells[998]); + set_offsets(cells[1074],1,1,0,1); + cells[1075]->set_vertices(vertices[174],vertices[214],vertices[167],vertices[166]); + cells[1075]->set_neighbors(cells[1160],cells[24],cells[918],cells[1311]); + set_offsets(cells[1075],0,0,0,0); + cells[1076]->set_vertices(vertices[135],vertices[182],vertices[175],vertices[127]); + cells[1076]->set_neighbors(cells[422],cells[1032],cells[159],cells[996]); + set_offsets(cells[1076],0,0,0,0); + cells[1077]->set_vertices(vertices[175],vertices[174],vertices[167],vertices[127]); + cells[1077]->set_neighbors(cells[869],cells[1078],cells[422],cells[1310]); + set_offsets(cells[1077],0,0,0,0); + cells[1078]->set_vertices(vertices[175],vertices[168],vertices[127],vertices[167]); + cells[1078]->set_neighbors(cells[809],cells[1077],cells[1313],cells[977]); + set_offsets(cells[1078],0,1,0,0); + cells[1079]->set_vertices(vertices[192],vertices[145],vertices[200],vertices[152]); + cells[1079]->set_neighbors(cells[1102],cells[455],cells[686],cells[718]); + set_offsets(cells[1079],0,0,0,0); + cells[1080]->set_vertices(vertices[178],vertices[218],vertices[171],vertices[170]); + cells[1080]->set_neighbors(cells[1286],cells[923],cells[959],cells[1337]); + set_offsets(cells[1080],0,0,0,0); + cells[1081]->set_vertices(vertices[139],vertices[146],vertices[186],vertices[98]); + cells[1081]->set_neighbors(cells[1124],cells[413],cells[824],cells[1138]); + set_offsets(cells[1081],0,2,0,2); + cells[1082]->set_vertices(vertices[190],vertices[143],vertices[142],vertices[135]); + cells[1082]->set_neighbors(cells[902],cells[1083],cells[920],cells[1118]); + set_offsets(cells[1082],0,0,0,0); + cells[1083]->set_vertices(vertices[182],vertices[190],vertices[142],vertices[135]); + cells[1083]->set_neighbors(cells[1082],cells[1106],cells[760],cells[935]); + set_offsets(cells[1083],0,0,0,0); + cells[1084]->set_vertices(vertices[177],vertices[176],vertices[184],vertices[224]); + cells[1084]->set_neighbors(cells[1352],cells[913],cells[1358],cells[542]); + set_offsets(cells[1084],0,0,0,0); + cells[1085]->set_vertices(vertices[224],vertices[216],vertices[175],vertices[223]); + cells[1085]->set_neighbors(cells[837],cells[753],cells[1605],cells[1360]); + set_offsets(cells[1085],1,1,0,0); + cells[1086]->set_vertices(vertices[185],vertices[144],vertices[232],vertices[184]); + cells[1086]->set_neighbors(cells[1397],cells[1347],cells[1128],cells[1053]); + set_offsets(cells[1086],0,2,0,0); + cells[1087]->set_vertices(vertices[168],vertices[160],vertices[208],vertices[161]); + cells[1087]->set_neighbors(cells[1217],cells[216],cells[744],cells[1269]); + set_offsets(cells[1087],0,0,0,0); + cells[1088]->set_vertices(vertices[198],vertices[151],vertices[239],vertices[199]); + cells[1088]->set_neighbors(cells[1355],cells[1486],cells[1240],cells[1436]); + set_offsets(cells[1088],2,2,0,2); + cells[1089]->set_vertices(vertices[185],vertices[97],vertices[137],vertices[146]); + cells[1089]->set_neighbors(cells[915],cells[1125],cells[1091],cells[1129]); + set_offsets(cells[1089],0,2,0,2); + cells[1090]->set_vertices(vertices[185],vertices[137],vertices[184],vertices[177]); + cells[1090]->set_neighbors(cells[853],cells[1347],cells[877],cells[1128]); + set_offsets(cells[1090],0,0,0,0); + cells[1091]->set_vertices(vertices[145],vertices[97],vertices[185],vertices[146]); + cells[1091]->set_neighbors(cells[1089],cells[602],cells[457],cells[1130]); + set_offsets(cells[1091],2,2,0,2); + cells[1092]->set_vertices(vertices[129],vertices[121],vertices[169],vertices[178]); + cells[1092]->set_neighbors(cells[634],cells[646],cells[1065],cells[713]); + set_offsets(cells[1092],0,0,0,0); + cells[1093]->set_vertices(vertices[231],vertices[272],vertices[271],vertices[279]); + cells[1093]->set_neighbors(cells[1477],cells[936],cells[1292],cells[1299]); + set_offsets(cells[1093],0,1,0,0); + cells[1094]->set_vertices(vertices[131],vertices[123],vertices[171],vertices[180]); + cells[1094]->set_neighbors(cells[1063],cells[1095],cells[1069],cells[1054]); + set_offsets(cells[1094],0,0,0,0); + cells[1095]->set_vertices(vertices[131],vertices[179],vertices[180],vertices[171]); + cells[1095]->set_neighbors(cells[261],cells[1094],cells[1097],cells[896]); + set_offsets(cells[1095],0,0,0,0); + cells[1096]->set_vertices(vertices[188],vertices[139],vertices[140],vertices[100]); + cells[1096]->set_neighbors(cells[827],cells[1113],cells[1135],cells[620]); + set_offsets(cells[1096],0,0,0,2); + cells[1097]->set_vertices(vertices[178],vertices[179],vertices[131],vertices[171]); + cells[1097]->set_neighbors(cells[1095],cells[1054],cells[1332],cells[817]); + set_offsets(cells[1097],0,0,0,0); + cells[1098]->set_vertices(vertices[187],vertices[139],vertices[186],vertices[179]); + cells[1098]->set_neighbors(cells[653],cells[1171],cells[897],cells[1138]); + set_offsets(cells[1098],0,0,0,0); + cells[1099]->set_vertices(vertices[147],vertices[99],vertices[187],vertices[148]); + cells[1099]->set_neighbors(cells[786],cells[1133],cells[130],cells[1136]); + set_offsets(cells[1099],2,2,0,2); + cells[1100]->set_vertices(vertices[274],vertices[282],vertices[225],vertices[234]); + cells[1100]->set_neighbors(cells[344],cells[1655],cells[1650],cells[1692]); + set_offsets(cells[1100],0,0,0,0); + cells[1101]->set_vertices(vertices[0],vertices[8],vertices[241],vertices[1]); + cells[1101]->set_neighbors(cells[1447],cells[1402],cells[295],cells[975]); + set_offsets(cells[1101],4,4,0,4); + cells[1102]->set_vertices(vertices[200],vertices[145],vertices[153],vertices[152]); + cells[1102]->set_neighbors(cells[951],cells[1112],cells[1079],cells[1142]); + set_offsets(cells[1102],0,0,0,0); + cells[1103]->set_vertices(vertices[221],vertices[173],vertices[213],vertices[222]); + cells[1103]->set_neighbors(cells[1060],cells[1586],cells[1116],cells[1047]); + set_offsets(cells[1103],0,0,0,0); + cells[1104]->set_vertices(vertices[101],vertices[150],vertices[141],vertices[189]); + cells[1104]->set_neighbors(cells[1145],cells[390],cells[1147],cells[937]); + set_offsets(cells[1104],2,2,0,0); + cells[1105]->set_vertices(vertices[182],vertices[142],vertices[133],vertices[134]); + cells[1105]->set_neighbors(cells[389],cells[590],cells[1106],cells[935]); + set_offsets(cells[1105],0,0,0,0); + cells[1106]->set_vertices(vertices[135],vertices[142],vertices[182],vertices[134]); + cells[1106]->set_neighbors(cells[1105],cells[159],cells[140],cells[1083]); + set_offsets(cells[1106],0,0,0,0); + cells[1107]->set_vertices(vertices[180],vertices[181],vertices[133],vertices[173]); + cells[1107]->set_neighbors(cells[986],cells[1016],cells[1342],cells[490]); + set_offsets(cells[1107],0,0,0,0); + cells[1108]->set_vertices(vertices[247],vertices[248],vertices[255],vertices[207]); + cells[1108]->set_neighbors(cells[1504],cells[1291],cells[1441],cells[1534]); + set_offsets(cells[1108],0,1,0,0); + cells[1109]->set_vertices(vertices[181],vertices[173],vertices[221],vertices[230]); + cells[1109]->set_neighbors(cells[1116],cells[863],cells[194],cells[1343]); + set_offsets(cells[1109],0,0,0,0); + cells[1110]->set_vertices(vertices[266],vertices[209],vertices[258],vertices[218]); + cells[1110]->set_neighbors(cells[1517],cells[1335],cells[1369],cells[1559]); + set_offsets(cells[1110],0,0,0,0); + cells[1111]->set_vertices(vertices[159],vertices[206],vertices[151],vertices[158]); + cells[1111]->set_neighbors(cells[146],cells[585],cells[1031],cells[1189]); + set_offsets(cells[1111],0,0,0,0); + cells[1112]->set_vertices(vertices[160],vertices[152],vertices[200],vertices[153]); + cells[1112]->set_neighbors(cells[1102],cells[997],cells[43],cells[1214]); + set_offsets(cells[1112],0,0,0,0); + cells[1113]->set_vertices(vertices[141],vertices[188],vertices[140],vertices[100]); + cells[1113]->set_neighbors(cells[1096],cells[883],cells[332],cells[695]); + set_offsets(cells[1113],0,0,0,2); + cells[1114]->set_vertices(vertices[236],vertices[189],vertices[188],vertices[181]); + cells[1114]->set_neighbors(cells[926],cells[327],cells[830],cells[1383]); + set_offsets(cells[1114],0,0,0,0); + cells[1115]->set_vertices(vertices[194],vertices[146],vertices[234],vertices[187]); + cells[1115]->set_neighbors(cells[245],cells[1419],cells[840],cells[1414]); + set_offsets(cells[1115],2,2,0,0); + cells[1116]->set_vertices(vertices[230],vertices[173],vertices[221],vertices[222]); + cells[1116]->set_neighbors(cells[1103],cells[673],cells[244],cells[1109]); + set_offsets(cells[1116],0,0,0,0); + cells[1117]->set_vertices(vertices[176],vertices[183],vertices[175],vertices[135]); + cells[1117]->set_neighbors(cells[996],cells[1032],cells[998],cells[1359]); + set_offsets(cells[1117],1,0,0,0); + cells[1118]->set_vertices(vertices[190],vertices[102],vertices[142],vertices[143]); + cells[1118]->set_neighbors(cells[901],cells[1082],cells[757],cells[1046]); + set_offsets(cells[1118],0,2,0,0); + cells[1119]->set_vertices(vertices[230],vertices[238],vertices[278],vertices[229]); + cells[1119]->set_neighbors(cells[1673],cells[1166],cells[1168],cells[1675]); + set_offsets(cells[1119],0,0,0,0); + cells[1120]->set_vertices(vertices[144],vertices[96],vertices[143],vertices[184]); + cells[1120]->set_neighbors(cells[316],cells[1153],cells[1072],cells[489]); + set_offsets(cells[1120],3,3,0,1); + cells[1121]->set_vertices(vertices[26],vertices[266],vertices[18],vertices[259]); + cells[1121]->set_neighbors(cells[214],cells[1569],cells[1176],cells[1560]); + set_offsets(cells[1121],4,0,4,0); + cells[1122]->set_vertices(vertices[179],vertices[171],vertices[219],vertices[228]); + cells[1122]->set_neighbors(cells[962],cells[1201],cells[261],cells[1333]); + set_offsets(cells[1122],0,0,0,0); + cells[1123]->set_vertices(vertices[133],vertices[180],vertices[140],vertices[188]); + cells[1123]->set_neighbors(cells[621],cells[695],cells[490],cells[927]); + set_offsets(cells[1123],0,0,0,0); + cells[1124]->set_vertices(vertices[146],vertices[137],vertices[186],vertices[98]); + cells[1124]->set_neighbors(cells[688],cells[1081],cells[915],cells[1125]); + set_offsets(cells[1124],2,0,0,2); + cells[1125]->set_vertices(vertices[146],vertices[137],vertices[185],vertices[186]); + cells[1125]->set_neighbors(cells[877],cells[65],cells[1124],cells[1089]); + set_offsets(cells[1125],2,0,0,0); + cells[1126]->set_vertices(vertices[131],vertices[186],vertices[138],vertices[139]); + cells[1126]->set_neighbors(cells[413],cells[376],cells[653],cells[1127]); + set_offsets(cells[1126],0,0,0,0); + cells[1127]->set_vertices(vertices[131],vertices[178],vertices[138],vertices[186]); + cells[1127]->set_neighbors(cells[656],cells[1126],cells[817],cells[999]); + set_offsets(cells[1127],0,0,0,0); + cells[1128]->set_vertices(vertices[144],vertices[137],vertices[184],vertices[185]); + cells[1128]->set_neighbors(cells[1090],cells[1086],cells[1129],cells[1072]); + set_offsets(cells[1128],2,0,0,0); + cells[1129]->set_vertices(vertices[144],vertices[97],vertices[137],vertices[185]); + cells[1129]->set_neighbors(cells[1089],cells[1128],cells[1130],cells[67]); + set_offsets(cells[1129],2,2,0,0); + cells[1130]->set_vertices(vertices[144],vertices[97],vertices[185],vertices[145]); + cells[1130]->set_neighbors(cells[1091],cells[914],cells[614],cells[1129]); + set_offsets(cells[1130],2,2,0,2); + cells[1131]->set_vertices(vertices[226],vertices[217],vertices[266],vertices[218]); + cells[1131]->set_neighbors(cells[1369],cells[1373],cells[873],cells[1178]); + set_offsets(cells[1131],0,0,0,0); + cells[1132]->set_vertices(vertices[194],vertices[242],vertices[202],vertices[195]); + cells[1132]->set_neighbors(cells[1513],cells[1227],cells[1002],cells[1454]); + set_offsets(cells[1132],0,0,0,0); + cells[1133]->set_vertices(vertices[187],vertices[147],vertices[148],vertices[196]); + cells[1133]->set_neighbors(cells[1192],cells[768],cells[1421],cells[1099]); + set_offsets(cells[1133],0,2,2,2); + cells[1134]->set_vertices(vertices[148],vertices[139],vertices[187],vertices[188]); + cells[1134]->set_neighbors(cells[897],cells[1327],cells[1135],cells[786]); + set_offsets(cells[1134],2,0,0,0); + cells[1135]->set_vertices(vertices[148],vertices[139],vertices[188],vertices[100]); + cells[1135]->set_neighbors(cells[1096],cells[332],cells[648],cells[1134]); + set_offsets(cells[1135],2,0,0,2); + cells[1136]->set_vertices(vertices[146],vertices[99],vertices[187],vertices[147]); + cells[1136]->set_neighbors(cells[1099],cells[840],cells[461],cells[1137]); + set_offsets(cells[1136],2,2,0,2); + cells[1137]->set_vertices(vertices[146],vertices[99],vertices[139],vertices[187]); + cells[1137]->set_neighbors(cells[786],cells[1138],cells[1136],cells[824]); + set_offsets(cells[1137],2,2,0,0); + cells[1138]->set_vertices(vertices[146],vertices[139],vertices[186],vertices[187]); + cells[1138]->set_neighbors(cells[1098],cells[245],cells[1137],cells[1081]); + set_offsets(cells[1138],2,0,0,0); + cells[1139]->set_vertices(vertices[43],vertices[283],vertices[42],vertices[35]); + cells[1139]->set_neighbors(cells[1341],cells[313],cells[1004],cells[931]); + set_offsets(cells[1139],4,0,4,4); + cells[1140]->set_vertices(vertices[229],vertices[276],vertices[269],vertices[221]); + cells[1140]->set_neighbors(cells[1460],cells[1670],cells[1664],cells[1638]); + set_offsets(cells[1140],0,0,0,0); + cells[1141]->set_vertices(vertices[208],vertices[200],vertices[159],vertices[207]); + cells[1141]->set_neighbors(cells[137],cells[117],cells[1451],cells[1267]); + set_offsets(cells[1141],1,1,0,0); + cells[1142]->set_vertices(vertices[200],vertices[145],vertices[193],vertices[153]); + cells[1142]->set_neighbors(cells[1149],cells[1229],cells[1102],cells[718]); + set_offsets(cells[1142],0,0,0,0); + cells[1143]->set_vertices(vertices[240],vertices[192],vertices[193],vertices[200]); + cells[1143]->set_neighbors(cells[718],cells[1432],cells[134],cells[1443]); + set_offsets(cells[1143],0,0,0,0); + cells[1144]->set_vertices(vertices[30],vertices[261],vertices[22],vertices[270]); + cells[1144]->set_neighbors(cells[1533],cells[1202],cells[1390],cells[1535]); + set_offsets(cells[1144],4,0,4,0); + cells[1145]->set_vertices(vertices[141],vertices[190],vertices[189],vertices[150]); + cells[1145]->set_neighbors(cells[1167],cells[1104],cells[895],cells[1067]); + set_offsets(cells[1145],0,0,0,2); + cells[1146]->set_vertices(vertices[148],vertices[101],vertices[189],vertices[149]); + cells[1146]->set_neighbors(cells[1147],cells[862],cells[417],cells[390]); + set_offsets(cells[1146],2,2,0,2); + cells[1147]->set_vertices(vertices[101],vertices[150],vertices[189],vertices[149]); + cells[1147]->set_neighbors(cells[1216],cells[1146],cells[942],cells[1104]); + set_offsets(cells[1147],2,2,0,2); + cells[1148]->set_vertices(vertices[237],vertices[246],vertices[286],vertices[285]); + cells[1148]->set_neighbors(cells[1208],cells[1635],cells[1668],cells[1478]); + set_offsets(cells[1148],0,2,0,0); + cells[1149]->set_vertices(vertices[193],vertices[202],vertices[153],vertices[145]); + cells[1149]->set_neighbors(cells[1151],cells[1142],cells[1000],cells[48]); + set_offsets(cells[1149],0,0,0,0); + cells[1150]->set_vertices(vertices[194],vertices[154],vertices[202],vertices[145]); + cells[1150]->set_neighbors(cells[1151],cells[1000],cells[719],cells[1191]); + set_offsets(cells[1150],0,0,0,0); + cells[1151]->set_vertices(vertices[202],vertices[154],vertices[153],vertices[145]); + cells[1151]->set_neighbors(cells[73],cells[1149],cells[1150],cells[783]); + set_offsets(cells[1151],0,0,0,0); + cells[1152]->set_vertices(vertices[274],vertices[266],vertices[267],vertices[219]); + cells[1152]->set_neighbors(cells[1622],cells[1440],cells[529],cells[1620]); + set_offsets(cells[1152],0,0,0,0); + cells[1153]->set_vertices(vertices[144],vertices[143],vertices[191],vertices[184]); + cells[1153]->set_neighbors(cells[1154],cells[1397],cells[1120],cells[892]); + set_offsets(cells[1153],3,0,0,1); + cells[1154]->set_vertices(vertices[191],vertices[143],vertices[183],vertices[184]); + cells[1154]->set_neighbors(cells[904],cells[1309],cells[1153],cells[1155]); + set_offsets(cells[1154],0,0,0,1); + cells[1155]->set_vertices(vertices[183],vertices[143],vertices[191],vertices[190]); + cells[1155]->set_neighbors(cells[1156],cells[325],cells[920],cells[1154]); + set_offsets(cells[1155],0,0,0,0); + cells[1156]->set_vertices(vertices[191],vertices[143],vertices[150],vertices[190]); + cells[1156]->set_neighbors(cells[757],cells[973],cells[1155],cells[1158]); + set_offsets(cells[1156],0,0,2,0); + cells[1157]->set_vertices(vertices[150],vertices[103],vertices[191],vertices[151]); + cells[1157]->set_neighbors(cells[1033],cells[1215],cells[670],cells[1158]); + set_offsets(cells[1157],2,2,0,2); + cells[1158]->set_vertices(vertices[150],vertices[103],vertices[143],vertices[191]); + cells[1158]->set_neighbors(cells[892],cells[1156],cells[1157],cells[938]); + set_offsets(cells[1158],2,2,0,0); + cells[1159]->set_vertices(vertices[252],vertices[195],vertices[204],vertices[203]); + cells[1159]->set_neighbors(cells[1011],cells[1066],cells[1256],cells[1377]); + set_offsets(cells[1159],0,0,0,0); + cells[1160]->set_vertices(vertices[167],vertices[214],vertices[159],vertices[166]); + cells[1160]->set_neighbors(cells[1264],cells[1037],cells[1075],cells[1161]); + set_offsets(cells[1160],0,0,0,0); + cells[1161]->set_vertices(vertices[167],vertices[214],vertices[207],vertices[159]); + cells[1161]->set_neighbors(cells[1260],cells[117],cells[1160],cells[1203]); + set_offsets(cells[1161],0,0,0,0); + cells[1162]->set_vertices(vertices[286],vertices[287],vertices[46],vertices[246]); + cells[1162]->set_neighbors(cells[1400],cells[1208],cells[1634],cells[1726]); + set_offsets(cells[1162],0,0,4,2); + cells[1163]->set_vertices(vertices[238],vertices[189],vertices[229],vertices[181]); + cells[1163]->set_neighbors(cells[830],cells[1168],cells[921],cells[347]); + set_offsets(cells[1163],0,0,0,0); + cells[1164]->set_vertices(vertices[190],vertices[230],vertices[183],vertices[182]); + cells[1164]->set_neighbors(cells[1356],cells[760],cells[1165],cells[419]); + set_offsets(cells[1164],0,0,0,0); + cells[1165]->set_vertices(vertices[190],vertices[181],vertices[230],vertices[182]); + cells[1165]->set_neighbors(cells[194],cells[1164],cells[694],cells[348]); + set_offsets(cells[1165],0,0,0,0); + cells[1166]->set_vertices(vertices[229],vertices[221],vertices[278],vertices[230]); + cells[1166]->set_neighbors(cells[1303],cells[1119],cells[863],cells[1670]); + set_offsets(cells[1166],0,0,0,0); + cells[1167]->set_vertices(vertices[238],vertices[150],vertices[189],vertices[190]); + cells[1167]->set_neighbors(cells[1145],cells[921],cells[973],cells[1430]); + set_offsets(cells[1167],0,2,0,0); + cells[1168]->set_vertices(vertices[230],vertices[238],vertices[229],vertices[181]); + cells[1168]->set_neighbors(cells[1163],cells[863],cells[348],cells[1119]); + set_offsets(cells[1168],0,0,0,0); + cells[1169]->set_vertices(vertices[263],vertices[256],vertices[255],vertices[16]); + cells[1169]->set_neighbors(cells[1266],cells[1491],cells[1316],cells[1582]); + set_offsets(cells[1169],0,1,0,5); + cells[1170]->set_vertices(vertices[272],vertices[224],vertices[223],vertices[264]); + cells[1170]->set_neighbors(cells[1605],cells[1348],cells[1315],cells[995]); + set_offsets(cells[1170],1,1,0,1); + cells[1171]->set_vertices(vertices[234],vertices[187],vertices[186],vertices[179]); + cells[1171]->set_neighbors(cells[1098],cells[1384],cells[307],cells[245]); + set_offsets(cells[1171],0,0,0,0); + cells[1172]->set_vertices(vertices[285],vertices[46],vertices[277],vertices[37]); + cells[1172]->set_neighbors(cells[1474],cells[58],cells[1219],cells[1672]); + set_offsets(cells[1172],0,4,0,4); + cells[1173]->set_vertices(vertices[185],vertices[186],vertices[177],vertices[234]); + cells[1173]->set_neighbors(cells[1185],cells[1416],cells[65],cells[877]); + set_offsets(cells[1173],0,0,0,0); + cells[1174]->set_vertices(vertices[225],vertices[177],vertices[224],vertices[217]); + cells[1174]->set_neighbors(cells[1321],cells[277],cells[1187],cells[1396]); + set_offsets(cells[1174],0,0,0,0); + cells[1175]->set_vertices(vertices[4],vertices[252],vertices[245],vertices[12]); + cells[1175]->set_neighbors(cells[1484],cells[966],cells[1379],cells[1523]); + set_offsets(cells[1175],4,0,0,4); + cells[1176]->set_vertices(vertices[267],vertices[266],vertices[26],vertices[259]); + cells[1176]->set_neighbors(cells[1121],cells[1370],cells[1622],cells[1620]); + set_offsets(cells[1176],0,0,4,0); + cells[1177]->set_vertices(vertices[14],vertices[245],vertices[254],vertices[253]); + cells[1177]->set_neighbors(cells[1305],cells[1224],cells[1530],cells[1466]); + set_offsets(cells[1177],4,0,0,0); + cells[1178]->set_vertices(vertices[274],vertices[217],vertices[266],vertices[226]); + cells[1178]->set_neighbors(cells[1131],cells[529],cells[85],cells[1367]); + set_offsets(cells[1178],0,0,0,0); + cells[1179]->set_vertices(vertices[162],vertices[202],vertices[155],vertices[154]); + cells[1179]->set_neighbors(cells[100],cells[770],cells[783],cells[250]); + set_offsets(cells[1179],0,0,0,0); + cells[1180]->set_vertices(vertices[40],vertices[287],vertices[279],vertices[280]); + cells[1180]->set_neighbors(cells[957],cells[1541],cells[1405],cells[1594]); + set_offsets(cells[1180],5,0,0,1); + cells[1181]->set_vertices(vertices[269],vertices[277],vertices[38],vertices[29]); + cells[1181]->set_neighbors(cells[1246],cells[1583],cells[1230],cells[322]); + set_offsets(cells[1181],0,0,4,4); + cells[1182]->set_vertices(vertices[237],vertices[149],vertices[198],vertices[197]); + cells[1182]->set_neighbors(cells[77],cells[1206],cells[1199],cells[1428]); + set_offsets(cells[1182],0,2,2,2); + cells[1183]->set_vertices(vertices[41],vertices[281],vertices[33],vertices[42]); + cells[1183]->set_neighbors(cells[628],cells[102],cells[1606],cells[1653]); + set_offsets(cells[1183],4,0,4,4); + cells[1184]->set_vertices(vertices[229],vertices[228],vertices[181],vertices[236]); + cells[1184]->set_neighbors(cells[327],cells[830],cells[714],cells[1375]); + set_offsets(cells[1184],0,0,0,0); + cells[1185]->set_vertices(vertices[234],vertices[186],vertices[177],vertices[226]); + cells[1185]->set_neighbors(cells[1039],cells[889],cells[1384],cells[1173]); + set_offsets(cells[1185],0,0,0,0); + cells[1186]->set_vertices(vertices[177],vertices[169],vertices[217],vertices[226]); + cells[1186]->set_neighbors(cells[873],cells[1187],cells[47],cells[1321]); + set_offsets(cells[1186],0,0,0,0); + cells[1187]->set_vertices(vertices[226],vertices[225],vertices[217],vertices[177]); + cells[1187]->set_neighbors(cells[1174],cells[1186],cells[889],cells[85]); + set_offsets(cells[1187],0,0,0,0); + cells[1188]->set_vertices(vertices[261],vertices[260],vertices[20],vertices[253]); + cells[1188]->set_neighbors(cells[1293],cells[1572],cells[1344],cells[217]); + set_offsets(cells[1188],0,0,4,0); + cells[1189]->set_vertices(vertices[199],vertices[206],vertices[151],vertices[159]); + cells[1189]->set_neighbors(cells[1111],cells[1222],cells[1205],cells[1240]); + set_offsets(cells[1189],0,0,0,0); + cells[1190]->set_vertices(vertices[157],vertices[204],vertices[149],vertices[156]); + cells[1190]->set_neighbors(cells[37],cells[971],cells[1014],cells[35]); + set_offsets(cells[1190],0,0,0,0); + cells[1191]->set_vertices(vertices[202],vertices[194],vertices[147],vertices[154]); + cells[1191]->set_neighbors(cells[922],cells[100],cells[1150],cells[1227]); + set_offsets(cells[1191],0,0,0,0); + cells[1192]->set_vertices(vertices[147],vertices[148],vertices[196],vertices[156]); + cells[1192]->set_neighbors(cells[852],cells[976],cells[130],cells[1133]); + set_offsets(cells[1192],0,0,0,0); + cells[1193]->set_vertices(vertices[44],vertices[277],vertices[36],vertices[37]); + cells[1193]->set_neighbors(cells[1629],cells[368],cells[58],cells[1198]); + set_offsets(cells[1193],4,0,4,4); + cells[1194]->set_vertices(vertices[276],vertices[284],vertices[227],vertices[236]); + cells[1194]->set_neighbors(cells[1459],cells[1362],cells[1665],cells[1703]); + set_offsets(cells[1194],0,0,0,0); + cells[1195]->set_vertices(vertices[267],vertices[28],vertices[19],vertices[27]); + cells[1195]->set_neighbors(cells[339],cells[1515],cells[1574],cells[1058]); + set_offsets(cells[1195],0,4,4,4); + cells[1196]->set_vertices(vertices[235],vertices[187],vertices[236],vertices[196]); + cells[1196]->set_neighbors(cells[768],cells[1462],cells[1421],cells[1005]); + set_offsets(cells[1196],0,0,0,2); + cells[1197]->set_vertices(vertices[245],vertices[6],vertices[285],vertices[45]); + cells[1197]->set_neighbors(cells[1628],cells[1207],cells[1425],cells[1056]); + set_offsets(cells[1197],2,6,0,4); + cells[1198]->set_vertices(vertices[44],vertices[284],vertices[36],vertices[277]); + cells[1198]->set_neighbors(cells[1616],cells[1193],cells[1710],cells[1705]); + set_offsets(cells[1198],4,0,4,0); + cells[1199]->set_vertices(vertices[196],vertices[149],vertices[237],vertices[197]); + cells[1199]->set_neighbors(cells[1182],cells[1426],cells[168],cells[1429]); + set_offsets(cells[1199],2,2,0,2); + cells[1200]->set_vertices(vertices[227],vertices[187],vertices[179],vertices[236]); + cells[1200]->set_neighbors(cells[1392],cells[269],cells[1005],cells[307]); + set_offsets(cells[1200],0,0,0,0); + cells[1201]->set_vertices(vertices[228],vertices[227],vertices[219],vertices[179]); + cells[1201]->set_neighbors(cells[1372],cells[1122],cells[269],cells[326]); + set_offsets(cells[1201],0,0,0,0); + cells[1202]->set_vertices(vertices[30],vertices[270],vertices[22],vertices[263]); + cells[1202]->set_neighbors(cells[264],cells[974],cells[1388],cells[1144]); + set_offsets(cells[1202],4,0,4,0); + cells[1203]->set_vertices(vertices[215],vertices[214],vertices[207],vertices[167]); + cells[1203]->set_neighbors(cells[1161],cells[1204],cells[1306],cells[1350]); + set_offsets(cells[1203],0,0,0,0); + cells[1204]->set_vertices(vertices[215],vertices[208],vertices[167],vertices[207]); + cells[1204]->set_neighbors(cells[117],cells[1203],cells[1546],cells[919]); + set_offsets(cells[1204],0,1,0,0); + cells[1205]->set_vertices(vertices[199],vertices[206],vertices[159],vertices[207]); + cells[1205]->set_neighbors(cells[1260],cells[137],cells[1249],cells[1189]); + set_offsets(cells[1205],0,0,0,0); + cells[1206]->set_vertices(vertices[246],vertices[197],vertices[237],vertices[198]); + cells[1206]->set_neighbors(cells[1182],cells[1478],cells[1213],cells[1668]); + set_offsets(cells[1206],2,2,0,2); + cells[1207]->set_vertices(vertices[4],vertices[245],vertices[285],vertices[45]); + cells[1207]->set_neighbors(cells[1197],cells[1471],cells[236],cells[1630]); + set_offsets(cells[1207],6,2,0,4); + cells[1208]->set_vertices(vertices[286],vertices[246],vertices[46],vertices[285]); + cells[1208]->set_neighbors(cells[1340],cells[1672],cells[1148],cells[1162]); + set_offsets(cells[1208],0,2,4,0); + cells[1209]->set_vertices(vertices[21],vertices[30],vertices[269],vertices[261]); + cells[1209]->set_neighbors(cells[1390],cells[136],cells[1535],cells[1584]); + set_offsets(cells[1209],4,4,0,0); + cells[1210]->set_vertices(vertices[208],vertices[200],vertices[248],vertices[201]); + cells[1210]->set_neighbors(cells[1481],cells[940],cells[967],cells[1451]); + set_offsets(cells[1210],0,0,0,0); + cells[1211]->set_vertices(vertices[214],vertices[205],vertices[254],vertices[206]); + cells[1211]->set_neighbors(cells[1225],cells[1493],cells[1294],cells[1483]); + set_offsets(cells[1211],0,0,0,0); + cells[1212]->set_vertices(vertices[246],vertices[197],vertices[206],vertices[254]); + cells[1212]->set_neighbors(cells[1225],cells[1300],cells[1026],cells[1213]); + set_offsets(cells[1212],0,0,0,0); + cells[1213]->set_vertices(vertices[246],vertices[197],vertices[198],vertices[206]); + cells[1213]->set_neighbors(cells[77],cells[1028],cells[1212],cells[1206]); + set_offsets(cells[1213],0,0,0,0); + cells[1214]->set_vertices(vertices[160],vertices[152],vertices[159],vertices[200]); + cells[1214]->set_neighbors(cells[941],cells[1267],cells[1112],cells[767]); + set_offsets(cells[1214],1,1,0,1); + cells[1215]->set_vertices(vertices[191],vertices[198],vertices[150],vertices[151]); + cells[1215]->set_neighbors(cells[641],cells[1157],cells[1436],cells[1431]); + set_offsets(cells[1215],0,2,2,2); + cells[1216]->set_vertices(vertices[189],vertices[149],vertices[150],vertices[198]); + cells[1216]->set_neighbors(cells[643],cells[1430],cells[1428],cells[1147]); + set_offsets(cells[1216],0,2,2,2); + cells[1217]->set_vertices(vertices[160],vertices[153],vertices[208],vertices[161]); + cells[1217]->set_neighbors(cells[25],cells[1087],cells[701],cells[997]); + set_offsets(cells[1217],0,0,0,0); + cells[1218]->set_vertices(vertices[264],vertices[209],vertices[216],vertices[256]); + cells[1218]->set_neighbors(cells[1226],cells[1601],cells[1599],cells[1446]); + set_offsets(cells[1218],0,0,0,0); + cells[1219]->set_vertices(vertices[45],vertices[46],vertices[285],vertices[37]); + cells[1219]->set_neighbors(cells[1172],cells[1354],cells[219],cells[1628]); + set_offsets(cells[1219],4,4,0,4); + cells[1220]->set_vertices(vertices[39],vertices[279],vertices[32],vertices[40]); + cells[1220]->set_neighbors(cells[1541],cells[539],cells[1594],cells[0]); + set_offsets(cells[1220],4,0,5,5); + cells[1221]->set_vertices(vertices[151],vertices[192],vertices[199],vertices[200]); + cells[1221]->set_neighbors(cells[134],cells[1222],cells[455],cells[1355]); + set_offsets(cells[1221],0,1,0,1); + cells[1222]->set_vertices(vertices[151],vertices[200],vertices[199],vertices[159]); + cells[1222]->set_neighbors(cells[137],cells[1189],cells[941],cells[1221]); + set_offsets(cells[1222],0,1,0,0); + cells[1223]->set_vertices(vertices[2],vertices[250],vertices[243],vertices[10]); + cells[1223]->set_neighbors(cells[1007],cells[1423],cells[1387],cells[1009]); + set_offsets(cells[1223],4,0,0,4); + cells[1224]->set_vertices(vertices[14],vertices[253],vertices[254],vertices[262]); + cells[1224]->set_neighbors(cells[1482],cells[1234],cells[222],cells[1177]); + set_offsets(cells[1224],4,0,0,0); + cells[1225]->set_vertices(vertices[254],vertices[197],vertices[206],vertices[205]); + cells[1225]->set_neighbors(cells[460],cells[1211],cells[1265],cells[1212]); + set_offsets(cells[1225],0,0,0,0); + cells[1226]->set_vertices(vertices[216],vertices[208],vertices[256],vertices[209]); + cells[1226]->set_neighbors(cells[176],cells[1218],cells[1273],cells[1545]); + set_offsets(cells[1226],0,0,0,0); + cells[1227]->set_vertices(vertices[147],vertices[194],vertices[202],vertices[195]); + cells[1227]->set_neighbors(cells[1132],cells[1034],cells[864],cells[1191]); + set_offsets(cells[1227],0,0,0,0); + cells[1228]->set_vertices(vertices[2],vertices[243],vertices[43],vertices[3]); + cells[1228]->set_neighbors(cells[890],cells[374],cells[1423],cells[1445]); + set_offsets(cells[1228],6,2,4,6); + cells[1229]->set_vertices(vertices[200],vertices[153],vertices[193],vertices[201]); + cells[1229]->set_neighbors(cells[48],cells[1481],cells[967],cells[1142]); + set_offsets(cells[1229],0,0,0,0); + cells[1230]->set_vertices(vertices[36],vertices[277],vertices[269],vertices[29]); + cells[1230]->set_neighbors(cells[1181],cells[1527],cells[1629],cells[1639]); + set_offsets(cells[1230],4,0,0,4); + cells[1231]->set_vertices(vertices[241],vertices[281],vertices[41],vertices[2]); + cells[1231]->set_neighbors(cells[1606],cells[1317],cells[1540],cells[1685]); + set_offsets(cells[1231],2,0,4,6); + cells[1232]->set_vertices(vertices[242],vertices[42],vertices[281],vertices[2]); + cells[1232]->set_neighbors(cells[1606],cells[1540],cells[1699],cells[291]); + set_offsets(cells[1232],2,4,0,6); + cells[1233]->set_vertices(vertices[24],vertices[264],vertices[263],vertices[16]); + cells[1233]->set_neighbors(cells[1316],cells[939],cells[1324],cells[1248]); + set_offsets(cells[1233],5,1,0,5); + cells[1234]->set_vertices(vertices[14],vertices[254],vertices[255],vertices[262]); + cells[1234]->set_neighbors(cells[1538],cells[875],cells[1224],cells[944]); + set_offsets(cells[1234],4,0,0,0); + cells[1235]->set_vertices(vertices[23],vertices[263],vertices[15],vertices[16]); + cells[1235]->set_neighbors(cells[1491],cells[453],cells[939],cells[1525]); + set_offsets(cells[1235],4,0,4,5); + cells[1236]->set_vertices(vertices[210],vertices[202],vertices[203],vertices[155]); + cells[1236]->set_neighbors(cells[1237],cells[968],cells[250],cells[947]); + set_offsets(cells[1236],0,0,0,0); + cells[1237]->set_vertices(vertices[155],vertices[202],vertices[203],vertices[195]); + cells[1237]->set_neighbors(cells[665],cells[1011],cells[1034],cells[1236]); + set_offsets(cells[1237],0,0,0,0); + cells[1238]->set_vertices(vertices[31],vertices[38],vertices[271],vertices[279]); + cells[1238]->set_neighbors(cells[1245],cells[1489],cells[1015],cells[1395]); + set_offsets(cells[1238],4,4,0,0); + cells[1239]->set_vertices(vertices[6],vertices[254],vertices[247],vertices[14]); + cells[1239]->set_neighbors(cells[944],cells[266],cells[1466],cells[1485]); + set_offsets(cells[1239],4,0,0,4); + cells[1240]->set_vertices(vertices[199],vertices[198],vertices[151],vertices[206]); + cells[1240]->set_neighbors(cells[146],cells[1189],cells[1028],cells[1088]); + set_offsets(cells[1240],0,0,0,0); + cells[1241]->set_vertices(vertices[213],vertices[212],vertices[205],vertices[165]); + cells[1241]->set_neighbors(cells[1255],cells[1250],cells[1295],cells[964]); + set_offsets(cells[1241],0,0,0,0); + cells[1242]->set_vertices(vertices[195],vertices[250],vertices[203],vertices[243]); + cells[1242]->set_neighbors(cells[1519],cells[1256],cells[280],cells[665]); + set_offsets(cells[1242],0,0,0,0); + cells[1243]->set_vertices(vertices[212],vertices[252],vertices[205],vertices[204]); + cells[1243]->set_neighbors(cells[1470],cells[265],cells[1066],cells[95]); + set_offsets(cells[1243],0,0,0,0); + cells[1244]->set_vertices(vertices[197],vertices[244],vertices[196],vertices[204]); + cells[1244]->set_neighbors(cells[952],cells[168],cells[1521],cells[1426]); + set_offsets(cells[1244],0,0,0,0); + cells[1245]->set_vertices(vertices[279],vertices[278],vertices[38],vertices[271]); + cells[1245]->set_neighbors(cells[1581],cells[1238],cells[936],cells[1716]); + set_offsets(cells[1245],0,0,4,0); + cells[1246]->set_vertices(vertices[277],vertices[37],vertices[38],vertices[29]); + cells[1246]->set_neighbors(cells[553],cells[1181],cells[1629],cells[1474]); + set_offsets(cells[1246],0,4,4,4); + cells[1247]->set_vertices(vertices[279],vertices[280],vertices[239],vertices[231]); + cells[1247]->set_neighbors(cells[1597],cells[1714],cells[1292],cells[957]); + set_offsets(cells[1247],0,1,0,0); + cells[1248]->set_vertices(vertices[271],vertices[264],vertices[263],vertices[24]); + cells[1248]->set_neighbors(cells[1233],cells[1590],cells[1547],cells[1637]); + set_offsets(cells[1248],0,1,0,5); + cells[1249]->set_vertices(vertices[254],vertices[206],vertices[199],vertices[207]); + cells[1249]->set_neighbors(cells[1205],cells[173],cells[1493],cells[1300]); + set_offsets(cells[1249],0,0,0,0); + cells[1250]->set_vertices(vertices[213],vertices[165],vertices[205],vertices[214]); + cells[1250]->set_neighbors(cells[865],cells[1290],cells[1338],cells[1241]); + set_offsets(cells[1250],0,0,0,0); + cells[1251]->set_vertices(vertices[28],vertices[20],vertices[21],vertices[261]); + cells[1251]->set_neighbors(cells[1573],cells[136],cells[128],cells[104]); + set_offsets(cells[1251],4,4,4,0); + cells[1252]->set_vertices(vertices[211],vertices[203],vertices[251],vertices[260]); + cells[1252]->set_neighbors(cells[1020],cells[784],cells[1336],cells[391]); + set_offsets(cells[1252],0,0,0,0); + cells[1253]->set_vertices(vertices[12],vertices[251],vertices[260],vertices[20]); + cells[1253]->set_neighbors(cells[1280],cells[1293],cells[183],cells[1576]); + set_offsets(cells[1253],4,0,0,4); + cells[1254]->set_vertices(vertices[165],vertices[212],vertices[157],vertices[164]); + cells[1254]->set_neighbors(cells[1258],cells[1018],cells[983],cells[1255]); + set_offsets(cells[1254],0,0,0,0); + cells[1255]->set_vertices(vertices[165],vertices[212],vertices[205],vertices[157]); + cells[1255]->set_neighbors(cells[265],cells[865],cells[1254],cells[1241]); + set_offsets(cells[1255],0,0,0,0); + cells[1256]->set_vertices(vertices[243],vertices[195],vertices[252],vertices[203]); + cells[1256]->set_neighbors(cells[1159],cells[1257],cells[1242],cells[1453]); + set_offsets(cells[1256],0,0,0,0); + cells[1257]->set_vertices(vertices[251],vertices[243],vertices[252],vertices[203]); + cells[1257]->set_neighbors(cells[1256],cells[1020],cells[1519],cells[124]); + set_offsets(cells[1257],0,0,0,0); + cells[1258]->set_vertices(vertices[212],vertices[204],vertices[157],vertices[164]); + cells[1258]->set_neighbors(cells[1014],cells[1254],cells[59],cells[265]); + set_offsets(cells[1258],0,0,0,0); + cells[1259]->set_vertices(vertices[192],vertices[144],vertices[191],vertices[232]); + cells[1259]->set_neighbors(cells[1397],cells[613],cells[1053],cells[909]); + set_offsets(cells[1259],3,3,0,1); + cells[1260]->set_vertices(vertices[214],vertices[206],vertices[207],vertices[159]); + cells[1260]->set_neighbors(cells[1205],cells[1161],cells[1264],cells[1493]); + set_offsets(cells[1260],0,0,0,0); + cells[1261]->set_vertices(vertices[31],vertices[271],vertices[23],vertices[24]); + cells[1261]->set_neighbors(cells[1590],cells[2],cells[1413],cells[392]); + set_offsets(cells[1261],4,0,4,5); + cells[1262]->set_vertices(vertices[219],vertices[259],vertices[267],vertices[268]); + cells[1262]->set_neighbors(cells[1526],cells[1624],cells[1575],cells[1622]); + set_offsets(cells[1262],0,0,0,0); + cells[1263]->set_vertices(vertices[255],vertices[247],vertices[7],vertices[8]); + cells[1263]->set_neighbors(cells[963],cells[1304],cells[1534],cells[708]); + set_offsets(cells[1263],0,0,4,5); + cells[1264]->set_vertices(vertices[214],vertices[206],vertices[159],vertices[166]); + cells[1264]->set_neighbors(cells[1031],cells[1160],cells[1040],cells[1260]); + set_offsets(cells[1264],0,0,0,0); + cells[1265]->set_vertices(vertices[245],vertices[197],vertices[254],vertices[205]); + cells[1265]->set_neighbors(cells[1225],cells[1305],cells[1469],cells[1026]); + set_offsets(cells[1265],0,0,0,0); + cells[1266]->set_vertices(vertices[255],vertices[256],vertices[8],vertices[16]); + cells[1266]->set_neighbors(cells[1278],cells[587],cells[1169],cells[1548]); + set_offsets(cells[1266],0,1,5,5); + cells[1267]->set_vertices(vertices[160],vertices[200],vertices[159],vertices[208]); + cells[1267]->set_neighbors(cells[1141],cells[1268],cells[997],cells[1214]); + set_offsets(cells[1267],1,1,0,1); + cells[1268]->set_vertices(vertices[160],vertices[208],vertices[159],vertices[167]); + cells[1268]->set_neighbors(cells[117],cells[1036],cells[1269],cells[1267]); + set_offsets(cells[1268],1,1,0,0); + cells[1269]->set_vertices(vertices[168],vertices[160],vertices[167],vertices[208]); + cells[1269]->set_neighbors(cells[1268],cells[1312],cells[1087],cells[741]); + set_offsets(cells[1269],1,1,0,1); + cells[1270]->set_vertices(vertices[217],vertices[169],vertices[216],vertices[209]); + cells[1270]->set_neighbors(cells[1274],cells[1446],cells[1307],cells[1320]); + set_offsets(cells[1270],0,0,0,0); + cells[1271]->set_vertices(vertices[264],vertices[257],vertices[256],vertices[16]); + cells[1271]->set_neighbors(cells[1552],cells[1316],cells[1324],cells[1599]); + set_offsets(cells[1271],0,0,0,4); + cells[1272]->set_vertices(vertices[219],vertices[171],vertices[211],vertices[220]); + cells[1272]->set_neighbors(cells[1322],cells[1386],cells[962],cells[1275]); + set_offsets(cells[1272],0,0,0,0); + cells[1273]->set_vertices(vertices[216],vertices[161],vertices[208],vertices[209]); + cells[1273]->set_neighbors(cells[138],cells[1226],cells[1274],cells[216]); + set_offsets(cells[1273],0,0,0,0); + cells[1274]->set_vertices(vertices[169],vertices[161],vertices[216],vertices[209]); + cells[1274]->set_neighbors(cells[1273],cells[1270],cells[1049],cells[994]); + set_offsets(cells[1274],0,0,0,0); + cells[1275]->set_vertices(vertices[219],vertices[218],vertices[211],vertices[171]); + cells[1275]->set_neighbors(cells[1287],cells[1272],cells[1326],cells[1334]); + set_offsets(cells[1275],0,0,0,0); + cells[1276]->set_vertices(vertices[230],vertices[270],vertices[223],vertices[222]); + cells[1276]->set_neighbors(cells[1592],cells[1351],cells[673],cells[1636]); + set_offsets(cells[1276],0,0,0,0); + cells[1277]->set_vertices(vertices[251],vertices[250],vertices[258],vertices[10]); + cells[1277]->set_neighbors(cells[1510],cells[749],cells[1007],cells[1549]); + set_offsets(cells[1277],0,0,0,4); + cells[1278]->set_vertices(vertices[256],vertices[249],vertices[8],vertices[16]); + cells[1278]->set_neighbors(cells[1505],cells[1266],cells[1552],cells[1544]); + set_offsets(cells[1278],0,0,4,4); + cells[1279]->set_vertices(vertices[12],vertices[20],vertices[253],vertices[13]); + cells[1279]->set_neighbors(cells[1572],cells[1532],cells[319],cells[1293]); + set_offsets(cells[1279],4,4,0,4); + cells[1280]->set_vertices(vertices[259],vertices[251],vertices[20],vertices[260]); + cells[1280]->set_neighbors(cells[1253],cells[1023],cells[784],cells[1566]); + set_offsets(cells[1280],0,0,4,0); + cells[1281]->set_vertices(vertices[212],vertices[155],vertices[203],vertices[204]); + cells[1281]->set_neighbors(cells[1011],cells[1066],cells[59],cells[441]); + set_offsets(cells[1281],0,0,0,0); + cells[1282]->set_vertices(vertices[218],vertices[210],vertices[211],vertices[163]); + cells[1282]->set_neighbors(cells[364],cells[1287],cells[1289],cells[1516]); + set_offsets(cells[1282],0,0,0,0); + cells[1283]->set_vertices(vertices[244],vertices[4],vertices[283],vertices[243]); + cells[1283]->set_neighbors(cells[1456],cells[1663],cells[929],cells[237]); + set_offsets(cells[1283],2,6,0,2); + cells[1284]->set_vertices(vertices[220],vertices[260],vertices[213],vertices[212]); + cells[1284]->set_neighbors(cells[964],cells[1295],cells[832],cells[262]); + set_offsets(cells[1284],0,0,0,0); + cells[1285]->set_vertices(vertices[258],vertices[210],vertices[250],vertices[203]); + cells[1285]->set_neighbors(cells[947],cells[1549],cells[1048],cells[876]); + set_offsets(cells[1285],0,0,0,0); + cells[1286]->set_vertices(vertices[171],vertices[218],vertices[163],vertices[170]); + cells[1286]->set_neighbors(cells[1289],cells[1055],cells[1080],cells[1287]); + set_offsets(cells[1286],0,0,0,0); + cells[1287]->set_vertices(vertices[171],vertices[218],vertices[211],vertices[163]); + cells[1287]->set_neighbors(cells[1282],cells[1322],cells[1286],cells[1275]); + set_offsets(cells[1287],0,0,0,0); + cells[1288]->set_vertices(vertices[209],vertices[201],vertices[258],vertices[210]); + cells[1288]->set_neighbors(cells[876],cells[1517],cells[960],cells[1561]); + set_offsets(cells[1288],0,0,0,0); + cells[1289]->set_vertices(vertices[218],vertices[210],vertices[163],vertices[170]); + cells[1289]->set_neighbors(cells[775],cells[1286],cells[248],cells[1282]); + set_offsets(cells[1289],0,0,0,0); + cells[1290]->set_vertices(vertices[213],vertices[205],vertices[262],vertices[214]); + cells[1290]->set_neighbors(cells[1483],cells[172],cells[1250],cells[1588]); + set_offsets(cells[1290],0,0,0,0); + cells[1291]->set_vertices(vertices[255],vertices[254],vertices[247],vertices[207]); + cells[1291]->set_neighbors(cells[173],cells[1108],cells[1538],cells[944]); + set_offsets(cells[1291],0,0,0,0); + cells[1292]->set_vertices(vertices[279],vertices[272],vertices[280],vertices[231]); + cells[1292]->set_neighbors(cells[1596],cells[1247],cells[1093],cells[1607]); + set_offsets(cells[1292],0,1,1,0); + cells[1293]->set_vertices(vertices[12],vertices[260],vertices[253],vertices[20]); + cells[1293]->set_neighbors(cells[1188],cells[1279],cells[1253],cells[1577]); + set_offsets(cells[1293],4,0,0,4); + cells[1294]->set_vertices(vertices[214],vertices[157],vertices[205],vertices[206]); + cells[1294]->set_neighbors(cells[460],cells[1211],cells[1040],cells[865]); + set_offsets(cells[1294],0,0,0,0); + cells[1295]->set_vertices(vertices[220],vertices[212],vertices[213],vertices[165]); + cells[1295]->set_neighbors(cells[1241],cells[76],cells[1301],cells[1284]); + set_offsets(cells[1295],0,0,0,0); + cells[1296]->set_vertices(vertices[223],vertices[270],vertices[263],vertices[215]); + cells[1296]->set_neighbors(cells[779],cells[1603],cells[1592],cells[1391]); + set_offsets(cells[1296],0,0,0,0); + cells[1297]->set_vertices(vertices[231],vertices[230],vertices[223],vertices[183]); + cells[1297]->set_neighbors(cells[851],cells[981],cells[972],cells[709]); + set_offsets(cells[1297],0,0,0,0); + cells[1298]->set_vertices(vertices[28],vertices[259],vertices[20],vertices[268]); + cells[1298]->set_neighbors(cells[1023],cells[128],cells[1526],cells[1467]); + set_offsets(cells[1298],4,0,4,0); + cells[1299]->set_vertices(vertices[231],vertices[272],vertices[223],vertices[271]); + cells[1299]->set_neighbors(cells[1348],cells[1643],cells[1093],cells[995]); + set_offsets(cells[1299],0,1,0,0); + cells[1300]->set_vertices(vertices[246],vertices[206],vertices[199],vertices[254]); + cells[1300]->set_neighbors(cells[1249],cells[769],cells[1212],cells[1028]); + set_offsets(cells[1300],0,0,0,0); + cells[1301]->set_vertices(vertices[220],vertices[212],vertices[165],vertices[172]); + cells[1301]->set_neighbors(cells[983],cells[1302],cells[81],cells[1295]); + set_offsets(cells[1301],0,0,0,0); + cells[1302]->set_vertices(vertices[173],vertices[220],vertices[165],vertices[172]); + cells[1302]->set_neighbors(cells[1301],cells[953],cells[155],cells[76]); + set_offsets(cells[1302],0,0,0,0); + cells[1303]->set_vertices(vertices[278],vertices[221],vertices[270],vertices[230]); + cells[1303]->set_neighbors(cells[673],cells[1636],cells[1166],cells[1479]); + set_offsets(cells[1303],0,0,0,0); + cells[1304]->set_vertices(vertices[15],vertices[255],vertices[7],vertices[8]); + cells[1304]->set_neighbors(cells[1263],cells[112],cells[587],cells[1495]); + set_offsets(cells[1304],4,0,4,5); + cells[1305]->set_vertices(vertices[253],vertices[245],vertices[254],vertices[205]); + cells[1305]->set_neighbors(cells[1265],cells[1482],cells[110],cells[1177]); + set_offsets(cells[1305],0,0,0,0); + cells[1306]->set_vertices(vertices[222],vertices[214],vertices[215],vertices[167]); + cells[1306]->set_neighbors(cells[1203],cells[810],cells[1311],cells[1349]); + set_offsets(cells[1306],0,0,0,0); + cells[1307]->set_vertices(vertices[217],vertices[169],vertices[209],vertices[218]); + cells[1307]->set_neighbors(cells[1049],cells[1369],cells[873],cells[1270]); + set_offsets(cells[1307],0,0,0,0); + cells[1308]->set_vertices(vertices[215],vertices[262],vertices[263],vertices[255]); + cells[1308]->set_neighbors(cells[1025],cells[1582],cells[1490],cells[779]); + set_offsets(cells[1308],0,0,0,0); + cells[1309]->set_vertices(vertices[191],vertices[184],vertices[183],vertices[232]); + cells[1309]->set_neighbors(cells[1398],cells[1401],cells[1397],cells[1154]); + set_offsets(cells[1309],0,1,0,1); + cells[1310]->set_vertices(vertices[175],vertices[222],vertices[167],vertices[174]); + cells[1310]->set_neighbors(cells[1311],cells[1077],cells[847],cells[810]); + set_offsets(cells[1310],0,0,0,0); + cells[1311]->set_vertices(vertices[222],vertices[214],vertices[167],vertices[174]); + cells[1311]->set_neighbors(cells[1075],cells[1310],cells[256],cells[1306]); + set_offsets(cells[1311],0,0,0,0); + cells[1312]->set_vertices(vertices[168],vertices[208],vertices[167],vertices[216]); + cells[1312]->set_neighbors(cells[919],cells[1313],cells[216],cells[1269]); + set_offsets(cells[1312],1,1,0,1); + cells[1313]->set_vertices(vertices[168],vertices[216],vertices[167],vertices[175]); + cells[1313]->set_neighbors(cells[69],cells[1078],cells[1314],cells[1312]); + set_offsets(cells[1313],1,1,0,0); + cells[1314]->set_vertices(vertices[176],vertices[168],vertices[175],vertices[216]); + cells[1314]->set_neighbors(cells[1313],cells[1360],cells[16],cells[977]); + set_offsets(cells[1314],1,1,0,1); + cells[1315]->set_vertices(vertices[272],vertices[217],vertices[224],vertices[264]); + cells[1315]->set_neighbors(cells[157],cells[1170],cells[1647],cells[277]); + set_offsets(cells[1315],0,0,0,0); + cells[1316]->set_vertices(vertices[264],vertices[256],vertices[263],vertices[16]); + cells[1316]->set_neighbors(cells[1169],cells[1233],cells[1271],cells[1602]); + set_offsets(cells[1316],1,1,0,5); + cells[1317]->set_vertices(vertices[41],vertices[2],vertices[1],vertices[241]); + cells[1317]->set_neighbors(cells[1449],cells[1402],cells[1231],cells[328]); + set_offsets(cells[1317],4,6,6,2); + cells[1318]->set_vertices(vertices[272],vertices[265],vertices[264],vertices[24]); + cells[1318]->set_neighbors(cells[1609],cells[1547],cells[910],cells[1647]); + set_offsets(cells[1318],0,0,0,4); + cells[1319]->set_vertices(vertices[213],vertices[260],vertices[253],vertices[205]); + cells[1319]->set_neighbors(cells[1465],cells[1588],cells[964],cells[1344]); + set_offsets(cells[1319],0,0,0,0); + cells[1320]->set_vertices(vertices[224],vertices[169],vertices[216],vertices[217]); + cells[1320]->set_neighbors(cells[1270],cells[157],cells[1321],cells[254]); + set_offsets(cells[1320],0,0,0,0); + cells[1321]->set_vertices(vertices[177],vertices[169],vertices[224],vertices[217]); + cells[1321]->set_neighbors(cells[1320],cells[1174],cells[1186],cells[1358]); + set_offsets(cells[1321],0,0,0,0); + cells[1322]->set_vertices(vertices[171],vertices[163],vertices[211],vertices[220]); + cells[1322]->set_neighbors(cells[1062],cells[1272],cells[233],cells[1287]); + set_offsets(cells[1322],0,0,0,0); + cells[1323]->set_vertices(vertices[233],vertices[185],vertices[234],vertices[194]); + cells[1323]->set_neighbors(cells[1414],cells[1617],cells[1408],cells[1415]); + set_offsets(cells[1323],0,0,0,2); + cells[1324]->set_vertices(vertices[24],vertices[257],vertices[264],vertices[16]); + cells[1324]->set_neighbors(cells[1271],cells[1233],cells[1553],cells[1609]); + set_offsets(cells[1324],4,0,0,4); + cells[1325]->set_vertices(vertices[180],vertices[188],vertices[181],vertices[228]); + cells[1325]->set_neighbors(cells[327],cells[1342],cells[925],cells[490]); + set_offsets(cells[1325],0,0,0,0); + cells[1326]->set_vertices(vertices[226],vertices[218],vertices[219],vertices[171]); + cells[1326]->set_neighbors(cells[1275],cells[1333],cells[1337],cells[1373]); + set_offsets(cells[1326],0,0,0,0); + cells[1327]->set_vertices(vertices[187],vertices[148],vertices[188],vertices[236]); + cells[1327]->set_neighbors(cells[1383],cells[1392],cells[768],cells[1134]); + set_offsets(cells[1327],0,2,0,0); + cells[1328]->set_vertices(vertices[42],vertices[282],vertices[34],vertices[275]); + cells[1328]->set_neighbors(cells[1680],cells[1618],cells[1698],cells[1690]); + set_offsets(cells[1328],4,0,4,0); + cells[1329]->set_vertices(vertices[233],vertices[273],vertices[281],vertices[282]); + cells[1329]->set_neighbors(cells[1689],cells[1679],cells[1693],cells[1652]); + set_offsets(cells[1329],0,0,0,0); + cells[1330]->set_vertices(vertices[225],vertices[217],vertices[265],vertices[274]); + cells[1330]->set_neighbors(cells[1367],cells[930],cells[85],cells[1646]); + set_offsets(cells[1330],0,0,0,0); + cells[1331]->set_vertices(vertices[268],vertices[211],vertices[259],vertices[260]); + cells[1331]->set_neighbors(cells[784],cells[1023],cells[1365],cells[1575]); + set_offsets(cells[1331],0,0,0,0); + cells[1332]->set_vertices(vertices[178],vertices[179],vertices[171],vertices[226]); + cells[1332]->set_neighbors(cells[1333],cells[1337],cells[771],cells[1097]); + set_offsets(cells[1332],0,0,0,0); + cells[1333]->set_vertices(vertices[179],vertices[226],vertices[219],vertices[171]); + cells[1333]->set_neighbors(cells[1326],cells[1122],cells[1332],cells[1372]); + set_offsets(cells[1333],0,0,0,0); + cells[1334]->set_vertices(vertices[219],vertices[218],vertices[266],vertices[211]); + cells[1334]->set_neighbors(cells[1335],cells[958],cells[1275],cells[1373]); + set_offsets(cells[1334],0,0,0,0); + cells[1335]->set_vertices(vertices[266],vertices[218],vertices[258],vertices[211]); + cells[1335]->set_neighbors(cells[1516],cells[1564],cells[1334],cells[1110]); + set_offsets(cells[1335],0,0,0,0); + cells[1336]->set_vertices(vertices[211],vertices[203],vertices[260],vertices[212]); + cells[1336]->set_neighbors(cells[1024],cells[832],cells[905],cells[1252]); + set_offsets(cells[1336],0,0,0,0); + cells[1337]->set_vertices(vertices[178],vertices[226],vertices[171],vertices[218]); + cells[1337]->set_neighbors(cells[1326],cells[1080],cells[4],cells[1332]); + set_offsets(cells[1337],0,0,0,0); + cells[1338]->set_vertices(vertices[222],vertices[165],vertices[213],vertices[214]); + cells[1338]->set_neighbors(cells[1250],cells[172],cells[256],cells[1060]); + set_offsets(cells[1338],0,0,0,0); + cells[1339]->set_vertices(vertices[228],vertices[220],vertices[221],vertices[173]); + cells[1339]->set_neighbors(cells[1047],cells[1343],cells[1345],cells[1366]); + set_offsets(cells[1339],0,0,0,0); + cells[1340]->set_vertices(vertices[246],vertices[6],vertices[46],vertices[285]); + cells[1340]->set_neighbors(cells[1628],cells[1208],cells[1056],cells[1400]); + set_offsets(cells[1340],2,6,4,0); + cells[1341]->set_vertices(vertices[283],vertices[275],vertices[42],vertices[35]); + cells[1341]->set_neighbors(cells[1618],cells[1139],cells[1666],cells[1698]); + set_offsets(cells[1341],0,0,4,4); + cells[1342]->set_vertices(vertices[180],vertices[181],vertices[173],vertices[228]); + cells[1342]->set_neighbors(cells[1343],cells[1345],cells[1325],cells[1107]); + set_offsets(cells[1342],0,0,0,0); + cells[1343]->set_vertices(vertices[181],vertices[228],vertices[221],vertices[173]); + cells[1343]->set_neighbors(cells[1339],cells[1109],cells[1342],cells[1375]); + set_offsets(cells[1343],0,0,0,0); + cells[1344]->set_vertices(vertices[213],vertices[260],vertices[261],vertices[253]); + cells[1344]->set_neighbors(cells[1188],cells[1587],cells[1319],cells[522]); + set_offsets(cells[1344],0,0,0,0); + cells[1345]->set_vertices(vertices[180],vertices[228],vertices[173],vertices[220]); + cells[1345]->set_neighbors(cells[1339],cells[155],cells[259],cells[1342]); + set_offsets(cells[1345],0,0,0,0); + cells[1346]->set_vertices(vertices[280],vertices[273],vertices[272],vertices[32]); + cells[1346]->set_neighbors(cells[1657],cells[1607],cells[1645],cells[1433]); + set_offsets(cells[1346],0,0,0,4); + cells[1347]->set_vertices(vertices[185],vertices[184],vertices[232],vertices[177]); + cells[1347]->set_neighbors(cells[913],cells[988],cells[1090],cells[1086]); + set_offsets(cells[1347],0,0,0,0); + cells[1348]->set_vertices(vertices[272],vertices[264],vertices[223],vertices[271]); + cells[1348]->set_neighbors(cells[1637],cells[1299],cells[1547],cells[1170]); + set_offsets(cells[1348],1,1,0,0); + cells[1349]->set_vertices(vertices[222],vertices[262],vertices[215],vertices[214]); + cells[1349]->set_neighbors(cells[1350],cells[1306],cells[172],cells[1591]); + set_offsets(cells[1349],0,0,0,0); + cells[1350]->set_vertices(vertices[215],vertices[214],vertices[262],vertices[207]); + cells[1350]->set_neighbors(cells[468],cells[1490],cells[1203],cells[1349]); + set_offsets(cells[1350],0,0,0,0); + cells[1351]->set_vertices(vertices[230],vertices[222],vertices[223],vertices[175]); + cells[1351]->set_neighbors(cells[989],cells[851],cells[1357],cells[1276]); + set_offsets(cells[1351],0,0,0,0); + cells[1352]->set_vertices(vertices[224],vertices[176],vertices[184],vertices[183]); + cells[1352]->set_neighbors(cells[998],cells[1398],cells[1359],cells[1084]); + set_offsets(cells[1352],1,1,1,0); + cells[1353]->set_vertices(vertices[247],vertices[0],vertices[47],vertices[7]); + cells[1353]->set_neighbors(cells[27],cells[234],cells[963],cells[1713]); + set_offsets(cells[1353],2,7,4,6); + cells[1354]->set_vertices(vertices[45],vertices[285],vertices[44],vertices[37]); + cells[1354]->set_neighbors(cells[58],cells[535],cells[1219],cells[1471]); + set_offsets(cells[1354],4,0,4,4); + cells[1355]->set_vertices(vertices[199],vertices[151],vertices[239],vertices[192]); + cells[1355]->set_neighbors(cells[345],cells[1444],cells[1221],cells[1088]); + set_offsets(cells[1355],2,2,0,3); + cells[1356]->set_vertices(vertices[183],vertices[230],vertices[175],vertices[182]); + cells[1356]->set_neighbors(cells[1357],cells[996],cells[1164],cells[851]); + set_offsets(cells[1356],0,0,0,0); + cells[1357]->set_vertices(vertices[230],vertices[222],vertices[175],vertices[182]); + cells[1357]->set_neighbors(cells[847],cells[1356],cells[244],cells[1351]); + set_offsets(cells[1357],0,0,0,0); + cells[1358]->set_vertices(vertices[176],vertices[169],vertices[224],vertices[177]); + cells[1358]->set_neighbors(cells[1321],cells[1084],cells[1043],cells[254]); + set_offsets(cells[1358],0,0,0,0); + cells[1359]->set_vertices(vertices[176],vertices[224],vertices[175],vertices[183]); + cells[1359]->set_neighbors(cells[753],cells[1117],cells[1352],cells[1360]); + set_offsets(cells[1359],1,1,0,0); + cells[1360]->set_vertices(vertices[176],vertices[216],vertices[175],vertices[224]); + cells[1360]->set_neighbors(cells[1085],cells[1359],cells[254],cells[1314]); + set_offsets(cells[1360],1,1,0,1); + cells[1361]->set_vertices(vertices[192],vertices[145],vertices[233],vertices[193]); + cells[1361]->set_neighbors(cells[1371],cells[1443],cells[718],cells[1409]); + set_offsets(cells[1361],2,2,0,2); + cells[1362]->set_vertices(vertices[276],vertices[236],vertices[227],vertices[228]); + cells[1362]->set_neighbors(cells[269],cells[326],cells[714],cells[1194]); + set_offsets(cells[1362],0,0,0,0); + cells[1363]->set_vertices(vertices[237],vertices[189],vertices[238],vertices[198]); + cells[1363]->set_neighbors(cells[1430],cells[1641],cells[1428],cells[347]); + set_offsets(cells[1363],0,0,0,2); + cells[1364]->set_vertices(vertices[283],vertices[4],vertices[44],vertices[43]); + cells[1364]->set_neighbors(cells[523],cells[1004],cells[1456],cells[237]); + set_offsets(cells[1364],0,6,4,4); + cells[1365]->set_vertices(vertices[268],vertices[211],vertices[260],vertices[220]); + cells[1365]->set_neighbors(cells[832],cells[262],cells[1386],cells[1331]); + set_offsets(cells[1365],0,0,0,0); + cells[1366]->set_vertices(vertices[228],vertices[268],vertices[221],vertices[220]); + cells[1366]->set_neighbors(cells[1381],cells[1339],cells[943],cells[1461]); + set_offsets(cells[1366],0,0,0,0); + cells[1367]->set_vertices(vertices[274],vertices[217],vertices[265],vertices[266]); + cells[1367]->set_neighbors(cells[1059],cells[1385],cells[1178],cells[1330]); + set_offsets(cells[1367],0,0,0,0); + cells[1368]->set_vertices(vertices[227],vertices[226],vertices[179],vertices[234]); + cells[1368]->set_neighbors(cells[1384],cells[307],cells[1654],cells[1372]); + set_offsets(cells[1368],0,0,0,0); + cells[1369]->set_vertices(vertices[217],vertices[209],vertices[266],vertices[218]); + cells[1369]->set_neighbors(cells[1110],cells[1131],cells[1307],cells[1514]); + set_offsets(cells[1369],0,0,0,0); + cells[1370]->set_vertices(vertices[26],vertices[259],vertices[19],vertices[267]); + cells[1370]->set_neighbors(cells[1058],cells[1515],cells[1176],cells[1569]); + set_offsets(cells[1370],4,0,4,0); + cells[1371]->set_vertices(vertices[233],vertices[145],vertices[194],vertices[193]); + cells[1371]->set_neighbors(cells[1000],cells[1455],cells[1361],cells[1408]); + set_offsets(cells[1371],0,2,2,2); + cells[1372]->set_vertices(vertices[227],vertices[226],vertices[219],vertices[179]); + cells[1372]->set_neighbors(cells[1333],cells[1201],cells[1368],cells[916]); + set_offsets(cells[1372],0,0,0,0); + cells[1373]->set_vertices(vertices[226],vertices[266],vertices[219],vertices[218]); + cells[1373]->set_neighbors(cells[1334],cells[1326],cells[1131],cells[529]); + set_offsets(cells[1373],0,0,0,0); + cells[1374]->set_vertices(vertices[276],vertices[219],vertices[268],vertices[228]); + cells[1374]->set_neighbors(cells[943],cells[1461],cells[326],cells[1624]); + set_offsets(cells[1374],0,0,0,0); + cells[1375]->set_vertices(vertices[229],vertices[228],vertices[221],vertices[181]); + cells[1375]->set_neighbors(cells[1343],cells[863],cells[1184],cells[1664]); + set_offsets(cells[1375],0,0,0,0); + cells[1376]->set_vertices(vertices[235],vertices[147],vertices[196],vertices[195]); + cells[1376]->set_neighbors(cells[309],cells[1458],cells[864],cells[1421]); + set_offsets(cells[1376],0,2,2,2); + cells[1377]->set_vertices(vertices[244],vertices[195],vertices[204],vertices[252]); + cells[1377]->set_neighbors(cells[1159],cells[1521],cells[1453],cells[952]); + set_offsets(cells[1377],0,0,0,0); + cells[1378]->set_vertices(vertices[209],vertices[249],vertices[257],vertices[258]); + cells[1378]->set_neighbors(cells[145],cells[1559],cells[1561],cells[1551]); + set_offsets(cells[1378],0,0,0,0); + cells[1379]->set_vertices(vertices[4],vertices[243],vertices[252],vertices[12]); + cells[1379]->set_neighbors(cells[124],cells[1175],cells[1457],cells[929]); + set_offsets(cells[1379],4,0,0,4); + cells[1380]->set_vertices(vertices[242],vertices[195],vertices[283],vertices[243]); + cells[1380]->set_neighbors(cells[1663],cells[1619],cells[280],cells[1700]); + set_offsets(cells[1380],2,2,0,2); + cells[1381]->set_vertices(vertices[221],vertices[220],vertices[268],vertices[213]); + cells[1381]->set_neighbors(cells[262],cells[891],cells[1047],cells[1366]); + set_offsets(cells[1381],0,0,0,0); + cells[1382]->set_vertices(vertices[275],vertices[267],vertices[36],vertices[276]); + cells[1382]->set_neighbors(cells[1045],cells[1704],cells[1626],cells[1389]); + set_offsets(cells[1382],0,0,4,0); + cells[1383]->set_vertices(vertices[236],vertices[148],vertices[188],vertices[189]); + cells[1383]->set_neighbors(cells[116],cells[1114],cells[126],cells[1327]); + set_offsets(cells[1383],0,2,0,0); + cells[1384]->set_vertices(vertices[226],vertices[234],vertices[186],vertices[179]); + cells[1384]->set_neighbors(cells[1171],cells[771],cells[1368],cells[1185]); + set_offsets(cells[1384],0,0,0,0); + cells[1385]->set_vertices(vertices[274],vertices[265],vertices[26],vertices[266]); + cells[1385]->set_neighbors(cells[570],cells[1620],cells[1367],cells[1563]); + set_offsets(cells[1385],0,0,4,0); + cells[1386]->set_vertices(vertices[219],vertices[211],vertices[268],vertices[220]); + cells[1386]->set_neighbors(cells[1365],cells[943],cells[1272],cells[1575]); + set_offsets(cells[1386],0,0,0,0); + cells[1387]->set_vertices(vertices[2],vertices[241],vertices[250],vertices[10]); + cells[1387]->set_neighbors(cells[1422],cells[1223],cells[1449],cells[1511]); + set_offsets(cells[1387],4,0,0,4); + cells[1388]->set_vertices(vertices[271],vertices[270],vertices[30],vertices[263]); + cells[1388]->set_neighbors(cells[1202],cells[1593],cells[1391],cells[1589]); + set_offsets(cells[1388],0,0,4,0); + cells[1389]->set_vertices(vertices[267],vertices[275],vertices[36],vertices[27]); + cells[1389]->set_neighbors(cells[1424],cells[1574],cells[874],cells[1382]); + set_offsets(cells[1389],0,0,4,4); + cells[1390]->set_vertices(vertices[269],vertices[261],vertices[30],vertices[270]); + cells[1390]->set_neighbors(cells[1144],cells[911],cells[1536],cells[1209]); + set_offsets(cells[1390],0,0,4,0); + cells[1391]->set_vertices(vertices[223],vertices[270],vertices[271],vertices[263]); + cells[1391]->set_neighbors(cells[1388],cells[1637],cells[1296],cells[1644]); + set_offsets(cells[1391],0,0,0,0); + cells[1392]->set_vertices(vertices[187],vertices[188],vertices[179],vertices[236]); + cells[1392]->set_neighbors(cells[133],cells[1200],cells[1327],cells[897]); + set_offsets(cells[1392],0,0,0,0); + cells[1393]->set_vertices(vertices[231],vertices[232],vertices[183],vertices[224]); + cells[1393]->set_neighbors(cells[1398],cells[981],cells[1410],cells[1401]); + set_offsets(cells[1393],0,1,0,1); + cells[1394]->set_vertices(vertices[239],vertices[280],vertices[192],vertices[232]); + cells[1394]->set_neighbors(cells[1642],cells[613],cells[1597],cells[1678]); + set_offsets(cells[1394],0,1,3,1); + cells[1395]->set_vertices(vertices[31],vertices[30],vertices[271],vertices[38]); + cells[1395]->set_neighbors(cells[1581],cells[1238],cells[464],cells[392]); + set_offsets(cells[1395],4,4,0,4); + cells[1396]->set_vertices(vertices[225],vertices[232],vertices[224],vertices[177]); + cells[1396]->set_neighbors(cells[913],cells[1174],cells[988],cells[1598]); + set_offsets(cells[1396],0,0,0,0); + cells[1397]->set_vertices(vertices[232],vertices[144],vertices[191],vertices[184]); + cells[1397]->set_neighbors(cells[1153],cells[1309],cells[1086],cells[1259]); + set_offsets(cells[1397],1,3,0,1); + cells[1398]->set_vertices(vertices[232],vertices[184],vertices[183],vertices[224]); + cells[1398]->set_neighbors(cells[1352],cells[1393],cells[913],cells[1309]); + set_offsets(cells[1398],1,1,0,1); + cells[1399]->set_vertices(vertices[246],vertices[199],vertices[239],vertices[287]); + cells[1399]->set_neighbors(cells[1640],cells[1634],cells[1722],cells[1486]); + set_offsets(cells[1399],2,2,0,0); + cells[1400]->set_vertices(vertices[6],vertices[246],vertices[46],vertices[287]); + cells[1400]->set_neighbors(cells[1162],cells[1488],cells[1723],cells[1340]); + set_offsets(cells[1400],6,2,4,0); + cells[1401]->set_vertices(vertices[231],vertices[191],vertices[183],vertices[232]); + cells[1401]->set_neighbors(cells[1309],cells[1393],cells[1437],cells[323]); + set_offsets(cells[1401],0,0,0,1); + cells[1402]->set_vertices(vertices[41],vertices[241],vertices[1],vertices[0]); + cells[1402]->set_neighbors(cells[1101],cells[1],cells[1685],cells[1317]); + set_offsets(cells[1402],4,2,6,6); + cells[1403]->set_vertices(vertices[242],vertices[193],vertices[250],vertices[241]); + cells[1403]->set_neighbors(cells[1502],cells[1511],cells[1404],cells[1512]); + set_offsets(cells[1403],0,0,0,0); + cells[1404]->set_vertices(vertices[241],vertices[193],vertices[281],vertices[242]); + cells[1404]->set_neighbors(cells[1499],cells[1540],cells[1403],cells[1683]); + set_offsets(cells[1404],2,2,0,2); + cells[1405]->set_vertices(vertices[40],vertices[240],vertices[287],vertices[280]); + cells[1405]->set_neighbors(cells[1676],cells[1180],cells[1688],cells[1677]); + set_offsets(cells[1405],5,3,0,1); + cells[1406]->set_vertices(vertices[233],vertices[185],vertices[192],vertices[232]); + cells[1406]->set_neighbors(cells[1053],cells[1642],cells[1407],cells[1409]); + set_offsets(cells[1406],0,0,2,0); + cells[1407]->set_vertices(vertices[225],vertices[185],vertices[233],vertices[232]); + cells[1407]->set_neighbors(cells[1406],cells[125],cells[988],cells[1415]); + set_offsets(cells[1407],0,0,0,0); + cells[1408]->set_vertices(vertices[185],vertices[145],vertices[194],vertices[233]); + cells[1408]->set_neighbors(cells[1371],cells[1323],cells[1409],cells[602]); + set_offsets(cells[1408],0,2,2,0); + cells[1409]->set_vertices(vertices[192],vertices[145],vertices[185],vertices[233]); + cells[1409]->set_neighbors(cells[1408],cells[1406],cells[1361],cells[914]); + set_offsets(cells[1409],2,2,0,0); + cells[1410]->set_vertices(vertices[231],vertices[272],vertices[232],vertices[224]); + cells[1410]->set_neighbors(cells[1598],cells[1393],cells[995],cells[1596]); + set_offsets(cells[1410],0,1,1,1); + cells[1411]->set_vertices(vertices[261],vertices[253],vertices[22],vertices[262]); + cells[1411]->set_neighbors(cells[222],cells[1533],cells[1587],cells[1579]); + set_offsets(cells[1411],0,0,4,0); + cells[1412]->set_vertices(vertices[32],vertices[273],vertices[25],vertices[33]); + cells[1412]->set_neighbors(cells[948],cells[402],cells[1439],cells[1658]); + set_offsets(cells[1412],4,0,4,4); + cells[1413]->set_vertices(vertices[31],vertices[271],vertices[24],vertices[32]); + cells[1413]->set_neighbors(cells[1492],cells[499],cells[1489],cells[1261]); + set_offsets(cells[1413],4,0,5,5); + cells[1414]->set_vertices(vertices[185],vertices[146],vertices[234],vertices[194]); + cells[1414]->set_neighbors(cells[1115],cells[1323],cells[602],cells[65]); + set_offsets(cells[1414],0,2,0,2); + cells[1415]->set_vertices(vertices[233],vertices[185],vertices[225],vertices[234]); + cells[1415]->set_neighbors(cells[1416],cells[344],cells[1323],cells[1407]); + set_offsets(cells[1415],0,0,0,0); + cells[1416]->set_vertices(vertices[225],vertices[185],vertices[177],vertices[234]); + cells[1416]->set_neighbors(cells[1173],cells[889],cells[1415],cells[988]); + set_offsets(cells[1416],0,0,0,0); + cells[1417]->set_vertices(vertices[14],vertices[245],vertices[5],vertices[6]); + cells[1417]->set_neighbors(cells[1425],cells[62],cells[1466],cells[1530]); + set_offsets(cells[1417],4,0,4,4); + cells[1418]->set_vertices(vertices[227],vertices[235],vertices[234],vertices[187]); + cells[1418]->set_neighbors(cells[1419],cells[307],cells[1005],cells[252]); + set_offsets(cells[1418],0,0,0,0); + cells[1419]->set_vertices(vertices[235],vertices[194],vertices[234],vertices[187]); + cells[1419]->set_neighbors(cells[1115],cells[1418],cells[1420],cells[1694]); + set_offsets(cells[1419],0,2,0,0); + cells[1420]->set_vertices(vertices[194],vertices[147],vertices[187],vertices[235]); + cells[1420]->set_neighbors(cells[1421],cells[1419],cells[864],cells[840]); + set_offsets(cells[1420],2,2,0,0); + cells[1421]->set_vertices(vertices[187],vertices[147],vertices[196],vertices[235]); + cells[1421]->set_neighbors(cells[1376],cells[1196],cells[1420],cells[1133]); + set_offsets(cells[1421],0,2,2,0); + cells[1422]->set_vertices(vertices[250],vertices[241],vertices[249],vertices[10]); + cells[1422]->set_neighbors(cells[1448],cells[1510],cells[1387],cells[342]); + set_offsets(cells[1422],0,0,0,4); + cells[1423]->set_vertices(vertices[2],vertices[10],vertices[243],vertices[3]); + cells[1423]->set_neighbors(cells[945],cells[1228],cells[72],cells[1223]); + set_offsets(cells[1423],4,4,0,4); + cells[1424]->set_vertices(vertices[275],vertices[35],vertices[36],vertices[27]); + cells[1424]->set_neighbors(cells[503],cells[1389],cells[1660],cells[267]); + set_offsets(cells[1424],0,4,4,4); + cells[1425]->set_vertices(vertices[245],vertices[6],vertices[45],vertices[5]); + cells[1425]->set_neighbors(cells[12],cells[236],cells[1417],cells[1197]); + set_offsets(cells[1425],2,6,4,6); + cells[1426]->set_vertices(vertices[244],vertices[196],vertices[237],vertices[197]); + cells[1426]->set_neighbors(cells[1199],cells[1712],cells[1244],cells[1475]); + set_offsets(cells[1426],2,2,0,2); + cells[1427]->set_vertices(vertices[229],vertices[237],vertices[236],vertices[189]); + cells[1427]->set_neighbors(cells[238],cells[830],cells[347],cells[1463]); + set_offsets(cells[1427],0,0,0,0); + cells[1428]->set_vertices(vertices[189],vertices[149],vertices[198],vertices[237]); + cells[1428]->set_neighbors(cells[1182],cells[1363],cells[1429],cells[1216]); + set_offsets(cells[1428],0,2,2,0); + cells[1429]->set_vertices(vertices[196],vertices[149],vertices[189],vertices[237]); + cells[1429]->set_neighbors(cells[1428],cells[238],cells[1199],cells[862]); + set_offsets(cells[1429],2,2,0,0); + cells[1430]->set_vertices(vertices[198],vertices[150],vertices[189],vertices[238]); + cells[1430]->set_neighbors(cells[1167],cells[1363],cells[1431],cells[1216]); + set_offsets(cells[1430],2,2,0,0); + cells[1431]->set_vertices(vertices[191],vertices[150],vertices[198],vertices[238]); + cells[1431]->set_neighbors(cells[1430],cells[1435],cells[973],cells[1215]); + set_offsets(cells[1431],0,2,2,0); + cells[1432]->set_vertices(vertices[200],vertices[193],vertices[240],vertices[248]); + cells[1432]->set_neighbors(cells[301],cells[1498],cells[1481],cells[1143]); + set_offsets(cells[1432],0,0,0,0); + cells[1433]->set_vertices(vertices[273],vertices[225],vertices[280],vertices[272]); + cells[1433]->set_neighbors(cells[1487],cells[1346],cells[1656],cells[1648]); + set_offsets(cells[1433],0,0,0,0); + cells[1434]->set_vertices(vertices[191],vertices[239],vertices[231],vertices[238]); + cells[1434]->set_neighbors(cells[1674],cells[323],cells[1435],cells[1437]); + set_offsets(cells[1434],0,0,0,0); + cells[1435]->set_vertices(vertices[191],vertices[198],vertices[239],vertices[238]); + cells[1435]->set_neighbors(cells[1473],cells[1434],cells[1431],cells[1436]); + set_offsets(cells[1435],0,2,0,0); + cells[1436]->set_vertices(vertices[198],vertices[151],vertices[191],vertices[239]); + cells[1436]->set_neighbors(cells[345],cells[1435],cells[1088],cells[1215]); + set_offsets(cells[1436],2,2,0,0); + cells[1437]->set_vertices(vertices[231],vertices[191],vertices[232],vertices[239]); + cells[1437]->set_neighbors(cells[613],cells[1597],cells[1434],cells[1401]); + set_offsets(cells[1437],0,0,1,0); + cells[1438]->set_vertices(vertices[273],vertices[34],vertices[33],vertices[42]); + cells[1438]->set_neighbors(cells[449],cells[628],cells[1690],cells[948]); + set_offsets(cells[1438],0,4,4,4); + cells[1439]->set_vertices(vertices[40],vertices[32],vertices[33],vertices[273]); + cells[1439]->set_neighbors(cells[1412],cells[586],cells[1645],cells[160]); + set_offsets(cells[1439],4,4,4,0); + cells[1440]->set_vertices(vertices[227],vertices[274],vertices[267],vertices[219]); + cells[1440]->set_neighbors(cells[1152],cells[1625],cells[916],cells[1578]); + set_offsets(cells[1440],0,0,0,0); + cells[1441]->set_vertices(vertices[199],vertices[248],vertices[247],vertices[207]); + cells[1441]->set_neighbors(cells[1108],cells[173],cells[1450],cells[1497]); + set_offsets(cells[1441],0,1,0,0); + cells[1442]->set_vertices(vertices[0],vertices[247],vertices[248],vertices[8]); + cells[1442]->set_neighbors(cells[1534],cells[975],cells[963],cells[1496]); + set_offsets(cells[1442],5,0,1,5); + cells[1443]->set_vertices(vertices[240],vertices[192],vertices[233],vertices[193]); + cells[1443]->set_neighbors(cells[1361],cells[1682],cells[1143],cells[1052]); + set_offsets(cells[1443],2,2,0,2); + cells[1444]->set_vertices(vertices[199],vertices[192],vertices[239],vertices[240]); + cells[1444]->set_neighbors(cells[1678],cells[1640],cells[134],cells[1355]); + set_offsets(cells[1444],2,3,0,3); + cells[1445]->set_vertices(vertices[2],vertices[243],vertices[283],vertices[43]); + cells[1445]->set_neighbors(cells[1456],cells[931],cells[1228],cells[1619]); + set_offsets(cells[1445],6,2,0,4); + cells[1446]->set_vertices(vertices[217],vertices[209],vertices[216],vertices[264]); + cells[1446]->set_neighbors(cells[1218],cells[157],cells[1600],cells[1270]); + set_offsets(cells[1446],0,0,0,0); + cells[1447]->set_vertices(vertices[1],vertices[241],vertices[249],vertices[8]); + cells[1447]->set_neighbors(cells[1503],cells[1506],cells[1101],cells[1448]); + set_offsets(cells[1447],4,0,0,4); + cells[1448]->set_vertices(vertices[1],vertices[10],vertices[249],vertices[241]); + cells[1448]->set_neighbors(cells[1422],cells[1447],cells[1449],cells[1507]); + set_offsets(cells[1448],4,4,0,0); + cells[1449]->set_vertices(vertices[1],vertices[2],vertices[10],vertices[241]); + cells[1449]->set_neighbors(cells[1387],cells[1448],cells[1317],cells[53]); + set_offsets(cells[1449],4,4,4,0); + cells[1450]->set_vertices(vertices[199],vertices[200],vertices[248],vertices[207]); + cells[1450]->set_neighbors(cells[1451],cells[1441],cells[137],cells[1498]); + set_offsets(cells[1450],0,1,1,0); + cells[1451]->set_vertices(vertices[208],vertices[200],vertices[207],vertices[248]); + cells[1451]->set_neighbors(cells[1450],cells[1508],cells[1210],cells[1141]); + set_offsets(cells[1451],1,1,0,1); + cells[1452]->set_vertices(vertices[275],vertices[235],vertices[282],vertices[227]); + cells[1452]->set_neighbors(cells[252],cells[1649],cells[1702],cells[1695]); + set_offsets(cells[1452],0,0,0,0); + cells[1453]->set_vertices(vertices[243],vertices[195],vertices[244],vertices[252]); + cells[1453]->set_neighbors(cells[1377],cells[929],cells[1256],cells[1663]); + set_offsets(cells[1453],0,0,0,0); + cells[1454]->set_vertices(vertices[194],vertices[193],vertices[202],vertices[242]); + cells[1454]->set_neighbors(cells[1512],cells[1132],cells[1455],cells[1000]); + set_offsets(cells[1454],0,0,0,0); + cells[1455]->set_vertices(vertices[242],vertices[193],vertices[233],vertices[194]); + cells[1455]->set_neighbors(cells[1371],cells[226],cells[1454],cells[1499]); + set_offsets(cells[1455],2,2,0,2); + cells[1456]->set_vertices(vertices[243],vertices[4],vertices[283],vertices[43]); + cells[1456]->set_neighbors(cells[1364],cells[1445],cells[890],cells[1283]); + set_offsets(cells[1456],2,6,0,4); + cells[1457]->set_vertices(vertices[3],vertices[4],vertices[12],vertices[243]); + cells[1457]->set_neighbors(cells[1379],cells[1468],cells[890],cells[31]); + set_offsets(cells[1457],4,4,4,0); + cells[1458]->set_vertices(vertices[244],vertices[195],vertices[235],vertices[196]); + cells[1458]->set_neighbors(cells[1376],cells[1570],cells[952],cells[1662]); + set_offsets(cells[1458],2,2,0,2); + cells[1459]->set_vertices(vertices[284],vertices[235],vertices[227],vertices[236]); + cells[1459]->set_neighbors(cells[1005],cells[1194],cells[1462],cells[1702]); + set_offsets(cells[1459],0,0,0,0); + cells[1460]->set_vertices(vertices[276],vertices[268],vertices[269],vertices[221]); + cells[1460]->set_neighbors(cells[1633],cells[1140],cells[1461],cells[1631]); + set_offsets(cells[1460],0,0,0,0); + cells[1461]->set_vertices(vertices[276],vertices[228],vertices[268],vertices[221]); + cells[1461]->set_neighbors(cells[1366],cells[1460],cells[1664],cells[1374]); + set_offsets(cells[1461],0,0,0,0); + cells[1462]->set_vertices(vertices[284],vertices[196],vertices[235],vertices[236]); + cells[1462]->set_neighbors(cells[1196],cells[1459],cells[1706],cells[1570]); + set_offsets(cells[1462],0,2,0,0); + cells[1463]->set_vertices(vertices[284],vertices[237],vertices[236],vertices[229]); + cells[1463]->set_neighbors(cells[1427],cells[1665],cells[1003],cells[1706]); + set_offsets(cells[1463],0,0,0,0); + cells[1464]->set_vertices(vertices[21],vertices[269],vertices[29],vertices[28]); + cells[1464]->set_neighbors(cells[1527],cells[439],cells[136],cells[1584]); + set_offsets(cells[1464],4,0,4,4); + cells[1465]->set_vertices(vertices[260],vertices[252],vertices[253],vertices[205]); + cells[1465]->set_neighbors(cells[110],cells[1319],cells[95],cells[1577]); + set_offsets(cells[1465],0,0,0,0); + cells[1466]->set_vertices(vertices[6],vertices[245],vertices[254],vertices[14]); + cells[1466]->set_neighbors(cells[1177],cells[1239],cells[1417],cells[197]); + set_offsets(cells[1466],4,0,0,4); + cells[1467]->set_vertices(vertices[259],vertices[20],vertices[19],vertices[28]); + cells[1467]->set_neighbors(cells[271],cells[1058],cells[1298],cells[1567]); + set_offsets(cells[1467],0,4,4,4); + cells[1468]->set_vertices(vertices[3],vertices[12],vertices[251],vertices[243]); + cells[1468]->set_neighbors(cells[124],cells[945],cells[1457],cells[803]); + set_offsets(cells[1468],4,4,0,0); + cells[1469]->set_vertices(vertices[245],vertices[252],vertices[197],vertices[205]); + cells[1469]->set_neighbors(cells[1470],cells[1265],cells[110],cells[1522]); + set_offsets(cells[1469],0,0,0,0); + cells[1470]->set_vertices(vertices[252],vertices[204],vertices[197],vertices[205]); + cells[1470]->set_neighbors(cells[443],cells[1469],cells[1243],cells[1521]); + set_offsets(cells[1470],0,0,0,0); + cells[1471]->set_vertices(vertices[4],vertices[285],vertices[44],vertices[45]); + cells[1471]->set_neighbors(cells[1354],cells[575],cells[1207],cells[1711]); + set_offsets(cells[1471],6,0,4,4); + cells[1472]->set_vertices(vertices[229],vertices[269],vertices[277],vertices[278]); + cells[1472]->set_neighbors(cells[322],cells[1480],cells[1670],cells[1638]); + set_offsets(cells[1472],0,0,0,0); + cells[1473]->set_vertices(vertices[238],vertices[198],vertices[239],vertices[286]); + cells[1473]->set_neighbors(cells[1022],cells[1674],cells[1641],cells[1435]); + set_offsets(cells[1473],0,2,0,0); + cells[1474]->set_vertices(vertices[277],vertices[46],vertices[38],vertices[37]); + cells[1474]->set_neighbors(cells[275],cells[1246],cells[1172],cells[1718]); + set_offsets(cells[1474],0,4,4,4); + cells[1475]->set_vertices(vertices[237],vertices[196],vertices[244],vertices[284]); + cells[1475]->set_neighbors(cells[1570],cells[1708],cells[1706],cells[1426]); + set_offsets(cells[1475],0,2,2,0); + cells[1476]->set_vertices(vertices[231],vertices[286],vertices[278],vertices[238]); + cells[1476]->set_neighbors(cells[1673],cells[1675],cells[1674],cells[1715]); + set_offsets(cells[1476],0,0,0,0); + cells[1477]->set_vertices(vertices[279],vertices[272],vertices[271],vertices[32]); + cells[1477]->set_neighbors(cells[1492],cells[1489],cells[1607],cells[1093]); + set_offsets(cells[1477],0,1,0,5); + cells[1478]->set_vertices(vertices[286],vertices[198],vertices[246],vertices[237]); + cells[1478]->set_neighbors(cells[1206],cells[1148],cells[1641],cells[1022]); + set_offsets(cells[1478],0,2,2,0); + cells[1479]->set_vertices(vertices[278],vertices[221],vertices[269],vertices[270]); + cells[1479]->set_neighbors(cells[1536],cells[911],cells[1303],cells[1670]); + set_offsets(cells[1479],0,0,0,0); + cells[1480]->set_vertices(vertices[278],vertices[286],vertices[277],vertices[229]); + cells[1480]->set_neighbors(cells[623],cells[1472],cells[1673],cells[1719]); + set_offsets(cells[1480],0,0,0,0); + cells[1481]->set_vertices(vertices[200],vertices[193],vertices[248],vertices[201]); + cells[1481]->set_neighbors(cells[34],cells[1210],cells[1229],cells[1432]); + set_offsets(cells[1481],0,0,0,0); + cells[1482]->set_vertices(vertices[262],vertices[205],vertices[253],vertices[254]); + cells[1482]->set_neighbors(cells[1305],cells[1224],cells[1483],cells[1588]); + set_offsets(cells[1482],0,0,0,0); + cells[1483]->set_vertices(vertices[262],vertices[205],vertices[254],vertices[214]); + cells[1483]->set_neighbors(cells[1211],cells[468],cells[1290],cells[1482]); + set_offsets(cells[1483],0,0,0,0); + cells[1484]->set_vertices(vertices[12],vertices[252],vertices[245],vertices[253]); + cells[1484]->set_neighbors(cells[110],cells[1531],cells[1577],cells[1175]); + set_offsets(cells[1484],4,0,0,0); + cells[1485]->set_vertices(vertices[6],vertices[246],vertices[247],vertices[254]); + cells[1485]->set_neighbors(cells[769],cells[1239],cells[197],cells[1723]); + set_offsets(cells[1485],4,0,0,0); + cells[1486]->set_vertices(vertices[246],vertices[198],vertices[239],vertices[199]); + cells[1486]->set_neighbors(cells[1088],cells[1399],cells[1028],cells[1022]); + set_offsets(cells[1486],2,2,0,2); + cells[1487]->set_vertices(vertices[272],vertices[225],vertices[280],vertices[232]); + cells[1487]->set_neighbors(cells[125],cells[1596],cells[1598],cells[1433]); + set_offsets(cells[1487],0,0,0,0); + cells[1488]->set_vertices(vertices[47],vertices[46],vertices[287],vertices[6]); + cells[1488]->set_neighbors(cells[1400],cells[1724],cells[582],cells[1021]); + set_offsets(cells[1488],4,4,0,6); + cells[1489]->set_vertices(vertices[31],vertices[271],vertices[32],vertices[279]); + cells[1489]->set_neighbors(cells[1477],cells[0],cells[1238],cells[1413]); + set_offsets(cells[1489],4,0,5,0); + cells[1490]->set_vertices(vertices[215],vertices[262],vertices[255],vertices[207]); + cells[1490]->set_neighbors(cells[1538],cells[1539],cells[1350],cells[1308]); + set_offsets(cells[1490],0,0,0,0); + cells[1491]->set_vertices(vertices[263],vertices[255],vertices[15],vertices[16]); + cells[1491]->set_neighbors(cells[587],cells[1235],cells[1169],cells[1537]); + set_offsets(cells[1491],0,0,4,5); + cells[1492]->set_vertices(vertices[32],vertices[272],vertices[271],vertices[24]); + cells[1492]->set_neighbors(cells[1547],cells[1413],cells[910],cells[1477]); + set_offsets(cells[1492],5,1,0,5); + cells[1493]->set_vertices(vertices[214],vertices[254],vertices[207],vertices[206]); + cells[1493]->set_neighbors(cells[1249],cells[1260],cells[1211],cells[468]); + set_offsets(cells[1493],0,0,0,0); + cells[1494]->set_vertices(vertices[14],vertices[22],vertices[255],vertices[15]); + cells[1494]->set_neighbors(cells[1537],cells[1495],cells[18],cells[875]); + set_offsets(cells[1494],4,4,0,4); + cells[1495]->set_vertices(vertices[15],vertices[14],vertices[7],vertices[255]); + cells[1495]->set_neighbors(cells[708],cells[1304],cells[1494],cells[189]); + set_offsets(cells[1495],4,4,4,0); + cells[1496]->set_vertices(vertices[0],vertices[247],vertices[240],vertices[248]); + cells[1496]->set_neighbors(cells[1497],cells[229],cells[1442],cells[1721]); + set_offsets(cells[1496],5,0,1,1); + cells[1497]->set_vertices(vertices[199],vertices[240],vertices[247],vertices[248]); + cells[1497]->set_neighbors(cells[1496],cells[1441],cells[1498],cells[1720]); + set_offsets(cells[1497],0,1,0,1); + cells[1498]->set_vertices(vertices[199],vertices[200],vertices[240],vertices[248]); + cells[1498]->set_neighbors(cells[1432],cells[1497],cells[1450],cells[134]); + set_offsets(cells[1498],0,1,1,1); + cells[1499]->set_vertices(vertices[281],vertices[193],vertices[233],vertices[242]); + cells[1499]->set_neighbors(cells[1455],cells[1679],cells[1404],cells[1682]); + set_offsets(cells[1499],0,2,0,2); + cells[1500]->set_vertices(vertices[210],vertices[201],vertices[250],vertices[202]); + cells[1500]->set_neighbors(cells[1501],cells[947],cells[811],cells[876]); + set_offsets(cells[1500],0,0,0,0); + cells[1501]->set_vertices(vertices[202],vertices[193],vertices[201],vertices[250]); + cells[1501]->set_neighbors(cells[1502],cells[1500],cells[1512],cells[48]); + set_offsets(cells[1501],0,0,0,0); + cells[1502]->set_vertices(vertices[250],vertices[193],vertices[201],vertices[241]); + cells[1502]->set_neighbors(cells[34],cells[342],cells[1403],cells[1501]); + set_offsets(cells[1502],0,0,0,0); + cells[1503]->set_vertices(vertices[248],vertices[241],vertices[8],vertices[249]); + cells[1503]->set_neighbors(cells[1447],cells[1544],cells[1509],cells[975]); + set_offsets(cells[1503],0,0,4,0); + cells[1504]->set_vertices(vertices[256],vertices[248],vertices[207],vertices[255]); + cells[1504]->set_neighbors(cells[1108],cells[1539],cells[1548],cells[1508]); + set_offsets(cells[1504],1,1,0,0); + cells[1505]->set_vertices(vertices[249],vertices[16],vertices[9],vertices[8]); + cells[1505]->set_neighbors(cells[101],cells[1506],cells[1278],cells[1557]); + set_offsets(cells[1505],0,4,4,4); + cells[1506]->set_vertices(vertices[1],vertices[249],vertices[9],vertices[8]); + cells[1506]->set_neighbors(cells[1505],cells[336],cells[1447],cells[1507]); + set_offsets(cells[1506],4,0,4,4); + cells[1507]->set_vertices(vertices[1],vertices[10],vertices[9],vertices[249]); + cells[1507]->set_neighbors(cells[1006],cells[1506],cells[1448],cells[39]); + set_offsets(cells[1507],4,4,4,0); + cells[1508]->set_vertices(vertices[256],vertices[208],vertices[207],vertices[248]); + cells[1508]->set_neighbors(cells[1451],cells[1504],cells[940],cells[1546]); + set_offsets(cells[1508],1,1,0,1); + cells[1509]->set_vertices(vertices[248],vertices[241],vertices[249],vertices[201]); + cells[1509]->set_neighbors(cells[342],cells[1543],cells[34],cells[1503]); + set_offsets(cells[1509],0,0,0,0); + cells[1510]->set_vertices(vertices[250],vertices[249],vertices[258],vertices[10]); + cells[1510]->set_neighbors(cells[44],cells[1277],cells[1422],cells[1562]); + set_offsets(cells[1510],0,0,0,4); + cells[1511]->set_vertices(vertices[2],vertices[241],vertices[242],vertices[250]); + cells[1511]->set_neighbors(cells[1403],cells[1009],cells[1387],cells[1540]); + set_offsets(cells[1511],4,0,0,0); + cells[1512]->set_vertices(vertices[202],vertices[193],vertices[250],vertices[242]); + cells[1512]->set_neighbors(cells[1403],cells[1513],cells[1454],cells[1501]); + set_offsets(cells[1512],0,0,0,0); + cells[1513]->set_vertices(vertices[195],vertices[202],vertices[250],vertices[242]); + cells[1513]->set_neighbors(cells[1512],cells[280],cells[1132],cells[665]); + set_offsets(cells[1513],0,0,0,0); + cells[1514]->set_vertices(vertices[217],vertices[209],vertices[257],vertices[266]); + cells[1514]->set_neighbors(cells[1559],cells[1059],cells[1369],cells[1600]); + set_offsets(cells[1514],0,0,0,0); + cells[1515]->set_vertices(vertices[26],vertices[267],vertices[19],vertices[27]); + cells[1515]->set_neighbors(cells[1195],cells[285],cells[1565],cells[1370]); + set_offsets(cells[1515],4,0,4,4); + cells[1516]->set_vertices(vertices[218],vertices[258],vertices[211],vertices[210]); + cells[1516]->set_neighbors(cells[1048],cells[1282],cells[1517],cells[1335]); + set_offsets(cells[1516],0,0,0,0); + cells[1517]->set_vertices(vertices[218],vertices[209],vertices[258],vertices[210]); + cells[1517]->set_neighbors(cells[1288],cells[1516],cells[979],cells[1110]); + set_offsets(cells[1517],0,0,0,0); + cells[1518]->set_vertices(vertices[18],vertices[251],vertices[11],vertices[259]); + cells[1518]->set_neighbors(cells[1566],cells[1568],cells[421],cells[912]); + set_offsets(cells[1518],4,0,4,0); + cells[1519]->set_vertices(vertices[243],vertices[250],vertices[203],vertices[251]); + cells[1519]->set_neighbors(cells[1549],cells[1257],cells[1007],cells[1242]); + set_offsets(cells[1519],0,0,0,0); + cells[1520]->set_vertices(vertices[211],vertices[258],vertices[259],vertices[251]); + cells[1520]->set_neighbors(cells[421],cells[784],cells[391],cells[1564]); + set_offsets(cells[1520],0,0,0,0); + cells[1521]->set_vertices(vertices[244],vertices[204],vertices[197],vertices[252]); + cells[1521]->set_neighbors(cells[1470],cells[1522],cells[1377],cells[1244]); + set_offsets(cells[1521],0,0,0,0); + cells[1522]->set_vertices(vertices[245],vertices[244],vertices[197],vertices[252]); + cells[1522]->set_neighbors(cells[1521],cells[1469],cells[1523],cells[343]); + set_offsets(cells[1522],0,0,0,0); + cells[1523]->set_vertices(vertices[4],vertices[244],vertices[245],vertices[252]); + cells[1523]->set_neighbors(cells[1522],cells[1175],cells[929],cells[1630]); + set_offsets(cells[1523],4,0,0,0); + cells[1524]->set_vertices(vertices[275],vertices[274],vertices[34],vertices[267]); + cells[1524]->set_neighbors(cells[1621],cells[874],cells[1578],cells[1680]); + set_offsets(cells[1524],0,0,4,0); + cells[1525]->set_vertices(vertices[23],vertices[22],vertices[15],vertices[263]); + cells[1525]->set_neighbors(cells[1537],cells[1235],cells[974],cells[447]); + set_offsets(cells[1525],4,4,4,0); + cells[1526]->set_vertices(vertices[267],vertices[259],vertices[28],vertices[268]); + cells[1526]->set_neighbors(cells[1298],cells[664],cells[1262],cells[1058]); + set_offsets(cells[1526],0,0,4,0); + cells[1527]->set_vertices(vertices[36],vertices[269],vertices[28],vertices[29]); + cells[1527]->set_neighbors(cells[1464],cells[107],cells[1230],cells[1632]); + set_offsets(cells[1527],4,0,4,4); + cells[1528]->set_vertices(vertices[13],vertices[14],vertices[22],vertices[253]); + cells[1528]->set_neighbors(cells[222],cells[1579],cells[1529],cells[79]); + set_offsets(cells[1528],4,4,4,0); + cells[1529]->set_vertices(vertices[13],vertices[253],vertices[5],vertices[14]); + cells[1529]->set_neighbors(cells[1530],cells[278],cells[1528],cells[1532]); + set_offsets(cells[1529],4,0,4,4); + cells[1530]->set_vertices(vertices[253],vertices[245],vertices[5],vertices[14]); + cells[1530]->set_neighbors(cells[1417],cells[1529],cells[1177],cells[1531]); + set_offsets(cells[1530],0,0,4,4); + cells[1531]->set_vertices(vertices[253],vertices[12],vertices[5],vertices[245]); + cells[1531]->set_neighbors(cells[966],cells[1530],cells[1484],cells[1532]); + set_offsets(cells[1531],0,4,4,0); + cells[1532]->set_vertices(vertices[13],vertices[12],vertices[5],vertices[253]); + cells[1532]->set_neighbors(cells[1531],cells[1529],cells[1279],cells[206]); + set_offsets(cells[1532],4,4,4,0); + cells[1533]->set_vertices(vertices[270],vertices[261],vertices[22],vertices[262]); + cells[1533]->set_neighbors(cells[1411],cells[264],cells[1585],cells[1144]); + set_offsets(cells[1533],0,0,4,0); + cells[1534]->set_vertices(vertices[247],vertices[248],vertices[8],vertices[255]); + cells[1534]->set_neighbors(cells[1548],cells[1263],cells[1108],cells[1442]); + set_offsets(cells[1534],0,1,5,0); + cells[1535]->set_vertices(vertices[21],vertices[22],vertices[30],vertices[261]); + cells[1535]->set_neighbors(cells[1144],cells[1209],cells[1580],cells[406]); + set_offsets(cells[1535],4,4,4,0); + cells[1536]->set_vertices(vertices[221],vertices[261],vertices[269],vertices[270]); + cells[1536]->set_neighbors(cells[1390],cells[1479],cells[127],cells[1633]); + set_offsets(cells[1536],0,0,0,0); + cells[1537]->set_vertices(vertices[263],vertices[22],vertices[15],vertices[255]); + cells[1537]->set_neighbors(cells[1494],cells[1491],cells[1025],cells[1525]); + set_offsets(cells[1537],0,4,4,0); + cells[1538]->set_vertices(vertices[262],vertices[254],vertices[255],vertices[207]); + cells[1538]->set_neighbors(cells[1291],cells[1490],cells[468],cells[1234]); + set_offsets(cells[1538],0,0,0,0); + cells[1539]->set_vertices(vertices[215],vertices[256],vertices[207],vertices[255]); + cells[1539]->set_neighbors(cells[1504],cells[1490],cells[1582],cells[1546]); + set_offsets(cells[1539],0,1,0,0); + cells[1540]->set_vertices(vertices[242],vertices[281],vertices[241],vertices[2]); + cells[1540]->set_neighbors(cells[1231],cells[1511],cells[1232],cells[1404]); + set_offsets(cells[1540],2,0,2,6); + cells[1541]->set_vertices(vertices[40],vertices[280],vertices[279],vertices[32]); + cells[1541]->set_neighbors(cells[1607],cells[1220],cells[1645],cells[1180]); + set_offsets(cells[1541],5,1,0,5); + cells[1542]->set_vertices(vertices[209],vertices[201],vertices[256],vertices[249]); + cells[1542]->set_neighbors(cells[1543],cells[1551],cells[1561],cells[176]); + set_offsets(cells[1542],0,0,0,0); + cells[1543]->set_vertices(vertices[256],vertices[201],vertices[248],vertices[249]); + cells[1543]->set_neighbors(cells[1509],cells[1544],cells[1542],cells[940]); + set_offsets(cells[1543],0,0,0,0); + cells[1544]->set_vertices(vertices[248],vertices[249],vertices[8],vertices[256]); + cells[1544]->set_neighbors(cells[1278],cells[1548],cells[1543],cells[1503]); + set_offsets(cells[1544],0,0,4,0); + cells[1545]->set_vertices(vertices[216],vertices[208],vertices[215],vertices[256]); + cells[1545]->set_neighbors(cells[1546],cells[1601],cells[1226],cells[919]); + set_offsets(cells[1545],1,1,0,1); + cells[1546]->set_vertices(vertices[215],vertices[208],vertices[207],vertices[256]); + cells[1546]->set_neighbors(cells[1508],cells[1539],cells[1545],cells[1204]); + set_offsets(cells[1546],0,1,0,1); + cells[1547]->set_vertices(vertices[272],vertices[264],vertices[271],vertices[24]); + cells[1547]->set_neighbors(cells[1248],cells[1492],cells[1318],cells[1348]); + set_offsets(cells[1547],1,1,0,5); + cells[1548]->set_vertices(vertices[255],vertices[248],vertices[8],vertices[256]); + cells[1548]->set_neighbors(cells[1544],cells[1266],cells[1504],cells[1534]); + set_offsets(cells[1548],0,1,5,1); + cells[1549]->set_vertices(vertices[258],vertices[250],vertices[251],vertices[203]); + cells[1549]->set_neighbors(cells[1519],cells[391],cells[1285],cells[1277]); + set_offsets(cells[1549],0,0,0,0); + cells[1550]->set_vertices(vertices[265],vertices[26],vertices[25],vertices[34]); + cells[1550]->set_neighbors(cells[30],cells[1659],cells[1563],cells[1612]); + set_offsets(cells[1550],0,4,4,4); + cells[1551]->set_vertices(vertices[209],vertices[249],vertices[256],vertices[257]); + cells[1551]->set_neighbors(cells[1552],cells[1599],cells[1378],cells[1542]); + set_offsets(cells[1551],0,0,0,0); + cells[1552]->set_vertices(vertices[257],vertices[249],vertices[256],vertices[16]); + cells[1552]->set_neighbors(cells[1278],cells[1271],cells[1557],cells[1551]); + set_offsets(cells[1552],0,0,0,4); + cells[1553]->set_vertices(vertices[24],vertices[16],vertices[17],vertices[257]); + cells[1553]->set_neighbors(cells[1554],cells[1614],cells[1324],cells[87]); + set_offsets(cells[1553],4,4,4,0); + cells[1554]->set_vertices(vertices[16],vertices[257],vertices[9],vertices[17]); + cells[1554]->set_neighbors(cells[1555],cells[170],cells[1553],cells[1557]); + set_offsets(cells[1554],4,0,4,4); + cells[1555]->set_vertices(vertices[257],vertices[18],vertices[9],vertices[17]); + cells[1555]->set_neighbors(cells[232],cells[1554],cells[559],cells[1556]); + set_offsets(cells[1555],0,4,4,4); + cells[1556]->set_vertices(vertices[249],vertices[18],vertices[9],vertices[257]); + cells[1556]->set_neighbors(cells[1555],cells[1557],cells[145],cells[1006]); + set_offsets(cells[1556],0,4,4,0); + cells[1557]->set_vertices(vertices[16],vertices[249],vertices[9],vertices[257]); + cells[1557]->set_neighbors(cells[1556],cells[1554],cells[1552],cells[1505]); + set_offsets(cells[1557],4,0,4,0); + cells[1558]->set_vertices(vertices[266],vertices[257],vertices[18],vertices[258]); + cells[1558]->set_neighbors(cells[145],cells[214],cells[1559],cells[1560]); + set_offsets(cells[1558],0,0,4,0); + cells[1559]->set_vertices(vertices[266],vertices[209],vertices[257],vertices[258]); + cells[1559]->set_neighbors(cells[1378],cells[1558],cells[1110],cells[1514]); + set_offsets(cells[1559],0,0,0,0); + cells[1560]->set_vertices(vertices[26],vertices[257],vertices[18],vertices[266]); + cells[1560]->set_neighbors(cells[1558],cells[1121],cells[570],cells[559]); + set_offsets(cells[1560],4,0,4,0); + cells[1561]->set_vertices(vertices[209],vertices[201],vertices[249],vertices[258]); + cells[1561]->set_neighbors(cells[1562],cells[1378],cells[1288],cells[1542]); + set_offsets(cells[1561],0,0,0,0); + cells[1562]->set_vertices(vertices[258],vertices[201],vertices[249],vertices[250]); + cells[1562]->set_neighbors(cells[342],cells[1510],cells[876],cells[1561]); + set_offsets(cells[1562],0,0,0,0); + cells[1563]->set_vertices(vertices[34],vertices[265],vertices[26],vertices[274]); + cells[1563]->set_neighbors(cells[1385],cells[1621],cells[83],cells[1550]); + set_offsets(cells[1563],4,0,4,0); + cells[1564]->set_vertices(vertices[266],vertices[258],vertices[259],vertices[211]); + cells[1564]->set_neighbors(cells[1520],cells[958],cells[1335],cells[214]); + set_offsets(cells[1564],0,0,0,0); + cells[1565]->set_vertices(vertices[34],vertices[267],vertices[26],vertices[27]); + cells[1565]->set_neighbors(cells[1515],cells[186],cells[874],cells[1621]); + set_offsets(cells[1565],4,0,4,4); + cells[1566]->set_vertices(vertices[251],vertices[20],vertices[11],vertices[259]); + cells[1566]->set_neighbors(cells[1567],cells[1518],cells[1280],cells[183]); + set_offsets(cells[1566],0,4,4,0); + cells[1567]->set_vertices(vertices[259],vertices[20],vertices[11],vertices[19]); + cells[1567]->set_neighbors(cells[144],cells[1568],cells[1467],cells[1566]); + set_offsets(cells[1567],0,4,4,4); + cells[1568]->set_vertices(vertices[18],vertices[259],vertices[11],vertices[19]); + cells[1568]->set_neighbors(cells[1567],cells[423],cells[1569],cells[1518]); + set_offsets(cells[1568],4,0,4,4); + cells[1569]->set_vertices(vertices[26],vertices[18],vertices[19],vertices[259]); + cells[1569]->set_neighbors(cells[1568],cells[1370],cells[1121],cells[370]); + set_offsets(cells[1569],4,4,4,0); + cells[1570]->set_vertices(vertices[244],vertices[196],vertices[235],vertices[284]); + cells[1570]->set_neighbors(cells[1462],cells[1701],cells[1475],cells[1458]); + set_offsets(cells[1570],2,2,0,0); + cells[1571]->set_vertices(vertices[269],vertices[268],vertices[28],vertices[261]); + cells[1571]->set_neighbors(cells[128],cells[136],cells[1633],cells[1631]); + set_offsets(cells[1571],0,0,4,0); + cells[1572]->set_vertices(vertices[13],vertices[253],vertices[261],vertices[20]); + cells[1572]->set_neighbors(cells[1188],cells[1573],cells[1279],cells[1579]); + set_offsets(cells[1572],4,0,0,4); + cells[1573]->set_vertices(vertices[13],vertices[261],vertices[21],vertices[20]); + cells[1573]->set_neighbors(cells[1251],cells[434],cells[1572],cells[1580]); + set_offsets(cells[1573],4,0,4,4); + cells[1574]->set_vertices(vertices[267],vertices[36],vertices[28],vertices[27]); + cells[1574]->set_neighbors(cells[99],cells[1195],cells[1389],cells[1045]); + set_offsets(cells[1574],0,4,4,4); + cells[1575]->set_vertices(vertices[219],vertices[211],vertices[259],vertices[268]); + cells[1575]->set_neighbors(cells[1331],cells[1262],cells[1386],cells[958]); + set_offsets(cells[1575],0,0,0,0); + cells[1576]->set_vertices(vertices[12],vertices[251],vertices[252],vertices[260]); + cells[1576]->set_neighbors(cells[1020],cells[1577],cells[1253],cells[124]); + set_offsets(cells[1576],4,0,0,0); + cells[1577]->set_vertices(vertices[12],vertices[252],vertices[253],vertices[260]); + cells[1577]->set_neighbors(cells[1465],cells[1293],cells[1576],cells[1484]); + set_offsets(cells[1577],4,0,0,0); + cells[1578]->set_vertices(vertices[227],vertices[274],vertices[275],vertices[267]); + cells[1578]->set_neighbors(cells[1524],cells[1626],cells[1440],cells[1649]); + set_offsets(cells[1578],0,0,0,0); + cells[1579]->set_vertices(vertices[13],vertices[22],vertices[261],vertices[253]); + cells[1579]->set_neighbors(cells[1411],cells[1572],cells[1528],cells[1580]); + set_offsets(cells[1579],4,4,0,0); + cells[1580]->set_vertices(vertices[13],vertices[22],vertices[21],vertices[261]); + cells[1580]->set_neighbors(cells[1535],cells[1573],cells[1579],cells[178]); + set_offsets(cells[1580],4,4,4,0); + cells[1581]->set_vertices(vertices[38],vertices[278],vertices[30],vertices[271]); + cells[1581]->set_neighbors(cells[1589],cells[1395],cells[1245],cells[346]); + set_offsets(cells[1581],4,0,4,0); + cells[1582]->set_vertices(vertices[215],vertices[256],vertices[255],vertices[263]); + cells[1582]->set_neighbors(cells[1169],cells[1308],cells[1602],cells[1539]); + set_offsets(cells[1582],0,1,0,0); + cells[1583]->set_vertices(vertices[269],vertices[38],vertices[30],vertices[29]); + cells[1583]->set_neighbors(cells[26],cells[1584],cells[1181],cells[346]); + set_offsets(cells[1583],0,4,4,4); + cells[1584]->set_vertices(vertices[21],vertices[30],vertices[29],vertices[269]); + cells[1584]->set_neighbors(cells[1583],cells[1464],cells[1209],cells[404]); + set_offsets(cells[1584],4,4,4,0); + cells[1585]->set_vertices(vertices[270],vertices[213],vertices[261],vertices[262]); + cells[1585]->set_neighbors(cells[1587],cells[1533],cells[1057],cells[127]); + set_offsets(cells[1585],0,0,0,0); + cells[1586]->set_vertices(vertices[221],vertices[213],vertices[270],vertices[222]); + cells[1586]->set_neighbors(cells[1057],cells[673],cells[1103],cells[127]); + set_offsets(cells[1586],0,0,0,0); + cells[1587]->set_vertices(vertices[213],vertices[253],vertices[261],vertices[262]); + cells[1587]->set_neighbors(cells[1411],cells[1585],cells[1588],cells[1344]); + set_offsets(cells[1587],0,0,0,0); + cells[1588]->set_vertices(vertices[213],vertices[205],vertices[253],vertices[262]); + cells[1588]->set_neighbors(cells[1482],cells[1587],cells[1290],cells[1319]); + set_offsets(cells[1588],0,0,0,0); + cells[1589]->set_vertices(vertices[278],vertices[270],vertices[30],vertices[271]); + cells[1589]->set_neighbors(cells[1388],cells[1581],cells[1644],cells[911]); + set_offsets(cells[1589],0,0,4,0); + cells[1590]->set_vertices(vertices[271],vertices[263],vertices[23],vertices[24]); + cells[1590]->set_neighbors(cells[939],cells[1261],cells[1248],cells[1593]); + set_offsets(cells[1590],0,0,4,5); + cells[1591]->set_vertices(vertices[270],vertices[222],vertices[262],vertices[215]); + cells[1591]->set_neighbors(cells[1349],cells[779],cells[1592],cells[1057]); + set_offsets(cells[1591],0,0,0,0); + cells[1592]->set_vertices(vertices[223],vertices[222],vertices[270],vertices[215]); + cells[1592]->set_neighbors(cells[1591],cells[1296],cells[989],cells[1276]); + set_offsets(cells[1592],0,0,0,0); + cells[1593]->set_vertices(vertices[271],vertices[30],vertices[23],vertices[263]); + cells[1593]->set_neighbors(cells[974],cells[1590],cells[1388],cells[392]); + set_offsets(cells[1593],0,4,4,0); + cells[1594]->set_vertices(vertices[39],vertices[279],vertices[40],vertices[287]); + cells[1594]->set_neighbors(cells[1180],cells[1595],cells[1727],cells[1220]); + set_offsets(cells[1594],4,0,5,0); + cells[1595]->set_vertices(vertices[39],vertices[287],vertices[40],vertices[47]); + cells[1595]->set_neighbors(cells[1615],cells[550],cells[1021],cells[1594]); + set_offsets(cells[1595],4,0,5,4); + cells[1596]->set_vertices(vertices[272],vertices[232],vertices[280],vertices[231]); + cells[1596]->set_neighbors(cells[1597],cells[1292],cells[1410],cells[1487]); + set_offsets(cells[1596],1,1,1,0); + cells[1597]->set_vertices(vertices[280],vertices[232],vertices[239],vertices[231]); + cells[1597]->set_neighbors(cells[1437],cells[1247],cells[1596],cells[1394]); + set_offsets(cells[1597],1,1,0,0); + cells[1598]->set_vertices(vertices[272],vertices[225],vertices[232],vertices[224]); + cells[1598]->set_neighbors(cells[1396],cells[1410],cells[277],cells[1487]); + set_offsets(cells[1598],0,0,0,0); + cells[1599]->set_vertices(vertices[264],vertices[209],vertices[256],vertices[257]); + cells[1599]->set_neighbors(cells[1551],cells[1271],cells[1600],cells[1218]); + set_offsets(cells[1599],0,0,0,0); + cells[1600]->set_vertices(vertices[217],vertices[209],vertices[264],vertices[257]); + cells[1600]->set_neighbors(cells[1599],cells[1608],cells[1514],cells[1446]); + set_offsets(cells[1600],0,0,0,0); + cells[1601]->set_vertices(vertices[264],vertices[216],vertices[215],vertices[256]); + cells[1601]->set_neighbors(cells[1545],cells[1602],cells[1218],cells[1604]); + set_offsets(cells[1601],1,1,0,1); + cells[1602]->set_vertices(vertices[264],vertices[256],vertices[215],vertices[263]); + cells[1602]->set_neighbors(cells[1582],cells[1603],cells[1316],cells[1601]); + set_offsets(cells[1602],1,1,0,0); + cells[1603]->set_vertices(vertices[223],vertices[264],vertices[215],vertices[263]); + cells[1603]->set_neighbors(cells[1602],cells[1296],cells[1637],cells[1604]); + set_offsets(cells[1603],0,1,0,0); + cells[1604]->set_vertices(vertices[223],vertices[216],vertices[215],vertices[264]); + cells[1604]->set_neighbors(cells[1601],cells[1603],cells[1605],cells[837]); + set_offsets(cells[1604],0,1,0,1); + cells[1605]->set_vertices(vertices[224],vertices[216],vertices[223],vertices[264]); + cells[1605]->set_neighbors(cells[1604],cells[1170],cells[157],cells[1085]); + set_offsets(cells[1605],1,1,0,1); + cells[1606]->set_vertices(vertices[281],vertices[42],vertices[41],vertices[2]); + cells[1606]->set_neighbors(cells[52],cells[1231],cells[1232],cells[1183]); + set_offsets(cells[1606],0,4,4,6); + cells[1607]->set_vertices(vertices[280],vertices[272],vertices[279],vertices[32]); + cells[1607]->set_neighbors(cells[1477],cells[1541],cells[1346],cells[1292]); + set_offsets(cells[1607],1,1,0,5); + cells[1608]->set_vertices(vertices[217],vertices[257],vertices[264],vertices[265]); + cells[1608]->set_neighbors(cells[1609],cells[1647],cells[1059],cells[1600]); + set_offsets(cells[1608],0,0,0,0); + cells[1609]->set_vertices(vertices[265],vertices[257],vertices[264],vertices[24]); + cells[1609]->set_neighbors(cells[1324],cells[1318],cells[1614],cells[1608]); + set_offsets(cells[1609],0,0,0,4); + cells[1610]->set_vertices(vertices[32],vertices[24],vertices[25],vertices[265]); + cells[1610]->set_neighbors(cells[1611],cells[1658],cells[910],cells[92]); + set_offsets(cells[1610],4,4,4,0); + cells[1611]->set_vertices(vertices[24],vertices[265],vertices[17],vertices[25]); + cells[1611]->set_neighbors(cells[1612],cells[287],cells[1610],cells[1614]); + set_offsets(cells[1611],4,0,4,4); + cells[1612]->set_vertices(vertices[265],vertices[26],vertices[17],vertices[25]); + cells[1612]->set_neighbors(cells[242],cells[1611],cells[1550],cells[1613]); + set_offsets(cells[1612],0,4,4,4); + cells[1613]->set_vertices(vertices[257],vertices[26],vertices[17],vertices[265]); + cells[1613]->set_neighbors(cells[1612],cells[1614],cells[570],cells[559]); + set_offsets(cells[1613],0,4,4,0); + cells[1614]->set_vertices(vertices[24],vertices[257],vertices[17],vertices[265]); + cells[1614]->set_neighbors(cells[1613],cells[1611],cells[1609],cells[1553]); + set_offsets(cells[1614],4,0,4,0); + cells[1615]->set_vertices(vertices[287],vertices[40],vertices[47],vertices[0]); + cells[1615]->set_neighbors(cells[93],cells[1713],cells[1677],cells[1595]); + set_offsets(cells[1615],0,5,4,7); + cells[1616]->set_vertices(vertices[284],vertices[276],vertices[36],vertices[277]); + cells[1616]->set_neighbors(cells[1639],cells[1198],cells[1661],cells[1704]); + set_offsets(cells[1616],0,0,4,0); + cells[1617]->set_vertices(vertices[282],vertices[194],vertices[233],vertices[234]); + cells[1617]->set_neighbors(cells[1323],cells[344],cells[1694],cells[226]); + set_offsets(cells[1617],0,2,0,0); + cells[1618]->set_vertices(vertices[42],vertices[275],vertices[34],vertices[35]); + cells[1618]->set_neighbors(cells[1660],cells[497],cells[1341],cells[1328]); + set_offsets(cells[1618],4,0,4,4); + cells[1619]->set_vertices(vertices[2],vertices[242],vertices[283],vertices[243]); + cells[1619]->set_neighbors(cells[1380],cells[1445],cells[1009],cells[1699]); + set_offsets(cells[1619],6,2,0,2); + cells[1620]->set_vertices(vertices[274],vertices[266],vertices[26],vertices[267]); + cells[1620]->set_neighbors(cells[1176],cells[1621],cells[1152],cells[1385]); + set_offsets(cells[1620],0,0,4,0); + cells[1621]->set_vertices(vertices[34],vertices[274],vertices[26],vertices[267]); + cells[1621]->set_neighbors(cells[1620],cells[1565],cells[1524],cells[1563]); + set_offsets(cells[1621],4,0,4,0); + cells[1622]->set_vertices(vertices[219],vertices[266],vertices[267],vertices[259]); + cells[1622]->set_neighbors(cells[1176],cells[1262],cells[958],cells[1152]); + set_offsets(cells[1622],0,0,0,0); + cells[1623]->set_vertices(vertices[275],vertices[284],vertices[44],vertices[283]); + cells[1623]->set_neighbors(cells[324],cells[1666],cells[1667],cells[1705]); + set_offsets(cells[1623],0,0,4,0); + cells[1624]->set_vertices(vertices[276],vertices[219],vertices[267],vertices[268]); + cells[1624]->set_neighbors(cells[1262],cells[664],cells[1374],cells[1625]); + set_offsets(cells[1624],0,0,0,0); + cells[1625]->set_vertices(vertices[227],vertices[219],vertices[267],vertices[276]); + cells[1625]->set_neighbors(cells[1624],cells[1626],cells[326],cells[1440]); + set_offsets(cells[1625],0,0,0,0); + cells[1626]->set_vertices(vertices[227],vertices[267],vertices[275],vertices[276]); + cells[1626]->set_neighbors(cells[1382],cells[1703],cells[1625],cells[1578]); + set_offsets(cells[1626],0,0,0,0); + cells[1627]->set_vertices(vertices[238],vertices[237],vertices[286],vertices[229]); + cells[1627]->set_neighbors(cells[623],cells[1673],cells[347],cells[1641]); + set_offsets(cells[1627],0,0,0,0); + cells[1628]->set_vertices(vertices[285],vertices[6],vertices[46],vertices[45]); + cells[1628]->set_neighbors(cells[581],cells[1219],cells[1197],cells[1340]); + set_offsets(cells[1628],0,6,4,4); + cells[1629]->set_vertices(vertices[36],vertices[37],vertices[277],vertices[29]); + cells[1629]->set_neighbors(cells[1246],cells[1230],cells[119],cells[1193]); + set_offsets(cells[1629],4,4,0,4); + cells[1630]->set_vertices(vertices[4],vertices[244],vertices[285],vertices[245]); + cells[1630]->set_neighbors(cells[343],cells[1207],cells[1523],cells[1711]); + set_offsets(cells[1630],6,2,0,2); + cells[1631]->set_vertices(vertices[276],vertices[268],vertices[28],vertices[269]); + cells[1631]->set_neighbors(cells[1571],cells[1632],cells[1460],cells[664]); + set_offsets(cells[1631],0,0,4,0); + cells[1632]->set_vertices(vertices[36],vertices[276],vertices[28],vertices[269]); + cells[1632]->set_neighbors(cells[1631],cells[1527],cells[1639],cells[1045]); + set_offsets(cells[1632],4,0,4,0); + cells[1633]->set_vertices(vertices[221],vertices[268],vertices[269],vertices[261]); + cells[1633]->set_neighbors(cells[1571],cells[1536],cells[891],cells[1460]); + set_offsets(cells[1633],0,0,0,0); + cells[1634]->set_vertices(vertices[286],vertices[239],vertices[287],vertices[246]); + cells[1634]->set_neighbors(cells[1399],cells[1162],cells[1022],cells[1725]); + set_offsets(cells[1634],0,0,0,2); + cells[1635]->set_vertices(vertices[237],vertices[286],vertices[277],vertices[285]); + cells[1635]->set_neighbors(cells[1672],cells[1707],cells[1148],cells[623]); + set_offsets(cells[1635],0,0,0,0); + cells[1636]->set_vertices(vertices[278],vertices[230],vertices[270],vertices[223]); + cells[1636]->set_neighbors(cells[1276],cells[1644],cells[709],cells[1303]); + set_offsets(cells[1636],0,0,0,0); + cells[1637]->set_vertices(vertices[223],vertices[264],vertices[263],vertices[271]); + cells[1637]->set_neighbors(cells[1248],cells[1391],cells[1348],cells[1603]); + set_offsets(cells[1637],0,1,0,0); + cells[1638]->set_vertices(vertices[229],vertices[276],vertices[277],vertices[269]); + cells[1638]->set_neighbors(cells[1639],cells[1472],cells[1140],cells[1661]); + set_offsets(cells[1638],0,0,0,0); + cells[1639]->set_vertices(vertices[277],vertices[276],vertices[36],vertices[269]); + cells[1639]->set_neighbors(cells[1632],cells[1230],cells[1638],cells[1616]); + set_offsets(cells[1639],0,0,4,0); + cells[1640]->set_vertices(vertices[287],vertices[199],vertices[239],vertices[240]); + cells[1640]->set_neighbors(cells[1444],cells[1676],cells[1720],cells[1399]); + set_offsets(cells[1640],0,2,0,3); + cells[1641]->set_vertices(vertices[238],vertices[198],vertices[286],vertices[237]); + cells[1641]->set_neighbors(cells[1478],cells[1627],cells[1363],cells[1473]); + set_offsets(cells[1641],0,2,0,0); + cells[1642]->set_vertices(vertices[280],vertices[233],vertices[192],vertices[232]); + cells[1642]->set_neighbors(cells[1406],cells[1394],cells[125],cells[1052]); + set_offsets(cells[1642],0,0,2,0); + cells[1643]->set_vertices(vertices[231],vertices[278],vertices[271],vertices[223]); + cells[1643]->set_neighbors(cells[1644],cells[1299],cells[709],cells[936]); + set_offsets(cells[1643],0,0,0,0); + cells[1644]->set_vertices(vertices[278],vertices[270],vertices[271],vertices[223]); + cells[1644]->set_neighbors(cells[1391],cells[1643],cells[1636],cells[1589]); + set_offsets(cells[1644],0,0,0,0); + cells[1645]->set_vertices(vertices[40],vertices[273],vertices[280],vertices[32]); + cells[1645]->set_neighbors(cells[1346],cells[1541],cells[1439],cells[1651]); + set_offsets(cells[1645],4,0,0,4); + cells[1646]->set_vertices(vertices[225],vertices[217],vertices[272],vertices[265]); + cells[1646]->set_neighbors(cells[1647],cells[1656],cells[1330],cells[277]); + set_offsets(cells[1646],0,0,0,0); + cells[1647]->set_vertices(vertices[272],vertices[217],vertices[264],vertices[265]); + cells[1647]->set_neighbors(cells[1608],cells[1318],cells[1646],cells[1315]); + set_offsets(cells[1647],0,0,0,0); + cells[1648]->set_vertices(vertices[273],vertices[225],vertices[233],vertices[280]); + cells[1648]->set_neighbors(cells[125],cells[1652],cells[1433],cells[1693]); + set_offsets(cells[1648],0,0,0,0); + cells[1649]->set_vertices(vertices[275],vertices[282],vertices[274],vertices[227]); + cells[1649]->set_neighbors(cells[1650],cells[1578],cells[1452],cells[1680]); + set_offsets(cells[1649],0,0,0,0); + cells[1650]->set_vertices(vertices[274],vertices[282],vertices[234],vertices[227]); + cells[1650]->set_neighbors(cells[252],cells[1654],cells[1649],cells[1100]); + set_offsets(cells[1650],0,0,0,0); + cells[1651]->set_vertices(vertices[40],vertices[280],vertices[273],vertices[281]); + cells[1651]->set_neighbors(cells[1652],cells[586],cells[1688],cells[1645]); + set_offsets(cells[1651],4,0,0,0); + cells[1652]->set_vertices(vertices[273],vertices[280],vertices[233],vertices[281]); + cells[1652]->set_neighbors(cells[1681],cells[1329],cells[1651],cells[1648]); + set_offsets(cells[1652],0,0,0,0); + cells[1653]->set_vertices(vertices[41],vertices[40],vertices[33],vertices[281]); + cells[1653]->set_neighbors(cells[586],cells[1183],cells[1686],cells[507]); + set_offsets(cells[1653],4,4,4,0); + cells[1654]->set_vertices(vertices[227],vertices[234],vertices[274],vertices[226]); + cells[1654]->set_neighbors(cells[1655],cells[916],cells[1368],cells[1650]); + set_offsets(cells[1654],0,0,0,0); + cells[1655]->set_vertices(vertices[274],vertices[234],vertices[225],vertices[226]); + cells[1655]->set_neighbors(cells[889],cells[85],cells[1654],cells[1100]); + set_offsets(cells[1655],0,0,0,0); + cells[1656]->set_vertices(vertices[225],vertices[265],vertices[272],vertices[273]); + cells[1656]->set_neighbors(cells[1657],cells[1433],cells[930],cells[1646]); + set_offsets(cells[1656],0,0,0,0); + cells[1657]->set_vertices(vertices[273],vertices[265],vertices[272],vertices[32]); + cells[1657]->set_neighbors(cells[910],cells[1346],cells[1658],cells[1656]); + set_offsets(cells[1657],0,0,0,4); + cells[1658]->set_vertices(vertices[32],vertices[265],vertices[25],vertices[273]); + cells[1658]->set_neighbors(cells[1659],cells[1412],cells[1657],cells[1610]); + set_offsets(cells[1658],4,0,4,0); + cells[1659]->set_vertices(vertices[265],vertices[34],vertices[25],vertices[273]); + cells[1659]->set_neighbors(cells[948],cells[1658],cells[83],cells[1550]); + set_offsets(cells[1659],0,4,4,0); + cells[1660]->set_vertices(vertices[34],vertices[35],vertices[275],vertices[27]); + cells[1660]->set_neighbors(cells[1424],cells[874],cells[310],cells[1618]); + set_offsets(cells[1660],4,4,0,4); + cells[1661]->set_vertices(vertices[277],vertices[284],vertices[276],vertices[229]); + cells[1661]->set_neighbors(cells[1665],cells[1638],cells[1003],cells[1616]); + set_offsets(cells[1661],0,0,0,0); + cells[1662]->set_vertices(vertices[283],vertices[195],vertices[235],vertices[244]); + cells[1662]->set_neighbors(cells[1458],cells[1701],cells[1663],cells[1700]); + set_offsets(cells[1662],0,2,0,2); + cells[1663]->set_vertices(vertices[243],vertices[195],vertices[283],vertices[244]); + cells[1663]->set_neighbors(cells[1662],cells[1283],cells[1453],cells[1380]); + set_offsets(cells[1663],2,2,0,2); + cells[1664]->set_vertices(vertices[229],vertices[228],vertices[276],vertices[221]); + cells[1664]->set_neighbors(cells[1461],cells[1140],cells[1375],cells[714]); + set_offsets(cells[1664],0,0,0,0); + cells[1665]->set_vertices(vertices[276],vertices[284],vertices[236],vertices[229]); + cells[1665]->set_neighbors(cells[1463],cells[714],cells[1661],cells[1194]); + set_offsets(cells[1665],0,0,0,0); + cells[1666]->set_vertices(vertices[283],vertices[44],vertices[275],vertices[35]); + cells[1666]->set_neighbors(cells[267],cells[1341],cells[1004],cells[1623]); + set_offsets(cells[1666],0,4,0,4); + cells[1667]->set_vertices(vertices[235],vertices[284],vertices[275],vertices[283]); + cells[1667]->set_neighbors(cells[1623],cells[1695],cells[1701],cells[1702]); + set_offsets(cells[1667],0,0,0,0); + cells[1668]->set_vertices(vertices[285],vertices[197],vertices[237],vertices[246]); + cells[1668]->set_neighbors(cells[1206],cells[1148],cells[1669],cells[1712]); + set_offsets(cells[1668],0,2,0,2); + cells[1669]->set_vertices(vertices[245],vertices[197],vertices[285],vertices[246]); + cells[1669]->set_neighbors(cells[1668],cells[1056],cells[1026],cells[343]); + set_offsets(cells[1669],2,2,0,2); + cells[1670]->set_vertices(vertices[229],vertices[221],vertices[269],vertices[278]); + cells[1670]->set_neighbors(cells[1479],cells[1472],cells[1166],cells[1140]); + set_offsets(cells[1670],0,0,0,0); + cells[1671]->set_vertices(vertices[39],vertices[38],vertices[279],vertices[46]); + cells[1671]->set_neighbors(cells[1717],cells[1727],cells[315],cells[1015]); + set_offsets(cells[1671],4,4,0,4); + cells[1672]->set_vertices(vertices[277],vertices[286],vertices[46],vertices[285]); + cells[1672]->set_neighbors(cells[1208],cells[1172],cells[1635],cells[1718]); + set_offsets(cells[1672],0,0,4,0); + cells[1673]->set_vertices(vertices[238],vertices[286],vertices[278],vertices[229]); + cells[1673]->set_neighbors(cells[1480],cells[1119],cells[1627],cells[1476]); + set_offsets(cells[1673],0,0,0,0); + cells[1674]->set_vertices(vertices[231],vertices[239],vertices[286],vertices[238]); + cells[1674]->set_neighbors(cells[1473],cells[1476],cells[1434],cells[1714]); + set_offsets(cells[1674],0,0,0,0); + cells[1675]->set_vertices(vertices[230],vertices[238],vertices[231],vertices[278]); + cells[1675]->set_neighbors(cells[1476],cells[709],cells[1119],cells[972]); + set_offsets(cells[1675],0,0,0,0); + cells[1676]->set_vertices(vertices[287],vertices[240],vertices[239],vertices[280]); + cells[1676]->set_neighbors(cells[1678],cells[957],cells[1405],cells[1640]); + set_offsets(cells[1676],0,3,0,1); + cells[1677]->set_vertices(vertices[0],vertices[287],vertices[40],vertices[240]); + cells[1677]->set_neighbors(cells[1405],cells[1687],cells[1721],cells[1615]); + set_offsets(cells[1677],7,0,5,3); + cells[1678]->set_vertices(vertices[239],vertices[240],vertices[192],vertices[280]); + cells[1678]->set_neighbors(cells[1052],cells[1394],cells[1676],cells[1444]); + set_offsets(cells[1678],0,3,3,1); + cells[1679]->set_vertices(vertices[233],vertices[282],vertices[281],vertices[242]); + cells[1679]->set_neighbors(cells[291],cells[1499],cells[226],cells[1329]); + set_offsets(cells[1679],0,0,0,2); + cells[1680]->set_vertices(vertices[282],vertices[274],vertices[34],vertices[275]); + cells[1680]->set_neighbors(cells[1524],cells[1328],cells[1649],cells[1691]); + set_offsets(cells[1680],0,0,4,0); + cells[1681]->set_vertices(vertices[281],vertices[280],vertices[233],vertices[240]); + cells[1681]->set_neighbors(cells[1052],cells[1682],cells[1688],cells[1652]); + set_offsets(cells[1681],0,0,0,2); + cells[1682]->set_vertices(vertices[240],vertices[193],vertices[233],vertices[281]); + cells[1682]->set_neighbors(cells[1499],cells[1681],cells[1683],cells[1443]); + set_offsets(cells[1682],2,2,0,0); + cells[1683]->set_vertices(vertices[240],vertices[193],vertices[281],vertices[241]); + cells[1683]->set_neighbors(cells[1404],cells[1684],cells[301],cells[1682]); + set_offsets(cells[1683],2,2,0,2); + cells[1684]->set_vertices(vertices[0],vertices[240],vertices[281],vertices[241]); + cells[1684]->set_neighbors(cells[1683],cells[1685],cells[229],cells[1687]); + set_offsets(cells[1684],6,2,0,2); + cells[1685]->set_vertices(vertices[0],vertices[281],vertices[41],vertices[241]); + cells[1685]->set_neighbors(cells[1231],cells[1402],cells[1684],cells[1686]); + set_offsets(cells[1685],6,0,4,2); + cells[1686]->set_vertices(vertices[0],vertices[40],vertices[41],vertices[281]); + cells[1686]->set_neighbors(cells[1653],cells[1685],cells[1687],cells[235]); + set_offsets(cells[1686],6,4,4,0); + cells[1687]->set_vertices(vertices[0],vertices[240],vertices[40],vertices[281]); + cells[1687]->set_neighbors(cells[1688],cells[1686],cells[1684],cells[1677]); + set_offsets(cells[1687],6,2,4,0); + cells[1688]->set_vertices(vertices[40],vertices[280],vertices[281],vertices[240]); + cells[1688]->set_neighbors(cells[1681],cells[1687],cells[1405],cells[1651]); + set_offsets(cells[1688],4,0,0,2); + cells[1689]->set_vertices(vertices[273],vertices[42],vertices[281],vertices[282]); + cells[1689]->set_neighbors(cells[291],cells[1329],cells[1690],cells[628]); + set_offsets(cells[1689],0,4,0,0); + cells[1690]->set_vertices(vertices[42],vertices[273],vertices[34],vertices[282]); + cells[1690]->set_neighbors(cells[1691],cells[1328],cells[1689],cells[1438]); + set_offsets(cells[1690],4,0,4,0); + cells[1691]->set_vertices(vertices[282],vertices[273],vertices[34],vertices[274]); + cells[1691]->set_neighbors(cells[83],cells[1680],cells[1692],cells[1690]); + set_offsets(cells[1691],0,0,4,0); + cells[1692]->set_vertices(vertices[273],vertices[282],vertices[225],vertices[274]); + cells[1692]->set_neighbors(cells[1100],cells[930],cells[1691],cells[1693]); + set_offsets(cells[1692],0,0,0,0); + cells[1693]->set_vertices(vertices[273],vertices[233],vertices[225],vertices[282]); + cells[1693]->set_neighbors(cells[344],cells[1692],cells[1329],cells[1648]); + set_offsets(cells[1693],0,0,0,0); + cells[1694]->set_vertices(vertices[235],vertices[194],vertices[282],vertices[234]); + cells[1694]->set_neighbors(cells[1617],cells[252],cells[1419],cells[84]); + set_offsets(cells[1694],0,2,0,0); + cells[1695]->set_vertices(vertices[275],vertices[235],vertices[283],vertices[282]); + cells[1695]->set_neighbors(cells[1696],cells[1698],cells[1452],cells[1667]); + set_offsets(cells[1695],0,0,0,0); + cells[1696]->set_vertices(vertices[283],vertices[235],vertices[242],vertices[282]); + cells[1696]->set_neighbors(cells[84],cells[1697],cells[1695],cells[1700]); + set_offsets(cells[1696],0,0,2,0); + cells[1697]->set_vertices(vertices[42],vertices[283],vertices[242],vertices[282]); + cells[1697]->set_neighbors(cells[1696],cells[291],cells[1698],cells[1699]); + set_offsets(cells[1697],4,0,2,0); + cells[1698]->set_vertices(vertices[42],vertices[275],vertices[283],vertices[282]); + cells[1698]->set_neighbors(cells[1695],cells[1697],cells[1328],cells[1341]); + set_offsets(cells[1698],4,0,0,0); + cells[1699]->set_vertices(vertices[2],vertices[242],vertices[42],vertices[283]); + cells[1699]->set_neighbors(cells[1697],cells[931],cells[1619],cells[1232]); + set_offsets(cells[1699],6,2,4,0); + cells[1700]->set_vertices(vertices[242],vertices[195],vertices[235],vertices[283]); + cells[1700]->set_neighbors(cells[1662],cells[1696],cells[1380],cells[1002]); + set_offsets(cells[1700],2,2,0,0); + cells[1701]->set_vertices(vertices[235],vertices[244],vertices[284],vertices[283]); + cells[1701]->set_neighbors(cells[324],cells[1667],cells[1662],cells[1570]); + set_offsets(cells[1701],0,2,0,0); + cells[1702]->set_vertices(vertices[275],vertices[235],vertices[227],vertices[284]); + cells[1702]->set_neighbors(cells[1459],cells[1703],cells[1667],cells[1452]); + set_offsets(cells[1702],0,0,0,0); + cells[1703]->set_vertices(vertices[275],vertices[284],vertices[227],vertices[276]); + cells[1703]->set_neighbors(cells[1194],cells[1626],cells[1704],cells[1702]); + set_offsets(cells[1703],0,0,0,0); + cells[1704]->set_vertices(vertices[284],vertices[275],vertices[36],vertices[276]); + cells[1704]->set_neighbors(cells[1382],cells[1616],cells[1703],cells[1705]); + set_offsets(cells[1704],0,0,4,0); + cells[1705]->set_vertices(vertices[44],vertices[275],vertices[36],vertices[284]); + cells[1705]->set_neighbors(cells[1704],cells[1198],cells[1623],cells[267]); + set_offsets(cells[1705],4,0,4,0); + cells[1706]->set_vertices(vertices[237],vertices[196],vertices[284],vertices[236]); + cells[1706]->set_neighbors(cells[1462],cells[1463],cells[238],cells[1475]); + set_offsets(cells[1706],0,2,0,0); + cells[1707]->set_vertices(vertices[277],vertices[237],vertices[285],vertices[284]); + cells[1707]->set_neighbors(cells[1708],cells[1710],cells[1003],cells[1635]); + set_offsets(cells[1707],0,0,0,0); + cells[1708]->set_vertices(vertices[285],vertices[237],vertices[244],vertices[284]); + cells[1708]->set_neighbors(cells[1475],cells[1709],cells[1707],cells[1712]); + set_offsets(cells[1708],0,0,2,0); + cells[1709]->set_vertices(vertices[44],vertices[285],vertices[244],vertices[284]); + cells[1709]->set_neighbors(cells[1708],cells[324],cells[1710],cells[1711]); + set_offsets(cells[1709],4,0,2,0); + cells[1710]->set_vertices(vertices[44],vertices[277],vertices[285],vertices[284]); + cells[1710]->set_neighbors(cells[1707],cells[1709],cells[1198],cells[58]); + set_offsets(cells[1710],4,0,0,0); + cells[1711]->set_vertices(vertices[4],vertices[244],vertices[44],vertices[285]); + cells[1711]->set_neighbors(cells[1709],cells[1471],cells[1630],cells[237]); + set_offsets(cells[1711],6,2,4,0); + cells[1712]->set_vertices(vertices[244],vertices[197],vertices[237],vertices[285]); + cells[1712]->set_neighbors(cells[1668],cells[1708],cells[343],cells[1426]); + set_offsets(cells[1712],2,2,0,0); + cells[1713]->set_vertices(vertices[247],vertices[287],vertices[47],vertices[0]); + cells[1713]->set_neighbors(cells[1615],cells[1353],cells[1721],cells[1724]); + set_offsets(cells[1713],2,0,4,7); + cells[1714]->set_vertices(vertices[231],vertices[239],vertices[279],vertices[286]); + cells[1714]->set_neighbors(cells[1725],cells[1715],cells[1674],cells[1247]); + set_offsets(cells[1714],0,0,0,0); + cells[1715]->set_vertices(vertices[231],vertices[286],vertices[279],vertices[278]); + cells[1715]->set_neighbors(cells[1716],cells[936],cells[1476],cells[1714]); + set_offsets(cells[1715],0,0,0,0); + cells[1716]->set_vertices(vertices[286],vertices[278],vertices[38],vertices[279]); + cells[1716]->set_neighbors(cells[1245],cells[1717],cells[1715],cells[1719]); + set_offsets(cells[1716],0,0,4,0); + cells[1717]->set_vertices(vertices[46],vertices[286],vertices[38],vertices[279]); + cells[1717]->set_neighbors(cells[1716],cells[1671],cells[1726],cells[1718]); + set_offsets(cells[1717],4,0,4,0); + cells[1718]->set_vertices(vertices[46],vertices[277],vertices[38],vertices[286]); + cells[1718]->set_neighbors(cells[1719],cells[1717],cells[1672],cells[1474]); + set_offsets(cells[1718],4,0,4,0); + cells[1719]->set_vertices(vertices[286],vertices[277],vertices[38],vertices[278]); + cells[1719]->set_neighbors(cells[322],cells[1716],cells[1480],cells[1718]); + set_offsets(cells[1719],0,0,4,0); + cells[1720]->set_vertices(vertices[247],vertices[199],vertices[287],vertices[240]); + cells[1720]->set_neighbors(cells[1640],cells[1721],cells[1497],cells[1722]); + set_offsets(cells[1720],2,2,0,3); + cells[1721]->set_vertices(vertices[0],vertices[247],vertices[287],vertices[240]); + cells[1721]->set_neighbors(cells[1720],cells[1677],cells[1496],cells[1713]); + set_offsets(cells[1721],7,2,0,3); + cells[1722]->set_vertices(vertices[246],vertices[199],vertices[287],vertices[247]); + cells[1722]->set_neighbors(cells[1720],cells[1723],cells[769],cells[1399]); + set_offsets(cells[1722],2,2,0,2); + cells[1723]->set_vertices(vertices[6],vertices[246],vertices[287],vertices[247]); + cells[1723]->set_neighbors(cells[1722],cells[1724],cells[1485],cells[1400]); + set_offsets(cells[1723],6,2,0,2); + cells[1724]->set_vertices(vertices[47],vertices[287],vertices[247],vertices[6]); + cells[1724]->set_neighbors(cells[1723],cells[234],cells[1488],cells[1713]); + set_offsets(cells[1724],4,0,2,6); + cells[1725]->set_vertices(vertices[286],vertices[239],vertices[279],vertices[287]); + cells[1725]->set_neighbors(cells[957],cells[1726],cells[1634],cells[1714]); + set_offsets(cells[1725],0,0,0,0); + cells[1726]->set_vertices(vertices[286],vertices[279],vertices[46],vertices[287]); + cells[1726]->set_neighbors(cells[1727],cells[1162],cells[1725],cells[1717]); + set_offsets(cells[1726],0,0,4,0); + cells[1727]->set_vertices(vertices[39],vertices[46],vertices[279],vertices[287]); + cells[1727]->set_neighbors(cells[1726],cells[1594],cells[1021],cells[1671]); + set_offsets(cells[1727],4,4,0,0); + vertices[0]->set_cell(cells[1721]); + vertices[1]->set_cell(cells[1507]); + vertices[2]->set_cell(cells[1699]); + vertices[3]->set_cell(cells[1468]); + vertices[4]->set_cell(cells[1711]); + vertices[5]->set_cell(cells[1532]); + vertices[6]->set_cell(cells[1724]); + vertices[7]->set_cell(cells[1495]); + vertices[8]->set_cell(cells[1548]); + vertices[9]->set_cell(cells[1557]); + vertices[10]->set_cell(cells[1510]); + vertices[11]->set_cell(cells[1568]); + vertices[12]->set_cell(cells[1577]); + vertices[13]->set_cell(cells[1580]); + vertices[14]->set_cell(cells[1530]); + vertices[15]->set_cell(cells[1537]); + vertices[16]->set_cell(cells[1557]); + vertices[17]->set_cell(cells[1614]); + vertices[18]->set_cell(cells[1569]); + vertices[19]->set_cell(cells[1569]); + vertices[20]->set_cell(cells[1573]); + vertices[21]->set_cell(cells[1584]); + vertices[22]->set_cell(cells[1580]); + vertices[23]->set_cell(cells[1593]); + vertices[24]->set_cell(cells[1614]); + vertices[25]->set_cell(cells[1659]); + vertices[26]->set_cell(cells[1621]); + vertices[27]->set_cell(cells[1660]); + vertices[28]->set_cell(cells[1632]); + vertices[29]->set_cell(cells[1629]); + vertices[30]->set_cell(cells[1593]); + vertices[31]->set_cell(cells[1489]); + vertices[32]->set_cell(cells[1658]); + vertices[33]->set_cell(cells[1653]); + vertices[34]->set_cell(cells[1691]); + vertices[35]->set_cell(cells[1666]); + vertices[36]->set_cell(cells[1705]); + vertices[37]->set_cell(cells[1629]); + vertices[38]->set_cell(cells[1719]); + vertices[39]->set_cell(cells[1727]); + vertices[40]->set_cell(cells[1688]); + vertices[41]->set_cell(cells[1686]); + vertices[42]->set_cell(cells[1699]); + vertices[43]->set_cell(cells[1456]); + vertices[44]->set_cell(cells[1711]); + vertices[45]->set_cell(cells[1628]); + vertices[46]->set_cell(cells[1727]); + vertices[47]->set_cell(cells[1724]); + vertices[48]->set_cell(cells[839]); + vertices[49]->set_cell(cells[861]); + vertices[50]->set_cell(cells[855]); + vertices[51]->set_cell(cells[872]); + vertices[52]->set_cell(cells[788]); + vertices[53]->set_cell(cells[888]); + vertices[54]->set_cell(cells[881]); + vertices[55]->set_cell(cells[903]); + vertices[56]->set_cell(cells[637]); + vertices[57]->set_cell(cells[683]); + vertices[58]->set_cell(cells[681]); + vertices[59]->set_cell(cells[681]); + vertices[60]->set_cell(cells[658]); + vertices[61]->set_cell(cells[722]); + vertices[62]->set_cell(cells[677]); + vertices[63]->set_cell(cells[726]); + vertices[64]->set_cell(cells[726]); + vertices[65]->set_cell(cells[738]); + vertices[66]->set_cell(cells[679]); + vertices[67]->set_cell(cells[742]); + vertices[68]->set_cell(cells[549]); + vertices[69]->set_cell(cells[752]); + vertices[70]->set_cell(cells[723]); + vertices[71]->set_cell(cells[755]); + vertices[72]->set_cell(cells[738]); + vertices[73]->set_cell(cells[778]); + vertices[74]->set_cell(cells[697]); + vertices[75]->set_cell(cells[814]); + vertices[76]->set_cell(cells[666]); + vertices[77]->set_cell(cells[799]); + vertices[78]->set_cell(cells[723]); + vertices[79]->set_cell(cells[813]); + vertices[80]->set_cell(cells[813]); + vertices[81]->set_cell(cells[794]); + vertices[82]->set_cell(cells[814]); + vertices[83]->set_cell(cells[835]); + vertices[84]->set_cell(cells[800]); + vertices[85]->set_cell(cells[880]); + vertices[86]->set_cell(cells[777]); + vertices[87]->set_cell(cells[850]); + vertices[88]->set_cell(cells[806]); + vertices[89]->set_cell(cells[859]); + vertices[90]->set_cell(cells[821]); + vertices[91]->set_cell(cells[836]); + vertices[92]->set_cell(cells[871]); + vertices[93]->set_cell(cells[886]); + vertices[94]->set_cell(cells[881]); + vertices[95]->set_cell(cells[902]); + vertices[96]->set_cell(cells[1120]); + vertices[97]->set_cell(cells[1130]); + vertices[98]->set_cell(cells[1124]); + vertices[99]->set_cell(cells[1137]); + vertices[100]->set_cell(cells[1135]); + vertices[101]->set_cell(cells[1147]); + vertices[102]->set_cell(cells[1118]); + vertices[103]->set_cell(cells[1158]); + vertices[104]->set_cell(cells[908]); + vertices[105]->set_cell(cells[969]); + vertices[106]->set_cell(cells[950]); + vertices[107]->set_cell(cells[961]); + vertices[108]->set_cell(cells[907]); + vertices[109]->set_cell(cells[971]); + vertices[110]->set_cell(cells[932]); + vertices[111]->set_cell(cells[898]); + vertices[112]->set_cell(cells[978]); + vertices[113]->set_cell(cells[992]); + vertices[114]->set_cell(cells[950]); + vertices[115]->set_cell(cells[1001]); + vertices[116]->set_cell(cells[970]); + vertices[117]->set_cell(cells[1042]); + vertices[118]->set_cell(cells[1013]); + vertices[119]->set_cell(cells[1037]); + vertices[120]->set_cell(cells[1038]); + vertices[121]->set_cell(cells[1092]); + vertices[122]->set_cell(cells[924]); + vertices[123]->set_cell(cells[1094]); + vertices[124]->set_cell(cells[984]); + vertices[125]->set_cell(cells[1070]); + vertices[126]->set_cell(cells[1013]); + vertices[127]->set_cell(cells[1078]); + vertices[128]->set_cell(cells[1073]); + vertices[129]->set_cell(cells[1092]); + vertices[130]->set_cell(cells[1065]); + vertices[131]->set_cell(cells[1127]); + vertices[132]->set_cell(cells[1069]); + vertices[133]->set_cell(cells[1123]); + vertices[134]->set_cell(cells[1106]); + vertices[135]->set_cell(cells[1117]); + vertices[136]->set_cell(cells[1074]); + vertices[137]->set_cell(cells[1129]); + vertices[138]->set_cell(cells[1127]); + vertices[139]->set_cell(cells[1138]); + vertices[140]->set_cell(cells[1123]); + vertices[141]->set_cell(cells[1145]); + vertices[142]->set_cell(cells[1118]); + vertices[143]->set_cell(cells[1158]); + vertices[144]->set_cell(cells[1397]); + vertices[145]->set_cell(cells[1409]); + vertices[146]->set_cell(cells[1414]); + vertices[147]->set_cell(cells[1421]); + vertices[148]->set_cell(cells[1383]); + vertices[149]->set_cell(cells[1429]); + vertices[150]->set_cell(cells[1431]); + vertices[151]->set_cell(cells[1436]); + vertices[152]->set_cell(cells[1214]); + vertices[153]->set_cell(cells[1229]); + vertices[154]->set_cell(cells[1191]); + vertices[155]->set_cell(cells[1281]); + vertices[156]->set_cell(cells[1192]); + vertices[157]->set_cell(cells[1294]); + vertices[158]->set_cell(cells[1111]); + vertices[159]->set_cell(cells[1268]); + vertices[160]->set_cell(cells[1269]); + vertices[161]->set_cell(cells[1274]); + vertices[162]->set_cell(cells[1179]); + vertices[163]->set_cell(cells[1322]); + vertices[164]->set_cell(cells[1258]); + vertices[165]->set_cell(cells[1338]); + vertices[166]->set_cell(cells[1264]); + vertices[167]->set_cell(cells[1313]); + vertices[168]->set_cell(cells[1314]); + vertices[169]->set_cell(cells[1358]); + vertices[170]->set_cell(cells[1289]); + vertices[171]->set_cell(cells[1337]); + vertices[172]->set_cell(cells[1302]); + vertices[173]->set_cell(cells[1345]); + vertices[174]->set_cell(cells[1311]); + vertices[175]->set_cell(cells[1360]); + vertices[176]->set_cell(cells[1360]); + vertices[177]->set_cell(cells[1416]); + vertices[178]->set_cell(cells[1337]); + vertices[179]->set_cell(cells[1392]); + vertices[180]->set_cell(cells[1345]); + vertices[181]->set_cell(cells[1375]); + vertices[182]->set_cell(cells[1357]); + vertices[183]->set_cell(cells[1401]); + vertices[184]->set_cell(cells[1398]); + vertices[185]->set_cell(cells[1416]); + vertices[186]->set_cell(cells[1384]); + vertices[187]->set_cell(cells[1421]); + vertices[188]->set_cell(cells[1392]); + vertices[189]->set_cell(cells[1430]); + vertices[190]->set_cell(cells[1167]); + vertices[191]->set_cell(cells[1437]); + vertices[192]->set_cell(cells[1678]); + vertices[193]->set_cell(cells[1683]); + vertices[194]->set_cell(cells[1694]); + vertices[195]->set_cell(cells[1700]); + vertices[196]->set_cell(cells[1706]); + vertices[197]->set_cell(cells[1712]); + vertices[198]->set_cell(cells[1641]); + vertices[199]->set_cell(cells[1722]); + vertices[200]->set_cell(cells[1498]); + vertices[201]->set_cell(cells[1562]); + vertices[202]->set_cell(cells[1513]); + vertices[203]->set_cell(cells[1549]); + vertices[204]->set_cell(cells[1521]); + vertices[205]->set_cell(cells[1588]); + vertices[206]->set_cell(cells[1493]); + vertices[207]->set_cell(cells[1546]); + vertices[208]->set_cell(cells[1546]); + vertices[209]->set_cell(cells[1600]); + vertices[210]->set_cell(cells[1517]); + vertices[211]->set_cell(cells[1575]); + vertices[212]->set_cell(cells[1336]); + vertices[213]->set_cell(cells[1588]); + vertices[214]->set_cell(cells[1493]); + vertices[215]->set_cell(cells[1604]); + vertices[216]->set_cell(cells[1605]); + vertices[217]->set_cell(cells[1647]); + vertices[218]->set_cell(cells[1517]); + vertices[219]->set_cell(cells[1625]); + vertices[220]->set_cell(cells[1386]); + vertices[221]->set_cell(cells[1670]); + vertices[222]->set_cell(cells[1592]); + vertices[223]->set_cell(cells[1644]); + vertices[224]->set_cell(cells[1605]); + vertices[225]->set_cell(cells[1693]); + vertices[226]->set_cell(cells[1655]); + vertices[227]->set_cell(cells[1703]); + vertices[228]->set_cell(cells[1664]); + vertices[229]->set_cell(cells[1673]); + vertices[230]->set_cell(cells[1675]); + vertices[231]->set_cell(cells[1715]); + vertices[232]->set_cell(cells[1642]); + vertices[233]->set_cell(cells[1693]); + vertices[234]->set_cell(cells[1694]); + vertices[235]->set_cell(cells[1702]); + vertices[236]->set_cell(cells[1706]); + vertices[237]->set_cell(cells[1712]); + vertices[238]->set_cell(cells[1675]); + vertices[239]->set_cell(cells[1725]); + vertices[240]->set_cell(cells[1721]); + vertices[241]->set_cell(cells[1685]); + vertices[242]->set_cell(cells[1700]); + vertices[243]->set_cell(cells[1663]); + vertices[244]->set_cell(cells[1712]); + vertices[245]->set_cell(cells[1669]); + vertices[246]->set_cell(cells[1723]); + vertices[247]->set_cell(cells[1724]); + vertices[248]->set_cell(cells[1548]); + vertices[249]->set_cell(cells[1562]); + vertices[250]->set_cell(cells[1562]); + vertices[251]->set_cell(cells[1576]); + vertices[252]->set_cell(cells[1577]); + vertices[253]->set_cell(cells[1588]); + vertices[254]->set_cell(cells[1538]); + vertices[255]->set_cell(cells[1582]); + vertices[256]->set_cell(cells[1602]); + vertices[257]->set_cell(cells[1614]); + vertices[258]->set_cell(cells[1564]); + vertices[259]->set_cell(cells[1622]); + vertices[260]->set_cell(cells[1577]); + vertices[261]->set_cell(cells[1633]); + vertices[262]->set_cell(cells[1591]); + vertices[263]->set_cell(cells[1637]); + vertices[264]->set_cell(cells[1647]); + vertices[265]->set_cell(cells[1659]); + vertices[266]->set_cell(cells[1622]); + vertices[267]->set_cell(cells[1626]); + vertices[268]->set_cell(cells[1633]); + vertices[269]->set_cell(cells[1670]); + vertices[270]->set_cell(cells[1644]); + vertices[271]->set_cell(cells[1644]); + vertices[272]->set_cell(cells[1657]); + vertices[273]->set_cell(cells[1693]); + vertices[274]->set_cell(cells[1692]); + vertices[275]->set_cell(cells[1705]); + vertices[276]->set_cell(cells[1704]); + vertices[277]->set_cell(cells[1719]); + vertices[278]->set_cell(cells[1719]); + vertices[279]->set_cell(cells[1727]); + vertices[280]->set_cell(cells[1688]); + vertices[281]->set_cell(cells[1689]); + vertices[282]->set_cell(cells[1698]); + vertices[283]->set_cell(cells[1701]); + vertices[284]->set_cell(cells[1710]); + vertices[285]->set_cell(cells[1712]); + vertices[286]->set_cell(cells[1726]); + vertices[287]->set_cell(cells[1727]); + + tds().set_dimension(3); + this->set_cover(make_array(1,1,1)); + + return vertices; +} + +#endif // CGAL_INCLUDE_FROM_PERIODIC_3_REGULAR_TRIANGULATION_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_filtered_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_filtered_traits_3.h new file mode 100644 index 00000000000..e8d8cd5e11c --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_filtered_traits_3.h @@ -0,0 +1,190 @@ +// Copyright (c) 1999-2004,2006-2009,2013-2015, 2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Monique Teillaud +// Aymeric Pelle +// Mael Rouxel-Labbé + +#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_FILTERED_TRAITS_3_H +#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_FILTERED_TRAITS_3_H + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace CGAL { + +// The first template item is supposed to be a Filtered_kernel-like kernel. +template < typename K, typename Off > +class Periodic_3_regular_triangulation_filtered_traits_base_3 + : public Periodic_3_regular_triangulation_traits_base_3 +{ + typedef Periodic_3_regular_triangulation_traits_base_3 Base; + + typedef typename K::Exact_kernel EKernel; + typedef typename K::Approximate_kernel AKernel; + typedef typename K::C2E C2E; + typedef typename K::C2F C2F; + + // Exact traits is based on the exact kernel. + typedef Periodic_3_regular_triangulation_traits_3 Exact_traits; + // Filtering traits is based on the filtering kernel. + typedef Periodic_3_regular_triangulation_traits_3 Filtering_traits; +private: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + +public: + Periodic_3_regular_triangulation_filtered_traits_base_3(const Iso_cuboid_3& domain, + const K& k) + : + Base(domain, k), + regular_traits_e(C2E()(domain)), + regular_traits_f(C2F()(domain)) + { + // Problem 1: above is a default initialization of the kernel in the traits. + // Hence, if the kernel has members and we use filtered traits, then + // the members will be default constructed here... + + // Problem 2: we have built filtered traits in P3Tfiltered_traits_3 and now + // we also need those two... + } + + virtual void set_domain(const Iso_cuboid_3& domain) + { + this->_domain = domain; + this->set_filtrating_traits(domain); + set_filtrating_regular_traits(domain); + } + + void set_filtrating_regular_traits(const Iso_cuboid_3& domain) + { + regular_traits_e.set_domain(C2E()(domain)); + regular_traits_f.set_domain(C2F()(domain)); + } + +public: + typedef Filtered_predicate< + typename Exact_traits::Coplanar_orientation_3, + typename Filtering_traits::Coplanar_orientation_3, + Offset_converter_3, + Offset_converter_3 > Coplanar_orientation_3; + + typedef Filtered_predicate< + typename Exact_traits::Power_side_of_oriented_power_sphere_3, + typename Filtering_traits::Power_side_of_oriented_power_sphere_3, + Offset_converter_3, + Offset_converter_3 > Power_side_of_oriented_power_sphere_3; + + typedef Filtered_predicate< + typename Exact_traits::Compare_power_distance_3, + typename Filtering_traits::Compare_power_distance_3, + Offset_converter_3, + Offset_converter_3 > Compare_power_distance_3; + + typedef Filtered_predicate< + typename Exact_traits::Compare_weighted_squared_radius_3, + typename Filtering_traits::Compare_weighted_squared_radius_3, + Offset_converter_3, + Offset_converter_3 > Compare_weighted_squared_radius_3; + + Coplanar_orientation_3 coplanar_orientation_3_object() const + { + typename Exact_traits::Coplanar_orientation_3 pe = regular_traits_e.coplanar_orientation_3_object(); + typename Filtering_traits::Coplanar_orientation_3 pf = regular_traits_f.coplanar_orientation_3_object(); + + return Coplanar_orientation_3(pe, pf); + } + + Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere_3_object() const + { + typename Exact_traits::Power_side_of_oriented_power_sphere_3 pe = regular_traits_e.power_side_of_oriented_power_sphere_3_object(); + typename Filtering_traits::Power_side_of_oriented_power_sphere_3 pf = regular_traits_f.power_side_of_oriented_power_sphere_3_object(); + + return Power_side_of_oriented_power_sphere_3(pe, pf); + } + + Compare_power_distance_3 compare_power_distance_3_object() const + { + typename Exact_traits::Compare_power_distance_3 pe = regular_traits_e.compare_power_distance_3_object(); + typename Filtering_traits::Compare_power_distance_3 pf = regular_traits_f.compare_power_distance_3_object(); + + return Compare_power_distance_3(pe, pf); + } + + Compare_weighted_squared_radius_3 compare_weighted_squared_radius_3_object() const + { + typename Exact_traits::Compare_weighted_squared_radius_3 pe = regular_traits_e.compare_weighted_squared_radius_3_object(); + typename Filtering_traits::Compare_weighted_squared_radius_3 pf = regular_traits_f.compare_weighted_squared_radius_3_object(); + + return Compare_weighted_squared_radius_3(pe, pf); + } + +protected: + Exact_traits regular_traits_e; + Filtering_traits regular_traits_f; +}; + +} // namespace CGAL + +#include + +namespace CGAL { + +template < typename K, + typename Off = typename CGAL::Periodic_3_offset_3, + bool Has_static_filters = internal::Has_static_filters::value > +class Periodic_3_regular_triangulation_filtered_traits_3 + : public Periodic_3_regular_triangulation_statically_filtered_traits_3 +{ + typedef Periodic_3_regular_triangulation_statically_filtered_traits_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_regular_triangulation_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } +}; + +template < typename K, typename Off> +class Periodic_3_regular_triangulation_filtered_traits_3 + : public Periodic_3_regular_triangulation_filtered_traits_base_3 +{ + typedef Periodic_3_regular_triangulation_filtered_traits_base_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_regular_triangulation_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } +}; + +} //namespace CGAL + +#endif // CGAL_PERIODIC_3_REGULAR_TRIANGULATION_FILTERED_TRAITS_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h new file mode 100644 index 00000000000..88141956464 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h @@ -0,0 +1,250 @@ +// Copyright (c) 1999-2004,2006-2009,2013-2015,2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Monique Teillaud +// Aymeric Pelle + +#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_REMOVE_TRAITS_3_H +#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_REMOVE_TRAITS_3_H + +#include + +#include +#include + +#include + +#include + +namespace CGAL +{ + +// Triangulation_3 has calls to Construct_point_3 to handle weighted and bare points. +// The default inherited Construct_point_3 inherited by Periodic_3_triangulation_remove_traits_3 +// must be overwritten by a construction Construct_point_3 that offers: +// - pair --> pair (identity) +// - pair --> pair +template +class Construct_point_from_weighted_pair_3 + : public Construct_point_from_pair_3 +{ + typedef Construct_point_from_pair_3 Base; + + // `Traits::Point_3` is actually a `std::pair` + // `Traits::Weighted_point_3` is actually a `std::pair` + typedef typename Gt::Point_3 Point_3; + typedef typename Gt::Weighted_point_3 Weighted_point_3; + +public: + Construct_point_from_weighted_pair_3(const Construct_point_3_base& cp) : Base(cp) { } + + using Base::operator(); // for K::Weighted_point_3 to Point_3 + + Point_3 operator()(const Weighted_point_3& wp) { + return std::make_pair(operator()(wp.first), wp.second /* offset */); + } +}; + +template +class Functor_with_weighted_point_offset_pair_adaptor + : public Functor_ +{ + typedef Traits_ Traits; + typedef Functor_ Functor; + + // `Traits::Point_3` is actually a `std::pair` + // `Traits::Weighted_point_3` is actually a `std::pair` + typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Weighted_point_3 Weighted_point_3; + +public: + typedef typename Functor::result_type result_type; + + Functor_with_weighted_point_offset_pair_adaptor (const Functor & functor) + : Functor_(functor) + { } + +public: + using Functor::operator(); + + result_type operator() (const Point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2) const + { + return operator()(p0.first, p1.first, p2.first, + p0.second, p1.second, p2.second); + } + + // bare points + result_type operator()(const Point_3& p0, const Point_3& p1) const { + return operator()(p0.first, p1.first, + p0.second, p1.second); + } + result_type operator()(const Point_3& p0, const Point_3& p1, + const Point_3& p2) const { + return operator()(p0.first, p1.first, p2.first, + p0.second, p1.second, p2.second); + } + result_type operator()(const Point_3& p0, const Point_3& p1, + const Point_3& p2, const Point_3& p3) const { + return operator()(p0.first, p1.first, p2.first, p3.first, + p0.second, p1.second, p2.second, p3.second); + } + result_type operator()(const Point_3& p0, const Point_3& p1, + const Point_3& p2, const Point_3& p3, const Point_3& p4) const { + return operator()(p0.first, p1.first, p2.first, p3.first, p4.first, + p0.second, p1.second, p2.second, p3.second, p4.second); + } + + // weighted points + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const + { + return operator()(p0.first, p1.first, p0.second, p1.second); + } + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2) const + { + return operator()(p0.first, p1.first, p2.first, + p0.second, p1.second, p2.second); + } + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3) const + { + return operator()(p0.first, p1.first, p2.first, p3.first, + p0.second, p1.second, p2.second, p3.second); + } + result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Weighted_point_3& p3, + const Weighted_point_3& p4) const + { + return operator()(p0.first, p1.first, p2.first, p3.first, p4.first, + p0.second, p1.second, p2.second, p3.second, p4.second); + } +}; + +template +class Periodic_3_regular_triangulation_remove_traits_3 + : public Gt +{ + typedef Periodic_3_regular_triangulation_remove_traits_3 Self; + typedef Gt Base; + +public: + typedef Gt Geom_traits; + typedef Off Offset; + + typedef typename Gt::RT RT; + typedef typename Gt::FT FT; + typedef std::pair Point_3; + typedef std::pair Weighted_point_3; + + // not allowing a default value for `gt` because we need to have + // an initialized domain in `gt` + Periodic_3_regular_triangulation_remove_traits_3(const Gt& gt) : Base(gt) { } + + // Construct point + typedef Construct_point_from_weighted_pair_3 + Construct_point_3; + + // Triangulation traits + typedef Functor_with_weighted_point_offset_pair_adaptor + Compare_xyz_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Coplanar_orientation_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Orientation_3; + + // Regular Triangulation traits + typedef Functor_with_weighted_point_offset_pair_adaptor + Power_side_of_oriented_power_sphere_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Compare_power_distance_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Power_side_of_bounded_power_sphere_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Construct_weighted_circumcenter_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Construct_circumcenter_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Compute_squared_radius_smallest_orthogonal_sphere_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Compute_power_product_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Compute_power_distance_to_power_sphere_3; + typedef Functor_with_weighted_point_offset_pair_adaptor + Compare_weighted_squared_radius_3; + + // Operations + Construct_point_3 + construct_point_3_object() const { + return Construct_point_3(this->Base::construct_point_3_object()); + } + + Compare_xyz_3 + compare_xyz_3_object() const { + return Compare_xyz_3(this->Base::compare_xyz_3_object()); + } + Coplanar_orientation_3 + coplanar_orientation_3_object() const { + return Coplanar_orientation_3(this->Base::coplanar_orientation_3_object()); + } + Orientation_3 + orientation_3_object() const { + return Orientation_3(this->Base::orientation_3_object()); + } + Power_side_of_oriented_power_sphere_3 + power_side_of_oriented_power_sphere_3_object() const { + return Power_side_of_oriented_power_sphere_3(this->Base::power_side_of_oriented_power_sphere_3_object()); + } + Compare_power_distance_3 + compare_power_distance_3_object() const { + return Compare_power_distance_3(this->Base::compare_power_distance_3_object()); + } + Power_side_of_bounded_power_sphere_3 + power_side_of_bounded_power_sphere_3_object() const { + return Power_side_of_bounded_power_sphere_3(this->Base::power_side_of_bounded_power_sphere_3_object()); + } + Construct_weighted_circumcenter_3 + construct_weighted_circumcenter_3_object() const { + return Construct_weighted_circumcenter_3(this->Base::construct_weighted_circumcenter_3_object()); + } + Construct_circumcenter_3 + construct_circumcenter_3_object() const { + return Construct_circumcenter_3(this->Base::construct_circumcenter_3_object()); + } + Compute_squared_radius_smallest_orthogonal_sphere_3 + compute_squared_radius_smallest_orthogonal_sphere_3_object() const { + return Compute_squared_radius_smallest_orthogonal_sphere_3(this->Base::compute_squared_radius_smallest_orthogonal_sphere_3_object()); + } + Compute_power_product_3 + compute_power_product_3_object() const { + return Compute_power_product_3(this->Base::compute_power_product_3_object()); + } + Compute_power_distance_to_power_sphere_3 + compute_power_distance_to_power_sphere_3_object() const { + return Compute_power_distance_to_power_sphere_3(this->Base::compute_power_distance_to_power_sphere_3_object()); + } + Compare_weighted_squared_radius_3 + compare_weighted_squared_radius_3_object() const { + return Compare_weighted_squared_radius_3(this->Base::compare_weighted_squared_radius_3_object()); + } +}; + +} //namespace CGAL + +#endif // CGAL_PERIODIC_3_REGULAR_TRIANGULATION_REMOVE_TRAITS_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_statically_filtered_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_statically_filtered_traits_3.h new file mode 100644 index 00000000000..e7f61ef4d8c --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_statically_filtered_traits_3.h @@ -0,0 +1,65 @@ +// Copyright (c) 2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Mael Rouxel-Labbé + +#ifndef CGAL_PERIODIC_3_REGULAR_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H +#define CGAL_PERIODIC_3_REGULAR_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H + +#include + +#include +#include + +namespace CGAL { + +template< typename K, + typename Off = typename CGAL::Periodic_3_offset_3> +class Periodic_3_regular_triangulation_statically_filtered_traits_3 + : public Periodic_3_regular_triangulation_filtered_traits_base_3 +{ + typedef Periodic_3_regular_triangulation_statically_filtered_traits_3 Self; + typedef Periodic_3_regular_triangulation_filtered_traits_base_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_regular_triangulation_statically_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } + +#if 0 // todo + typedef internal::Static_filters_predicates:: + Periodic_3_power_side_of_oriented_power_sphere_3< + Self, typename Base::Periodic_3_power_side_of_oriented_power_sphere_3> + Power_side_of_oriented_power_sphere_3; + + Power_side_of_oriented_power_sphere_3 + power_side_of_oriented_power_sphere_3_object() const + { + return Power_side_of_oriented_power_sphere_3(&this->_domain, + &this->_domain_e, + &this->_domain_f); + } +#endif +}; + +} //namespace CGAL + +#endif // CGAL_PERIODIC_3_REGULAR_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_dummy_36.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_dummy_36.h similarity index 98% rename from Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_dummy_36.h rename to Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_dummy_36.h index c1fbf9c565d..bf23abe9dbf 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_dummy_36.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_dummy_36.h @@ -14,12 +14,11 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Manuel Caroli -#ifdef CGAL_INCLUDE_FROM_PERIODIC_3_TRIANGULATION_3_H - +#ifdef CGAL_INCLUDE_FROM_PERIODIC_3_TRIANGULATION_3_H template < class GT, class TDS > inline std::vector::Vertex_handle > @@ -28,24 +27,24 @@ Periodic_3_triangulation_3::insert_dummy_points() { Vertex_handle vertices[36]; Cell_handle cells[216]; - + // Initialise vertices: for (int i=0; i<4; i++) { for (int j=0; j<3; j++) { for (int k=0; k<3; k++) { - // Initialise virtual vertices out of the domain for debugging - vertices[9*i+3*j+k] = _tds.create_vertex(); - Point p(k*(1.0/3.0) + i*(1.0/6.0), - j*(1.0/3.0) + i*(1.0/6.0), i*(1.0/4.0) ); - p = Point((p.x() > FT(0.9375) ? (std::max)( p.x()-1, FT(0) ) : p.x()), - (p.y() > FT(0.9375) ? (std::max)( p.y()-1, FT(0) ) : p.y()), p.z()); - p = Point((_domain.xmax()-_domain.xmin())*p.x(), - (_domain.xmax()-_domain.xmin())*p.y(), - (_domain.xmax()-_domain.xmin())*p.z()); - p = Point(p.x() + _domain.xmin(), - p.y() + _domain.ymin(), - p.z() + _domain.zmin()); - vertices[9*i+3*j+k]->set_point(p); + // Initialise virtual vertices out of the domain for debugging + vertices[9*i+3*j+k] = _tds.create_vertex(); + Point p(k*(1.0/3.0) + i*(1.0/6.0), + j*(1.0/3.0) + i*(1.0/6.0), i*(1.0/4.0) ); + p = Point((p.x() > FT(0.9375) ? (std::max)( p.x()-1, FT(0) ) : p.x()), + (p.y() > FT(0.9375) ? (std::max)( p.y()-1, FT(0) ) : p.y()), p.z()); + p = Point((domain().xmax()-domain().xmin())*p.x(), + (domain().xmax()-domain().xmin())*p.y(), + (domain().xmax()-domain().xmin())*p.z()); + p = Point(p.x() + domain().xmin(), + p.y() + domain().ymin(), + p.z() + domain().zmin()); + vertices[9*i+3*j+k]->set_point(p); } } } @@ -54,7 +53,7 @@ Periodic_3_triangulation_3::insert_dummy_points() { for (int i=0; i<216; i++) { cells[i] = _tds.create_cell(); } - + cells[0]->set_vertices(vertices[3],vertices[9],vertices[4],vertices[12]); cells[1]->set_vertices(vertices[28],vertices[8],vertices[3],vertices[6]); cells[2]->set_vertices(vertices[0],vertices[11],vertices[9],vertices[3]); diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h index 812f1048dad..54feeee92c1 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_filtered_traits_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004,2006-2009 INRIA Sophia-Antipolis (France). +// Copyright (c) 2004,2006-2009,2017 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -12,10 +12,6 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Sylvain Pion // Nico Kruithof // Manuel Caroli @@ -26,8 +22,6 @@ #include - -#include #include #include #include @@ -36,42 +30,6 @@ #include #include -namespace CGAL { - -// This template class is a wrapper that implements the filtering for any -// predicate (dynamic filters with IA). - -// TODO : -// - each predicate in the default kernel should define a tag that says if it -// wants to be filtered or not (=> all homogeneous predicate define this -// tag). We could even test-suite that automatically. It makes a strong -// new requirement on the kernel though... -// Could be done with a traits mechanism ? -// A default template could use the current IA, but other tags or whatever -// could specify no filtering at all, or static filtering... -// - same thing for constructions => virtual operator() ? -// - similarly, constructions should have a tag saying if they can throw or -// not, or we let all this up to the compiler optimizer to figure out ? -// - Some caching could be done at the Point_2 level. - -template -class Filtered_periodic_predicate - : public Filtered_predicate -{ - typedef Filtered_predicate Base; -public: - Filtered_periodic_predicate() : Base() {} - - // These constructors are used for constructive predicates. - // You should try to avoid constructive predicates, as they will construct - // the exact values systematically (in the ctor), rather than lazily. - template - Filtered_periodic_predicate(const OE * oe, const OA * oa) - : Base( EP(oe), AP(oa) ) - {} -}; -} - #include namespace CGAL @@ -95,7 +53,6 @@ struct Offset_converter_3 typedef typename Periodic_3_triangulation_traits_base_3 ::Point_3 Target_pt; - using Converter::operator(); Target_off @@ -105,108 +62,128 @@ struct Offset_converter_3 } }; -// The argument is supposed to be a Filtered_kernel like kernel. +// The first template item is supposed to be a Filtered_kernel-like kernel. template < typename K, typename Off > class Periodic_3_triangulation_filtered_traits_base_3 : public Periodic_3_triangulation_traits_base_3 { - typedef Periodic_3_triangulation_traits_base_3 Base; + typedef Periodic_3_triangulation_traits_base_3 Base; + + typedef typename K::Exact_kernel EKernel; + typedef typename K::Approximate_kernel AKernel; + typedef typename K::C2E C2E; + typedef typename K::C2F C2F; // Exact traits is based on the exact kernel. - typedef Periodic_3_triangulation_traits_3 - Exact_traits; + typedef Periodic_3_triangulation_traits_3 Exact_traits; // Filtering traits is based on the filtering kernel. - typedef Periodic_3_triangulation_traits_3 - Filtering_traits; -private: - typedef typename K::C2E C2E; - typedef typename K::C2F C2F; + typedef Periodic_3_triangulation_traits_3 Filtering_traits; - typedef typename C2E::Target_kernel::Iso_cuboid_3 Exact_iso_cuboid_3; - typedef typename C2F::Target_kernel::Iso_cuboid_3 Approximate_iso_cuboid_3; - public: - typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - void set_domain(const Iso_cuboid_3& domain) { - C2E c2e; - C2F c2f; - this->_domain = domain; - this->_domain_e = c2e(this->_domain); - this->_domain_f = c2f(this->_domain); + Periodic_3_triangulation_filtered_traits_base_3(const Iso_cuboid_3& domain, + const K& k) + : + Base(domain, k), + traits_e(C2E()(domain)), + traits_f(C2F()(domain)) + { + // Problem: below is a default initialization of the kernel in the traits. + // Hence, if the kernel has members and we use filtered traits, then + // the members will be default constructed here... } - typedef Filtered_periodic_predicate< + virtual void set_domain(const Iso_cuboid_3& domain) + { + this->_domain = domain; + set_filtrating_traits(domain); + } + + void set_filtrating_traits(const Iso_cuboid_3& domain) + { + traits_e.set_domain(C2E()(domain)); + traits_f.set_domain(C2F()(domain)); + } + + typedef Filtered_predicate< typename Exact_traits::Compare_xyz_3, typename Filtering_traits::Compare_xyz_3, Offset_converter_3, Offset_converter_3 > Compare_xyz_3; - typedef Filtered_periodic_predicate< - typename Exact_traits::Coplanar_orientation_3, - typename Filtering_traits::Coplanar_orientation_3, - Offset_converter_3, - Offset_converter_3 > Coplanar_orientation_3; - - typedef Filtered_periodic_predicate< + typedef Filtered_predicate< typename Exact_traits::Orientation_3, typename Filtering_traits::Orientation_3, Offset_converter_3, Offset_converter_3 > Orientation_3; - typedef Filtered_periodic_predicate< - typename Exact_traits::Coplanar_side_of_bounded_circle_3, - typename Filtering_traits::Coplanar_side_of_bounded_circle_3, - Offset_converter_3, - Offset_converter_3 > Coplanar_side_of_bounded_circle_3; - - typedef Filtered_periodic_predicate< - typename Exact_traits::Compare_distance_3, - typename Filtering_traits::Compare_distance_3, - Offset_converter_3, - Offset_converter_3 > Compare_distance_3; - Compare_xyz_3 compare_xyz_3_object() const - { return Compare_xyz_3(&_domain_e,&_domain_f);} + { + typename Exact_traits::Compare_xyz_3 pe = traits_e.compare_xyz_3_object(); + typename Filtering_traits::Compare_xyz_3 pf = traits_f.compare_xyz_3_object(); - Coplanar_orientation_3 coplanar_orientation_3_object() const - { return Coplanar_orientation_3(&_domain_e,&_domain_f); } + return Compare_xyz_3(pe, pf); + } Orientation_3 orientation_3_object() const - { return Orientation_3(&_domain_e,&_domain_f);} + { + typename Exact_traits::Orientation_3 pe = traits_e.orientation_3_object(); + typename Filtering_traits::Orientation_3 pf = traits_f.orientation_3_object(); - Coplanar_side_of_bounded_circle_3 - coplanar_side_of_bounded_circle_3_object() const - { return Coplanar_side_of_bounded_circle_3(&_domain_e,&_domain_f); } + return Orientation_3(pe, pf); + } // The following are inherited since they are constructions : // Construct_segment_3 // Construct_triangle_3 // Construct_tetrahedron_3 - protected: - Exact_iso_cuboid_3 _domain_e; - Approximate_iso_cuboid_3 _domain_f; +protected: + Exact_traits traits_e; + Filtering_traits traits_f; }; +template < typename K, + typename Off = typename CGAL::Periodic_3_offset_3, + bool Has_static_filters = internal::Has_static_filters::value > +class Periodic_3_triangulation_filtered_traits_3; + } //namespace CGAL #include namespace CGAL { -template < typename K, typename Off = typename CGAL::Periodic_3_offset_3, bool Has_static_filters = internal::Has_static_filters::value > -class Periodic_3_triangulation_filtered_traits_3 - : public Periodic_3_triangulation_statically_filtered_traits_3< - Periodic_3_triangulation_filtered_traits_base_3 > { -}; - -template < typename K, typename Off > +template class Periodic_3_triangulation_filtered_traits_3 : public Periodic_3_triangulation_filtered_traits_base_3 -{}; +{ + typedef Periodic_3_triangulation_filtered_traits_base_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_triangulation_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } +}; + +template +class Periodic_3_triangulation_filtered_traits_3 + : public Periodic_3_triangulation_statically_filtered_traits_3 +{ + typedef Periodic_3_triangulation_statically_filtered_traits_3 Base; + +public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + + Periodic_3_triangulation_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } +}; } //namespace CGAL diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_iterators_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_iterators_3.h similarity index 82% rename from Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_iterators_3.h rename to Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_iterators_3.h index 5ca90986dee..0dc42219a27 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_iterators_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_iterators_3.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Monique Teillaud // Manuel Caroli @@ -24,7 +24,6 @@ #include - #include #include #include @@ -49,7 +48,6 @@ class Periodic_3_triangulation_tetrahedron_iterator_3 { // UNIQUE_COVER_DOMAIN. public: - typedef typename T::Periodic_tetrahedron value_type; typedef const typename T::Periodic_tetrahedron * pointer; typedef const typename T::Periodic_tetrahedron & reference; @@ -59,7 +57,7 @@ public: typedef typename T::Periodic_tetrahedron Periodic_tetrahedron; typedef Periodic_3_triangulation_tetrahedron_iterator_3 - Periodic_tetrahedron_iterator; + Periodic_tetrahedron_iterator; typedef typename T::Cell Cell; typedef typename T::Cell_iterator Cell_iterator; @@ -70,17 +68,17 @@ public: : _t(NULL), _it(it), _off(0) {} Periodic_3_triangulation_tetrahedron_iterator_3(const T * t, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->cells_begin()), _it(it), _off(0) { if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) { while (pos != _t->cells_end() && !is_canonical() ) - ++pos; + ++pos; } } // used to initialize the past-the-end iterator Periodic_3_triangulation_tetrahedron_iterator_3(const T* t, int, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->cells_end()), _it(it), _off(0) {} Periodic_tetrahedron_iterator& operator++() { @@ -117,41 +115,41 @@ public: } Periodic_tetrahedron_iterator operator++(int) - { - Periodic_tetrahedron_iterator tmp(*this); - ++(*this); - return tmp; - } + { + Periodic_tetrahedron_iterator tmp(*this); + ++(*this); + return tmp; + } Periodic_tetrahedron_iterator operator--(int) - { - Periodic_tetrahedron_iterator tmp(*this); - --(*this); - return tmp; - } + { + Periodic_tetrahedron_iterator tmp(*this); + --(*this); + return tmp; + } bool operator==(const Periodic_tetrahedron_iterator& ti) const - { - CGAL_triangulation_assertion(_it == ti._it); - return _t == ti._t && pos == ti.pos && _off == ti._off; - } + { + CGAL_triangulation_assertion(_it == ti._it); + return _t == ti._t && pos == ti.pos && _off == ti._off; + } bool operator!=(const Periodic_tetrahedron_iterator& ti) const - { - return !(*this == ti); - } + { + return !(*this == ti); + } reference operator*() const - { - periodic_tetrahedron = construct_periodic_tetrahedron(); - return periodic_tetrahedron; - } + { + periodic_tetrahedron = construct_periodic_tetrahedron(); + return periodic_tetrahedron; + } pointer operator->() const - { - periodic_tetrahedron = construct_periodic_tetrahedron(); - return &periodic_tetrahedron; - } + { + periodic_tetrahedron = construct_periodic_tetrahedron(); + return &periodic_tetrahedron; + } Cell_iterator get_cell() const { @@ -173,7 +171,7 @@ private: // fetch all offsets Offset off0, off1, off2, off3; get_edge_offsets(off0, off1, off2, off3); - + if (_t->number_of_sheets() != make_array(1,1,1)) { // If there is one offset with entries larger than 1 then we are // talking about a vertex that is too far away from the original @@ -210,12 +208,12 @@ private: if (_off == off) { _off = 0; do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN - && pos != _t->cells_end() && !is_canonical()); + && pos != _t->cells_end() && !is_canonical()); } else { do { - ++_off; + ++_off; } while ((((~_off)|off)&7)!=7); // Increment until a valid - // offset has been found + // offset has been found } } @@ -229,32 +227,32 @@ private: } else { int off = get_drawing_offsets(); do { - --_off; + --_off; } while ((((~_off)|off)&7)!=7); // Decrement until a valid - // offset has been found + // offset has been found } } // Get the canonicalized offsets of an edge. // This works in any cover that is encoded in _t->combine_offsets void get_edge_offsets(Offset &off0, Offset &off1, - Offset &off2, Offset &off3) const { + Offset &off2, Offset &off3) const { Offset cell_off0 = _t->int_to_off(pos->offset(0)); Offset cell_off1 = _t->int_to_off(pos->offset(1)); Offset cell_off2 = _t->int_to_off(pos->offset(2)); Offset cell_off3 = _t->int_to_off(pos->offset(3)); - Offset diff_off((cell_off0.x() == 1 - && cell_off1.x() == 1 - && cell_off2.x() == 1 - && cell_off3.x() == 1)?-1:0, - (cell_off0.y() == 1 - && cell_off1.y() == 1 - && cell_off2.y() == 1 - && cell_off3.y() == 1)?-1:0, - (cell_off0.z() == 1 - && cell_off1.z() == 1 - && cell_off2.z() == 1 - && cell_off3.z() == 1)?-1:0); + Offset diff_off((cell_off0.x() == 1 + && cell_off1.x() == 1 + && cell_off2.x() == 1 + && cell_off3.x() == 1)?-1:0, + (cell_off0.y() == 1 + && cell_off1.y() == 1 + && cell_off2.y() == 1 + && cell_off3.y() == 1)?-1:0, + (cell_off0.z() == 1 + && cell_off1.z() == 1 + && cell_off2.z() == 1 + && cell_off3.z() == 1)?-1:0); off0 = _t->combine_offsets(_t->get_offset(pos,0), diff_off); off1 = _t->combine_offsets(_t->get_offset(pos,1), diff_off); off2 = _t->combine_offsets(_t->get_offset(pos,2), diff_off); @@ -293,20 +291,20 @@ private: CGAL_triangulation_assertion(off3.x() == 0 || off3.x() == 1); CGAL_triangulation_assertion(off3.y() == 0 || off3.y() == 1); CGAL_triangulation_assertion(off3.z() == 0 || off3.z() == 1); - - int offx = ( ((off0.x() == 0 && off1.x() == 0 - && off2.x() == 0 && off3.x() == 0) - || (off0.x() == 1 && off1.x() == 1 - && off2.x() == 1 && off3.x() == 1)) ? 0 : 1); - int offy = ( ((off0.y() == 0 && off1.y() == 0 - && off2.y() == 0 && off3.y() == 0) - || (off0.y() == 1 && off1.y() == 1 - && off2.y() == 1 && off3.y() == 1)) ? 0 : 1); - int offz = ( ((off0.z() == 0 && off1.z() == 0 - && off2.z() == 0 && off3.z() == 0) - || (off0.z() == 1 && off1.z() == 1 - && off2.z() == 1 && off3.z() == 1)) ? 0 : 1); - + + int offx = ( ((off0.x() == 0 && off1.x() == 0 + && off2.x() == 0 && off3.x() == 0) + || (off0.x() == 1 && off1.x() == 1 + && off2.x() == 1 && off3.x() == 1)) ? 0 : 1); + int offy = ( ((off0.y() == 0 && off1.y() == 0 + && off2.y() == 0 && off3.y() == 0) + || (off0.y() == 1 && off1.y() == 1 + && off2.y() == 1 && off3.y() == 1)) ? 0 : 1); + int offz = ( ((off0.z() == 0 && off1.z() == 0 + && off2.z() == 0 && off3.z() == 0) + || (off0.z() == 1 && off1.z() == 1 + && off2.z() == 1 && off3.z() == 1)) ? 0 : 1); + return( 4*offx + 2*offy + offz ); } @@ -315,8 +313,8 @@ private: Offset off0, off1, off2, off3; get_edge_offsets(off0, off1, off2, off3); Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0), - (((_off>>1)&1)==1 ? -1:0), - (( _off &1)==1 ? -1:0)); + (((_off>>1)&1)==1 ? -1:0), + (( _off &1)==1 ? -1:0)); if (_it == T::STORED_COVER_DOMAIN) { off0 = _t->combine_offsets(off0,transl_off); off1 = _t->combine_offsets(off1,transl_off); @@ -330,10 +328,10 @@ private: off3 += transl_off; } return make_array( - std::make_pair(pos->vertex(0)->point(),off0), - std::make_pair(pos->vertex(1)->point(),off1), - std::make_pair(pos->vertex(2)->point(),off2), - std::make_pair(pos->vertex(3)->point(),off3)); + std::make_pair(pos->vertex(0)->point(),off0), + std::make_pair(pos->vertex(1)->point(),off1), + std::make_pair(pos->vertex(2)->point(),off2), + std::make_pair(pos->vertex(3)->point(),off3)); } }; @@ -365,7 +363,7 @@ public: typedef typename T::Periodic_triangle Periodic_triangle; typedef Periodic_3_triangulation_triangle_iterator_3 - Periodic_triangle_iterator; + Periodic_triangle_iterator; typedef typename T::Facet Facet; typedef typename T::Facet_iterator Facet_iterator; @@ -376,17 +374,17 @@ public: : _t(NULL), _it(it), _off(0) {} Periodic_3_triangulation_triangle_iterator_3(const T * t, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->facets_begin()), _it(it), _off(0) { if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) { while (pos != _t->facets_end() && !is_canonical() ) - ++pos; + ++pos; } } // used to initialize the past-the-end iterator Periodic_3_triangulation_triangle_iterator_3(const T* t, int, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->facets_end()), _it(it), _off(0) {} Periodic_triangle_iterator& operator++() { @@ -423,41 +421,41 @@ public: } Periodic_triangle_iterator operator++(int) - { - Periodic_triangle_iterator tmp(*this); - ++(*this); - return tmp; - } + { + Periodic_triangle_iterator tmp(*this); + ++(*this); + return tmp; + } Periodic_triangle_iterator operator--(int) - { - Periodic_triangle_iterator tmp(*this); - --(*this); - return tmp; - } + { + Periodic_triangle_iterator tmp(*this); + --(*this); + return tmp; + } bool operator==(const Periodic_triangle_iterator& ti) const - { - CGAL_triangulation_assertion(_it == ti._it); - return _t == ti._t && pos == ti.pos && _off == ti._off; - } + { + CGAL_triangulation_assertion(_it == ti._it); + return _t == ti._t && pos == ti.pos && _off == ti._off; + } bool operator!=(const Periodic_triangle_iterator& ti) const - { - return !(*this == ti); - } + { + return !(*this == ti); + } reference operator*() const - { - periodic_triangle = construct_periodic_triangle(); - return periodic_triangle; - } + { + periodic_triangle = construct_periodic_triangle(); + return periodic_triangle; + } pointer operator->() const - { - periodic_triangle = construct_periodic_triangle(); - return &periodic_triangle; - } + { + periodic_triangle = construct_periodic_triangle(); + return &periodic_triangle; + } Facet_iterator get_facet() const { @@ -479,7 +477,7 @@ private: // fetch all offsets Offset off0, off1, off2; get_edge_offsets(off0, off1, off2); - + if (_t->number_of_sheets() != make_array(1,1,1)) { // If there is one offset with entries larger than 1 then we are // talking about a vertex that is too far away from the original @@ -513,12 +511,12 @@ private: if (_off == off) { _off = 0; do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN - && pos != _t->facets_end() && !is_canonical()); + && pos != _t->facets_end() && !is_canonical()); } else { do { - ++_off; + ++_off; } while ((((~_off)|off)&7)!=7); // Increment until a valid - // offset has been found + // offset has been found } } @@ -532,9 +530,9 @@ private: } else { int off = get_drawing_offsets(); do { - --_off; + --_off; } while ((((~_off)|off)&7)!=7); // Decrement until a valid - // offset has been found + // offset has been found } } @@ -544,24 +542,24 @@ private: Offset cell_off0 = _t->int_to_off(pos->first->offset((pos->second+1)&3)); Offset cell_off1 = _t->int_to_off(pos->first->offset((pos->second+2)&3)); Offset cell_off2 = _t->int_to_off(pos->first->offset((pos->second+3)&3)); - Offset diff_off((cell_off0.x() == 1 - && cell_off1.x() == 1 - && cell_off2.x() == 1)?-1:0, - (cell_off0.y() == 1 - && cell_off1.y() == 1 - && cell_off2.y() == 1)?-1:0, - (cell_off0.z() == 1 - && cell_off1.z() == 1 - && cell_off2.z() == 1)?-1:0); + Offset diff_off((cell_off0.x() == 1 + && cell_off1.x() == 1 + && cell_off2.x() == 1)?-1:0, + (cell_off0.y() == 1 + && cell_off1.y() == 1 + && cell_off2.y() == 1)?-1:0, + (cell_off0.z() == 1 + && cell_off1.z() == 1 + && cell_off2.z() == 1)?-1:0); off0 = _t->combine_offsets(_t->get_offset(pos->first, - (pos->second+1)&3), - diff_off); + (pos->second+1)&3), + diff_off); off1 = _t->combine_offsets(_t->get_offset(pos->first, - (pos->second+2)&3), - diff_off); + (pos->second+2)&3), + diff_off); off2 = _t->combine_offsets(_t->get_offset(pos->first, - (pos->second+3)&3), - diff_off); + (pos->second+3)&3), + diff_off); } // return an integer that encodes the translations which have to be @@ -592,14 +590,14 @@ private: CGAL_triangulation_assertion(off2.x() == 0 || off2.x() == 1); CGAL_triangulation_assertion(off2.y() == 0 || off2.y() == 1); CGAL_triangulation_assertion(off2.z() == 0 || off2.z() == 1); - + int offx = ( ((off0.x() == 0 && off1.x() == 0 && off2.x() == 0) - || (off0.x() == 1 && off1.x() == 1 && off2.x() == 1)) ? 0 : 1); + || (off0.x() == 1 && off1.x() == 1 && off2.x() == 1)) ? 0 : 1); int offy = ( ((off0.y() == 0 && off1.y() == 0 && off2.y() == 0) - || (off0.y() == 1 && off1.y() == 1 && off2.y() == 1)) ? 0 : 1); + || (off0.y() == 1 && off1.y() == 1 && off2.y() == 1)) ? 0 : 1); int offz = ( ((off0.z() == 0 && off1.z() == 0 && off2.z() == 0) - || (off0.z() == 1 && off1.z() == 1 && off2.z() == 1)) ? 0 : 1); - + || (off0.z() == 1 && off1.z() == 1 && off2.z() == 1)) ? 0 : 1); + return( 4*offx + 2*offy + offz ); } @@ -608,8 +606,8 @@ private: Offset off0, off1, off2; get_edge_offsets(off0, off1, off2); Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0), - (((_off>>1)&1)==1 ? -1:0), - (( _off &1)==1 ? -1:0)); + (((_off>>1)&1)==1 ? -1:0), + (( _off &1)==1 ? -1:0)); if (_it == T::STORED_COVER_DOMAIN) { off0 = _t->combine_offsets(off0,transl_off); off1 = _t->combine_offsets(off1,transl_off); @@ -621,9 +619,9 @@ private: off2 += transl_off; } return make_array( - std::make_pair(pos->first->vertex((pos->second+1)&3)->point(),off0), - std::make_pair(pos->first->vertex((pos->second+2)&3)->point(),off1), - std::make_pair(pos->first->vertex((pos->second+3)&3)->point(),off2)); + std::make_pair(pos->first->vertex((pos->second+1)&3)->point(),off0), + std::make_pair(pos->first->vertex((pos->second+2)&3)->point(),off1), + std::make_pair(pos->first->vertex((pos->second+3)&3)->point(),off2)); } }; @@ -655,7 +653,7 @@ public: typedef typename T::Periodic_segment Periodic_segment; typedef Periodic_3_triangulation_segment_iterator_3 - Periodic_segment_iterator; + Periodic_segment_iterator; typedef typename T::Edge Edge; typedef typename T::Edge_iterator Edge_iterator; @@ -666,17 +664,17 @@ public: : _t(NULL), _it(it), _off(0) {} Periodic_3_triangulation_segment_iterator_3(const T * t, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->edges_begin()), _it(it), _off(0) { if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) { while (pos != _t->edges_end() && !is_canonical() ) - ++pos; + ++pos; } } // used to initialize the past-the-end iterator Periodic_3_triangulation_segment_iterator_3(const T* t, int, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->edges_end()), _it(it), _off(0) {} Periodic_segment_iterator& operator++() { @@ -713,41 +711,41 @@ public: } Periodic_segment_iterator operator++(int) - { - Periodic_segment_iterator tmp(*this); - ++(*this); - return tmp; - } + { + Periodic_segment_iterator tmp(*this); + ++(*this); + return tmp; + } Periodic_segment_iterator operator--(int) - { - Periodic_segment_iterator tmp(*this); - --(*this); - return tmp; - } + { + Periodic_segment_iterator tmp(*this); + --(*this); + return tmp; + } bool operator==(const Periodic_segment_iterator& ti) const - { - CGAL_triangulation_assertion(_it == ti._it); - return _t == ti._t && pos == ti.pos && _off == ti._off; - } + { + CGAL_triangulation_assertion(_it == ti._it); + return _t == ti._t && pos == ti.pos && _off == ti._off; + } bool operator!=(const Periodic_segment_iterator& ti) const - { - return !(*this == ti); - } + { + return !(*this == ti); + } reference operator*() const - { - periodic_segment = construct_periodic_segment(); - return periodic_segment; - } + { + periodic_segment = construct_periodic_segment(); + return periodic_segment; + } pointer operator->() const - { - periodic_segment = construct_periodic_segment(); - return &periodic_segment; - } + { + periodic_segment = construct_periodic_segment(); + return &periodic_segment; + } Edge_iterator get_edge() const { @@ -768,7 +766,7 @@ private: // fetch all offsets Offset off0, off1; get_edge_offsets(off0, off1); - + if (_t->number_of_sheets() != make_array(1,1,1)) { // If there is one offset with entries larger than 1 then we are // talking about a vertex that is too far away from the original @@ -799,12 +797,12 @@ private: if (_off == off) { _off = 0; do { ++pos; } while (_it == T::UNIQUE_COVER_DOMAIN - && pos != _t->edges_end() && !is_canonical()); + && pos != _t->edges_end() && !is_canonical()); } else { do { - ++_off; + ++_off; } while ((((~_off)|off)&7)!=7); // Increment until a valid - // offset has been found + // offset has been found } } @@ -818,9 +816,9 @@ private: } else { int off = get_drawing_offsets(); do { - --_off; + --_off; } while ((((~_off)|off)&7)!=7); // Decrement until a valid - // offset has been found + // offset has been found } } @@ -830,12 +828,12 @@ private: Offset cell_off0 = _t->int_to_off(pos->first->offset(pos->second)); Offset cell_off1 = _t->int_to_off(pos->first->offset(pos->third)); Offset diff_off((cell_off0.x()==1 && cell_off1.x()==1)?-1:0, - (cell_off0.y()==1 && cell_off1.y()==1)?-1:0, - (cell_off0.z()==1 && cell_off1.z()==1)?-1:0); + (cell_off0.y()==1 && cell_off1.y()==1)?-1:0, + (cell_off0.z()==1 && cell_off1.z()==1)?-1:0); off0 = _t->combine_offsets(_t->get_offset(pos->first,pos->second), - diff_off); + diff_off); off1 = _t->combine_offsets(_t->get_offset(pos->first,pos->third), - diff_off); + diff_off); } // return an integer that encodes the translations which have to be @@ -856,14 +854,14 @@ private: off1 = _t->int_to_off(pos->first->offset(pos->third)); } Offset diff_off = off0 - off1; - + CGAL_triangulation_assertion(diff_off.x() >= -1 || diff_off.x() <= 1); CGAL_triangulation_assertion(diff_off.y() >= -1 || diff_off.y() <= 1); CGAL_triangulation_assertion(diff_off.z() >= -1 || diff_off.z() <= 1); return( 4*(diff_off.x() == 0 ? 0:1) - + 2*(diff_off.y() == 0 ? 0:1) - + (diff_off.z() == 0 ? 0:1) ); + + 2*(diff_off.y() == 0 ? 0:1) + + (diff_off.z() == 0 ? 0:1) ); } Periodic_segment construct_periodic_segment() const { @@ -871,8 +869,8 @@ private: Offset off0, off1; get_edge_offsets(off0, off1); Offset transl_off = Offset((((_off>>2)&1)==1 ? -1:0), - (((_off>>1)&1)==1 ? -1:0), - (( _off &1)==1 ? -1:0)); + (((_off>>1)&1)==1 ? -1:0), + (( _off &1)==1 ? -1:0)); if (_it == T::STORED_COVER_DOMAIN) { off0 = _t->combine_offsets(off0,transl_off); off1 = _t->combine_offsets(off1,transl_off); @@ -882,8 +880,8 @@ private: off1 += transl_off; } return make_array( - std::make_pair(pos->first->vertex(pos->second)->point(),off0), - std::make_pair(pos->first->vertex(pos->third)->point(),off1)); + std::make_pair(pos->first->vertex(pos->second)->point(),off0), + std::make_pair(pos->first->vertex(pos->third)->point(),off1)); } }; @@ -925,17 +923,17 @@ public: : _t(NULL), _it(it) {} Periodic_3_triangulation_point_iterator_3(const T * t, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->vertices_begin()), _it(it) { if (_it == T::UNIQUE || _it == T::UNIQUE_COVER_DOMAIN) { while (pos != _t->vertices_end() && !is_canonical() ) - ++pos; + ++pos; } } // used to initialize the past-the-end iterator Periodic_3_triangulation_point_iterator_3(const T* t, int, - Iterator_type it = T::STORED) + Iterator_type it = T::STORED) : _t(t), pos(_t->vertices_end()), _it(it) {} Periodic_point_iterator& operator++() { @@ -976,37 +974,37 @@ public: ++(*this); return tmp; } - + Periodic_point_iterator operator--(int) { Periodic_point_iterator tmp(*this); --(*this); return tmp; } - + bool operator==(const Periodic_point_iterator& pi) const { CGAL_triangulation_assertion(_it == pi._it); return _t == pi._t && pos == pi.pos; } - + bool operator!=(const Periodic_point_iterator& pi) const { return !(*this == pi); } - + reference operator*() const { periodic_point = construct_periodic_point(); return periodic_point; } - + pointer operator->() const { periodic_point = construct_periodic_point(); return &periodic_point; } - + Vertex_iterator get_vertex() const { return pos; @@ -1034,7 +1032,7 @@ private: }; template -class Domain_tester { +class Domain_tester { const T *t; public: diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h index e784554809e..d27a25ee996 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_triangulation_statically_filtered_traits_3.h @@ -12,53 +12,41 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ -// -// // Author(s) : Sylvain Pion // Manuel Caroli - + #ifndef CGAL_PERIODIC_3_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H #define CGAL_PERIODIC_3_TRIANGULATION_STATICALLY_FILTERED_TRAITS_3_H #include - -// This class gathers optimized predicates written by hand, using -// a few steps of filtering. It should work if the initial traits has -// cartesian coordinates which fit exactly in doubles. -// -// Purely static filters code has been removed, since it requires additional -// logic and is not plug'n play (requires users providing bounds). -// If it should be provided again, it should probably be separate. - -#include - -#include -#include - -#include #include - -// TODO : -// - add more predicates : +#include namespace CGAL { -// The K_base argument is supposed to provide exact primitives. -template < typename Traits > -class Periodic_3_triangulation_statically_filtered_traits_3 : public Traits +template< typename K, + typename Off = typename CGAL::Periodic_3_offset_3> +class Periodic_3_triangulation_statically_filtered_traits_3 + : public Periodic_3_triangulation_filtered_traits_base_3 { - typedef Periodic_3_triangulation_statically_filtered_traits_3 Self; + typedef Periodic_3_triangulation_statically_filtered_traits_3 Self; + typedef Periodic_3_triangulation_filtered_traits_base_3 Base; public: + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - typedef internal::Static_filters_predicates::Periodic_3_orientation_3 - Orientation_3; + Periodic_3_triangulation_statically_filtered_traits_3(const Iso_cuboid_3& domain, + const K& k) + : Base(domain, k) + { } + + typedef internal::Static_filters_predicates::Periodic_3_orientation_3< + K, typename Base::Orientation_3> Orientation_3; Orientation_3 orientation_3_object() const { - return Orientation_3(&this->_domain,&this->_domain_e,&this->_domain_f); + return Orientation_3(&this->_domain, + this->Base::orientation_3_object()); } }; diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h index a2e8eeb4154..1202e432387 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_orientation_3.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Sylvain Pion // Manuel Caroli @@ -24,7 +24,6 @@ #include - #include #include #include @@ -35,17 +34,21 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates { -template < typename K_base > +template < class K, class Orientation_3_base > class Periodic_3_orientation_3 - : public K_base::Orientation_3 + : public Orientation_3_base { - typedef typename K_base::Orientation_3 Base; - typedef typename K_base::FT FT; - typedef typename K_base::Point_3 Point_3; - typedef typename K_base::Vector_3 Vector_3; - typedef typename K_base::Iso_cuboid_3 Iso_cuboid_3; - typedef typename K_base::Sphere_3 Sphere_3; - typedef CGAL::Periodic_3_offset_3 Offset; + typedef Orientation_3_base Base; + +public: + typedef K Kernel; + + typedef typename K::FT FT; + typedef typename K::Point_3 Point_3; + typedef typename K::Vector_3 Vector_3; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; + typedef typename K::Sphere_3 Sphere_3; + typedef CGAL::Periodic_3_offset_3 Offset; public: const Iso_cuboid_3 * const _dom; @@ -53,30 +56,30 @@ public: public: typedef typename Base::result_type result_type; - template Periodic_3_orientation_3(const Iso_cuboid_3 * const dom, - const EX * dom_e, const AP * dom_f) : Base(dom_e,dom_f), _dom(dom) { - } + const Orientation_3_base& o3b) + : Base(o3b), _dom(dom) + { } #ifndef CGAL_CFG_MATCHING_BUG_6 using Base::operator(); -#else +#else result_type operator()(const Vector_3& u, const Vector_3& v, const Vector_3& w) const - { + { return Base::operator()(u,v,w); - } + } result_type operator()(const Sphere_3& s) const - { + { return Base::operator()(s); } #endif - result_type + result_type operator()(const Point_3 &p, const Point_3 &q, - const Point_3 &r, const Point_3 &s) const + const Point_3 &r, const Point_3 &s) const { CGAL_PROFILER("Periodic_3_orientation_3 calls"); Get_approx get_approx; // Identity functor for all points @@ -119,17 +122,37 @@ public: double aprz = CGAL::abs(prz); double apsz = CGAL::abs(psz); +#ifdef CGAL_USE_SSE2_MAX + CGAL::Max mmax; + + maxx = mmax(maxx, aprx, apsx); + maxy = mmax(maxy, apry, apsy); + maxz = mmax(maxz, aprz, apsz); +#else if (maxx < aprx) maxx = aprx; if (maxx < apsx) maxx = apsx; if (maxy < apry) maxy = apry; if (maxy < apsy) maxy = apsy; if (maxz < aprz) maxz = aprz; if (maxz < apsz) maxz = apsz; - double eps = 5.1107127829973299e-15 * maxx * maxy * maxz; +#endif + double det = CGAL::determinant(pqx, pqy, pqz, prx, pry, prz, psx, psy, psz); + double eps = 5.1107127829973299e-15 * maxx * maxy * maxz; + +#ifdef CGAL_USE_SSE2_MAX + /* + CGAL::Min mmin; + double tmp = mmin(maxx, maxy, maxz); + maxz = mmax(maxx, maxy, maxz); + maxx = tmp; + */ + sse2minmax(maxx,maxy,maxz); + // maxy can contain ANY element +#else // Sort maxx < maxy < maxz. if (maxx > maxz) std::swap(maxx, maxz); @@ -137,6 +160,7 @@ public: std::swap(maxy, maxz); else if (maxy < maxx) std::swap(maxx, maxy); +#endif // Protect against underflow in the computation of eps. if (maxx < 1e-97) /* cbrt(min_double/eps) */ { @@ -157,10 +181,10 @@ public: result_type operator()(const Point_3 &p, const Point_3 &q, - const Point_3 &r, const Point_3 &s, - const Offset &o_p, const Offset &o_q, - const Offset &o_r, const Offset &o_s) const { - + const Point_3 &r, const Point_3 &s, + const Offset &o_p, const Offset &o_q, + const Offset &o_r, const Offset &o_s) const + { CGAL_PROFILER("Periodic_3_orientation_3 calls"); Get_approx get_approx; // Identity functor for all points // but lazy points. @@ -180,18 +204,18 @@ public: fit_in_double(get_approx(r).z(), rz) && fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) && fit_in_double(get_approx(s).z(), sz) && - fit_in_double(_dom->xmax(), domxmax) && - fit_in_double(_dom->xmin(), domxmin) && - fit_in_double(_dom->ymax(), domymax) && - fit_in_double(_dom->ymin(), domymin) && - fit_in_double(_dom->zmax(), domzmax) && - fit_in_double(_dom->zmin(), domzmin)) + fit_in_double(_dom->xmax(), domxmax) && + fit_in_double(_dom->xmin(), domxmin) && + fit_in_double(_dom->ymax(), domymax) && + fit_in_double(_dom->ymin(), domymin) && + fit_in_double(_dom->zmax(), domzmax) && + fit_in_double(_dom->zmin(), domzmin)) { CGAL_PROFILER("Periodic_3_orientation_3 semi-static attempts"); - double domx = domxmax - domxmin; - double domy = domymax - domymin; - double domz = domzmax - domzmin; + double domx = domxmax - domxmin; + double domy = domymax - domymin; + double domz = domzmax - domzmin; double pqx = qx - px + domx * ( o_q.x() - opx ); double pqy = qy - py + domy * ( o_q.y() - opy ); @@ -216,6 +240,12 @@ public: double apsy = CGAL::abs(psy); double apsz = CGAL::abs(psz); +#ifdef CGAL_USE_SSE2_MAX + CGAL::Max mmax; + maxx = mmax(maxx, aqtx, artx, astx); + maxy = mmax(maxy, aqty, arty, asty); + maxz = mmax(maxz, aqtz, artz, astz); +#else if (maxx < aprx) maxx = aprx; if (maxx < apsx) maxx = apsx; @@ -224,11 +254,23 @@ public: if (maxz < aprz) maxz = aprz; if (maxz < apsz) maxz = apsz; - double eps = 4.111024169857068197e-15 * maxx * maxy * maxz; +#endif double det = CGAL::determinant(pqx, pqy, pqz, prx, pry, prz, psx, psy, psz); + double eps = 4.111024169857068197e-15 * maxx * maxy * maxz; + +#ifdef CGAL_USE_SSE2_MAX + /* + CGAL::Min mmin; + double tmp = mmin(maxx, maxy, maxz); + maxz = mmax(maxx, maxy, maxz); + maxx = tmp; + */ + sse2minmax(maxx,maxy,maxz); + // maxy can contain ANY element +#else // Sort maxx < maxy < maxz. if (maxx > maxz) std::swap(maxx, maxz); @@ -236,6 +278,7 @@ public: std::swap(maxy, maxz); else if (maxy < maxx) std::swap(maxx, maxy); +#endif // Protect against underflow in the computation of eps. if (maxx < 1e-97) /* cbrt(min_double/eps) */ { @@ -264,8 +307,8 @@ public: t1, t1, t1); // Full det double err = det.error(); err += err * 2 * F::ulp(); // Correction due to "eps * maxx * maxy...". - std::cerr << "*** epsilon for Periodic_3_orientation_3 = " << err - << std::endl; + std::cerr << "*** epsilon for Periodic_3_orientation_3 = " << err + << std::endl; return err; } diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_power_side_of_oriented_power_sphere_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_power_side_of_oriented_power_sphere_3.h new file mode 100644 index 00000000000..7abdcbb2458 --- /dev/null +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_power_side_of_oriented_power_sphere_3.h @@ -0,0 +1,54 @@ +// Copyright (c) 2017 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// Author(s) : Mael Rouxel-Labbé + +#ifndef CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_POWER_TEST_3_H +#define CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_POWER_TEST_3_H + +#include + +#include +#include +#include + +#include + +#include + +namespace CGAL { + +namespace internal { + +namespace Static_filters_predicates { + +template +class Periodic_3_power_side_of_oriented_power_sphere_3: + public Power_side_of_oriented_power_sphere_3_base +{ + typedef Power_side_of_oriented_power_sphere_3_base Base; + +public: + typedef K Kernel; + + // @todo +}; + +} // namespace Static_filters_predicates + +} // namespace internal + +} //namespace CGAL + +#endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_POWER_TEST_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h index f3f8a3fd3b4..2bf9796adb5 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Static_filters/Periodic_3_side_of_oriented_sphere_3.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Sylvain Pion // Manuel Caroli @@ -24,23 +24,30 @@ #include - #include #include #include #include -namespace CGAL { namespace internal { namespace Static_filters_predicates { +namespace CGAL { -template < typename K_base > +namespace internal { + +namespace Static_filters_predicates { + +template < class K, class Side_of_oriented_sphere_3_base > class Periodic_3_side_of_oriented_sphere_3 - : public K_base::Side_of_oriented_sphere_3 + : public Side_of_oriented_sphere_3_base { - typedef typename K_base::Side_of_oriented_sphere_3 Base; - typedef typename K_base::FT FT; - typedef typename K_base::Point_3 Point_3; - typedef typename K_base::Iso_cuboid_3 Iso_cuboid_3; + typedef Side_of_oriented_sphere_3_base Base; + +public: + typedef K Kernel; + + typedef typename K::FT FT; + typedef typename K::Point_3 Point_3; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; typedef CGAL::Periodic_3_offset_3 Offset; public: @@ -49,11 +56,9 @@ public: public: typedef typename Base::result_type result_type; - template Periodic_3_side_of_oriented_sphere_3(const Iso_cuboid_3 * dom, - const EX * dom_e, - const AP * dom_f) - : Base(dom_e,dom_f), _dom(dom) { } + const Side_of_oriented_sphere_3_base& sop3) + : Base(sop3), _dom(dom) { } Oriented_side operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, @@ -83,22 +88,22 @@ public: double pty = py - ty; double ptz = pz - tz; double pt2 = CGAL_NTS square(ptx) + CGAL_NTS square(pty) - + CGAL_NTS square(ptz); + + CGAL_NTS square(ptz); double qtx = qx - tx; double qty = qy - ty; double qtz = qz - tz; double qt2 = CGAL_NTS square(qtx) + CGAL_NTS square(qty) - + CGAL_NTS square(qtz); + + CGAL_NTS square(qtz); double rtx = rx - tx; double rty = ry - ty; double rtz = rz - tz; double rt2 = CGAL_NTS square(rtx) + CGAL_NTS square(rty) - + CGAL_NTS square(rtz); + + CGAL_NTS square(rtz); double stx = sx - tx; double sty = sy - ty; double stz = sz - tz; double st2 = CGAL_NTS square(stx) + CGAL_NTS square(sty) - + CGAL_NTS square(stz); + + CGAL_NTS square(stz); // Compute the semi-static bound. double maxx = CGAL::abs(ptx); @@ -116,7 +121,13 @@ public: double astx = CGAL::abs(stx); double asty = CGAL::abs(sty); double astz = CGAL::abs(stz); - + +#ifdef CGAL_USE_SSE2_MAX + CGAL::Max mmax; + maxx = mmax(maxx, aqtx, artx, astx); + maxy = mmax(maxy, aqty, arty, asty); + maxz = mmax(maxz, aqtz, artz, astz); +#else if (maxx < aqtx) maxx = aqtx; if (maxx < artx) maxx = artx; if (maxx < astx) maxx = astx; @@ -128,7 +139,21 @@ public: if (maxz < aqtz) maxz = aqtz; if (maxz < artz) maxz = artz; if (maxz < astz) maxz = astz; +#endif + double eps = 1.2466136531027298e-13 * maxx * maxy * maxz; + +#ifdef CGAL_USE_SSE2_MAX + /* + CGAL::Min mmin; + double tmp = mmin(maxx, maxy, maxz); + maxz = mmax(maxx, maxy, maxz); + maxx = tmp; + */ + sse2minmax(maxx,maxy,maxz); + // maxy can contain ANY element + +#else // Sort maxx < maxy < maxz. if (maxx > maxz) std::swap(maxx, maxz); @@ -136,10 +161,7 @@ public: std::swap(maxy, maxz); else if (maxy < maxx) std::swap(maxx, maxy); - - double eps = 1.2466136531027298e-13 * maxx * maxy * maxz - * (maxz * maxz); - +#endif double det = CGAL::determinant(ptx,pty,ptz,pt2, rtx,rty,rtz,rt2, qtx,qty,qtz,qt2, @@ -152,6 +174,7 @@ public: } // Protect against overflow in the computation of det. else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ { + eps *= (maxz * maxz); if (det > eps) return ON_POSITIVE_SIDE; if (det < -eps) return ON_NEGATIVE_SIDE; } @@ -163,10 +186,10 @@ public: Oriented_side operator()(const Point_3 &p, const Point_3 &q, const Point_3 &r, - const Point_3 &s, const Point_3 &t, const Offset &o_p, - const Offset &o_q, const Offset &o_r, - const Offset &o_s, const Offset &o_t) const { - + const Point_3 &s, const Point_3 &t, + const Offset &o_p, const Offset &o_q, const Offset &o_r, + const Offset &o_s, const Offset &o_t) const + { CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 calls"); Get_approx get_approx; // Identity functor for all points @@ -190,12 +213,12 @@ public: fit_in_double(get_approx(s).z(), sz) && fit_in_double(get_approx(t).x(), tx) && fit_in_double(get_approx(t).y(), ty) && fit_in_double(get_approx(t).z(), tz) && - fit_in_double(_dom->xmax(), domxmax) && - fit_in_double(_dom->xmin(), domxmin) && - fit_in_double(_dom->ymax(), domymax) && - fit_in_double(_dom->ymin(), domymin) && - fit_in_double(_dom->zmax(), domzmax) && - fit_in_double(_dom->zmin(), domzmin)) + fit_in_double(_dom->xmax(), domxmax) && + fit_in_double(_dom->xmin(), domxmin) && + fit_in_double(_dom->ymax(), domymax) && + fit_in_double(_dom->ymin(), domymin) && + fit_in_double(_dom->zmax(), domzmax) && + fit_in_double(_dom->zmin(), domzmin)) { CGAL_PROFILER("Periodic_3_side_of_oriented_sphere_3 semi-static attempts"); @@ -228,7 +251,7 @@ public: double maxx = CGAL::abs(ptx); double maxy = CGAL::abs(pty); double maxz = CGAL::abs(ptz); - + double aqtx = CGAL::abs(qtx); double aqty = CGAL::abs(qty); double aqtz = CGAL::abs(qtz); @@ -240,7 +263,13 @@ public: double astx = CGAL::abs(stx); double asty = CGAL::abs(sty); double astz = CGAL::abs(stz); - + +#ifdef CGAL_USE_SSE2_MAX + CGAL::Max mmax; + maxx = mmax(maxx, aqtx, artx, astx); + maxy = mmax(maxy, aqty, arty, asty); + maxz = mmax(maxz, aqtz, artz, astz); +#else if (maxx < aqtx) maxx = aqtx; if (maxx < artx) maxx = artx; if (maxx < astx) maxx = astx; @@ -252,7 +281,20 @@ public: if (maxz < aqtz) maxz = aqtz; if (maxz < artz) maxz = artz; if (maxz < astz) maxz = astz; +#endif + double eps = 1.0466759304746772485e-13 * maxx * maxy * maxz; + +#ifdef CGAL_USE_SSE2_MAX + /* + CGAL::Min mmin; + double tmp = mmin(maxx, maxy, maxz); + maxz = mmax(maxx, maxy, maxz); + maxx = tmp; + */ + sse2minmax(maxx,maxy,maxz); + // maxy can contain ANY element +#else // Sort maxx < maxy < maxz. if (maxx > maxz) std::swap(maxx, maxz); @@ -260,14 +302,11 @@ public: std::swap(maxy, maxz); else if (maxy < maxx) std::swap(maxx, maxy); - - double eps = 1.0466759304746772485e-13 * maxx * maxy * maxz - * (maxz * maxz); - +#endif double det = CGAL::determinant(ptx,pty,ptz,pt2, - rtx,rty,rtz,rt2, - qtx,qty,qtz,qt2, - stx,sty,stz,st2); + rtx,rty,rtz,rt2, + qtx,qty,qtz,qt2, + stx,sty,stz,st2); // Protect against underflow in the computation of eps. if (maxx < 1e-58) /* sqrt^5(min_double/eps) */ { @@ -276,6 +315,7 @@ public: } // Protect against overflow in the computation of det. else if (maxz < 1e61) /* sqrt^5(max_double/4 [hadamard]) */ { + eps *= (maxz * maxz); if (det > eps) return ON_POSITIVE_SIDE; if (det < -eps) return ON_NEGATIVE_SIDE; } @@ -299,11 +339,15 @@ public: err += err * 3 * F::ulp(); // Correction due to "eps * maxx * ...". std::cerr << "*** epsilon for Periodic_3_side_of_oriented_sphere_3 = " - << err << std::endl; + << err << std::endl; return err; } }; -} } } // namespace CGAL::internal::Static_filters_predicates +} // namespace Static_filters_predicates + +} // namespace internal + +} // namespace CGAL #endif // CGAL_INTERNAL_STATIC_FILTERS_PERIODIC_3_SIDE_OF_ORIENTED_SPHERE_3_H diff --git a/Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h b/Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h index a19081ba0d3..50102cec7f2 100644 --- a/Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h +++ b/Periodic_3_triangulation_3/include/CGAL/periodic_3_triangulation_3_io.h @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Manuel Caroli @@ -23,9 +23,10 @@ #include - #include + #include +#include template Stream &write_triangulation_to_off(Stream &out, Triangulation &t) { @@ -51,26 +52,26 @@ Stream &write_triangulation_to_off(Stream &out, Triangulation &t) { if (t.number_of_sheets() == CGAL::make_array(1,1,1)) { for (typename Triangulation::Cell_iterator it = t.cells_begin(); - it != t.cells_end(); it++) { + it != t.cells_end(); it++) { for (int i=0; i<4; i++) { - Point p = t.point(t.periodic_point(it,i)); - out << p.x() << " " - << p.y() << " " - << p.z() << std::endl; + Point p = t.point(t.periodic_point(it,i)); + out << p.x() << " " + << p.y() << " " + << p.z() << std::endl; } } } else { for (typename Triangulation::Cell_iterator it = t.cells_begin(); - it != t.cells_end(); it++) { + it != t.cells_end(); it++) { for (int i=0; i<4; i++) { - typename Triangulation::Vertex_handle vh; - typename Triangulation::Offset off; - t.get_vertex(it, i, vh, off); - Point p = t.point(t.periodic_point(it, i)); - - out << p.x() << " " - << p.y() << " " - << p.z() << std::endl; + typename Triangulation::Vertex_handle vh; + typename Triangulation::Offset off; + t.get_vertex(it, i, vh, off); + Point p = t.point(t.periodic_point(it, i)); + + out << p.x() << " " + << p.y() << " " + << p.z() << std::endl; } } } @@ -93,7 +94,7 @@ Stream &write_triangulation_to_off(Stream &out, Triangulation &t) { template Stream &write_cells_to_off(Stream &out, Triangulation &t, int number_of_cells, - Cell_iterator cit, Cell_iterator cells_end) { + Cell_iterator cit, Cell_iterator cells_end) { typedef typename Triangulation::Point Point; out << "OFF " << "\n" << 4*number_of_cells @@ -119,26 +120,18 @@ Stream &write_cells_to_off(Stream &out, Triangulation &t, int number_of_cells, return out; } -#if 0 -//TODO: rewrite this to wrap the stream coming from draw_dual -template -Stream& draw_dual_to_off(Stream &os) { - os << "OFF " << "\n" - << 2*number_of_facets() << " " - << number_of_facets() << " 0" << std::endl; - for (Facet_iterator fit = facets_begin(), end = facets_end(); - fit != end; ++fit) { - if (!is_canonical(*fit)) continue; - std::pair pso = dual(*fit); - os << pso.first.source() << std::endl - << pso.first.target() - pso.second<< std::endl; - } - CGAL_triangulation_assertion( i==number_of_facets()); - for(unsigned int i=0 ; i < number_of_facets() ; i++) { - os << "2 " << i*2 << " " << i*2+1 << std::endl; +template +Stream& draw_dual_to_off(Stream &os, Triangulation &t) { + os << "OFF " << "\n" + << 2*t.number_of_facets() << " " + << t.number_of_facets() << " 0" << std::endl; + + t.draw_dual(os); + + for(unsigned int i=0; i < t.number_of_facets(); i++) { + os << "3 " << i*2 << " " << i*2+1 << " " << i*2 << std::endl; } return os; } -#endif #endif //CGAL_PERIODIC_3_TRIANGULATION_3_IO_H diff --git a/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/copyright b/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/copyright index 8932b3233d2..63fa19c7109 100644 --- a/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/copyright +++ b/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/copyright @@ -1,2 +1,2 @@ -INRIA Sophia-Antipolis (France) +INRIA Sophia Antipolis (France) diff --git a/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/maintainer b/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/maintainer index 4bb86a6f847..94e7b8a1378 100644 --- a/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/maintainer +++ b/Periodic_3_triangulation_3/package_info/Periodic_3_triangulation_3/maintainer @@ -1,2 +1 @@ -Manuel Caroli -Monique Teillaud +Monique Teillaud diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt index 9b4605973a5..22aafb7326f 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/CMakeLists.txt @@ -6,7 +6,9 @@ project( Periodic_3_triangulation_3_Tests ) cmake_minimum_required(VERSION 2.8.10) -find_package(CGAL QUIET COMPONENTS Core) +set(CMAKE_CXX_STANDARD 14) + +find_package(CGAL QUIET COMPONENTS Core ) if ( CGAL_FOUND ) @@ -18,11 +20,20 @@ if ( CGAL_FOUND ) include_directories (BEFORE "include") - # create a target per cppfile - file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) - foreach(cppfile ${cppfiles}) - create_single_source_cgal_program( "${cppfile}" ) - endforeach() + create_single_source_cgal_program( "test_p3rt3_as_p3t3.cpp" ) + create_single_source_cgal_program( "test_p3rt3_insert_remove_point_set.cpp" ) + create_single_source_cgal_program( "test_periodic_3_alpha_shape_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_delaunay_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_delaunay_hierarchy_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_offset_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_regular_triangulation_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_regular_triangulation_traits_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_triangulation_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_triangulation_tds.cpp" ) + create_single_source_cgal_program( "test_periodic_3_triangulation_traits_C_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_triangulation_traits_H_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_triangulation_traits_SC_3.cpp" ) + create_single_source_cgal_program( "test_periodic_3_triangulation_traits_SH_3.cpp" ) else() diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_circulator.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_circulator.h index d11159e8051..6f31203add1 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_circulator.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_circulator.h @@ -22,29 +22,32 @@ #ifndef CGAL_TEST_CLS_CIRCULATOR_C #define CGAL_TEST_CLS_CIRCULATOR_C +#include + #include +#include +#include +#include template < class Triangulation > int _test_circulator( const Triangulation &T ) { typedef typename Triangulation::Edge_iterator Edge_iterator; - typedef typename Triangulation::Facet_circulator Facet_circulator; typedef typename Triangulation::Cell_circulator Cell_circulator; - typedef typename Triangulation::Vertex_handle Vertex_handle; - typedef typename Triangulation::Cell_handle Cell_handle; typedef typename Triangulation::Facet Facet; + typedef typename Triangulation::Cell_handle Cell_handle; int n = 0; Cell_circulator cc, cc0; Edge_iterator eit, eit2; // testing incident_cells(edge *); -// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) - eit=T.edges_begin(); + // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) + eit = T.edges_begin(); { cc0=cc=T.incident_cells(*eit); @@ -63,14 +66,14 @@ _test_circulator( const Triangulation &T ) eit=T.edges_begin(); { cc0=cc=T.incident_cells(eit->first, eit->second, eit->third); - do { - assert(cc->has_vertex(eit->first->vertex(eit->second))); - assert(cc->has_vertex(eit->first->vertex(eit->third))); - cc--; n++; - } while (cc != cc0); - } + do { + assert(cc->has_vertex(eit->first->vertex(eit->second))); + assert(cc->has_vertex(eit->first->vertex(eit->third))); + cc--; n++; + } while (cc != cc0); + } // testing incident_cells(edge *,cell *); and ++ -// for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) + // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) eit=T.edges_begin(); { cc0=cc=T.incident_cells(*eit, eit->first); @@ -84,15 +87,16 @@ _test_circulator( const Triangulation &T ) eit=T.edges_begin(); { cc0=cc=T.incident_cells(eit->first, eit->second, eit->third, - eit->first); - do { - assert(cc->has_vertex(eit->first->vertex(eit->second))); - assert(cc->has_vertex(eit->first->vertex(eit->third))); - cc--; n++; - } while (cc != cc0); - } - // the following is not useful here, it tests iterators more than - // circulators + eit->first); + do { + assert(cc->has_vertex(eit->first->vertex(eit->second))); + assert(cc->has_vertex(eit->first->vertex(eit->third))); + cc--; n++; + } while (cc != cc0); + } + +// the following is not useful here, it tests iterators more than +// circulators // for (eit=T.finite_edges_begin(); eit!=T.edges_end(); eit++) // { // cc0=cc=T.incident_cells(*eit); @@ -131,92 +135,92 @@ _test_circulator( const Triangulation &T ) assert( fit->second != (fit->first)->index(vh) ); } - Facet_circulator fc, fc0, fc1; - assert(fc1 == 0); - int i,j; - // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) - eit=T.edges_begin(); // test (edge) - { - fc0=fc=T.incident_facets(*eit); - do { - assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); - assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); - assert(fc->second == T.next_around_edge(i, j) ); - fc++; n++; - } while (fc != fc0); - } - // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) - eit=T.edges_begin(); // test (cell*,int,int) - { - fc0=fc=T.incident_facets(eit->first, eit->second, eit->third); - do { - assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); - assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); - assert(fc->second == T.next_around_edge(i, j) ); - fc--; n++; - } while (fc != fc0); - } -// int fi; - // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) - eit=T.edges_begin(); // test (edge, Cell*,int) - { -// for (fi=0; fi!=4 ; fi++) -// { -// if (t.dimension()==2) {fi=3;} - fc0=fc=T.incident_facets(*eit, eit->first, - T.next_around_edge(eit->second, eit->third)); - do { - assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); - assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); - assert(fc->second == T.next_around_edge(i, j) ); - fc++; n++; - } while (fc != fc0); -// } - } - // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) - eit=T.edges_begin(); // test (Cell*,int,int,cell*,int) - { - fc0=fc=T.incident_facets(eit->first, eit->second, eit->third, - eit->first, - T.next_around_edge(eit->second, eit->third)); - do { - assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); - assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); - assert(fc->second == T.next_around_edge(i, j) ); - fc--; n++; - } while (fc != fc0); - } + Facet_circulator fc, fc0, fc1; + assert(fc1 == 0); + int i,j; + // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) + eit=T.edges_begin(); // test (edge) + { + fc0=fc=T.incident_facets(*eit); + do { + assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); + assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); + assert(fc->second == T.next_around_edge(i, j) ); + fc++; n++; + } while (fc != fc0); + } + // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) + eit=T.edges_begin(); // test (cell*,int,int) + { + fc0=fc=T.incident_facets(eit->first, eit->second, eit->third); + do { + assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); + assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); + assert(fc->second == T.next_around_edge(i, j) ); + fc--; n++; + } while (fc != fc0); + } + // int fi; + // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) + eit=T.edges_begin(); // test (edge, Cell*,int) + { + // for (fi=0; fi!=4 ; fi++) + // { + // if (t.dimension()==2) {fi=3;} + fc0=fc=T.incident_facets(*eit, eit->first, + T.next_around_edge(eit->second, eit->third)); + do { + assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); + assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); + assert(fc->second == T.next_around_edge(i, j) ); + fc++; n++; + } while (fc != fc0); + // } + } + // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) + eit=T.edges_begin(); // test (Cell*,int,int,cell*,int) + { + fc0=fc=T.incident_facets(eit->first, eit->second, eit->third, + eit->first, + T.next_around_edge(eit->second, eit->third)); + do { + assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); + assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); + assert(fc->second == T.next_around_edge(i, j) ); + fc--; n++; + } while (fc != fc0); + } - eit=T.edges_begin(); // test (edge, Facet) - { -// for (fi=0; fi!=4 ; fi++) -// { -// if (t.dimension()==2) {fi=3;} - fc0=fc=T.incident_facets(*eit, std::make_pair( eit->first, - T.next_around_edge(eit->second, - eit->third)) ); - do { - assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); - assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); - assert(fc->second == T.next_around_edge(i, j) ); - fc++; n++; - } while (fc != fc0); -// } - } - // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) - eit=T.edges_begin(); // test (Cell*,int,int,Facet) - { - fc0=fc=T.incident_facets(eit->first, eit->second, eit->third, - std::make_pair( eit->first, - T.next_around_edge(eit->second, - eit->third)) ); - do { - assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); - assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); - assert(fc->second == T.next_around_edge(i, j) ); - fc--; n++; - } while (fc != fc0); - } + eit=T.edges_begin(); // test (edge, Facet) + { + // for (fi=0; fi!=4 ; fi++) + // { + // if (t.dimension()==2) {fi=3;} + fc0=fc=T.incident_facets(*eit, std::make_pair( eit->first, + T.next_around_edge(eit->second, + eit->third)) ); + do { + assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); + assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); + assert(fc->second == T.next_around_edge(i, j) ); + fc++; n++; + } while (fc != fc0); + // } + } + // for (eit=T.edges_begin(); eit!=T.edges_end(); eit++) + eit=T.edges_begin(); // test (Cell*,int,int,Facet) + { + fc0=fc=T.incident_facets(eit->first, eit->second, eit->third, + std::make_pair( eit->first, + T.next_around_edge(eit->second, + eit->third)) ); + do { + assert(fc->first->has_vertex(eit->first->vertex(eit->second), i)); + assert(fc->first->has_vertex(eit->first->vertex(eit->third), j)); + assert(fc->second == T.next_around_edge(i, j) ); + fc--; n++; + } while (fc != fc0); + } return n; } diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_iterator.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_iterator.h index 8d2d514f3ae..f74ed304586 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_iterator.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_iterator.h @@ -265,12 +265,12 @@ _test_triangulation_iterator( const Triangulation &T ) Cell_iterator Cit2; Cit = T.cells_begin(); Cit2=Cit; - assert(T.tetrahedron(T.periodic_tetrahedron(Cit)) - ==T.tetrahedron(T.periodic_tetrahedron(Cit2))); + assert(T.construct_tetrahedron(T.periodic_tetrahedron(Cit)) + == T.construct_tetrahedron(T.periodic_tetrahedron(Cit2))); Cit++ ; Cit-- ; ++Cit ; --Cit ; assert(Cit==Cit2); - assert(T.tetrahedron(T.periodic_tetrahedron(Cit)) - ==T.tetrahedron(T.periodic_tetrahedron(Cit2))); + assert(T.construct_tetrahedron(T.periodic_tetrahedron(Cit)) + == T.construct_tetrahedron(T.periodic_tetrahedron(Cit2))); } { Facet_iterator Fit2; diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_regular_triangulation_traits_3.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_regular_triangulation_traits_3.h new file mode 100644 index 00000000000..604ccbe7714 --- /dev/null +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_regular_triangulation_traits_3.h @@ -0,0 +1,311 @@ +// Copyright (c) 1998, 2015 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// $Date$ +// Author(s) : Aymeric PELLE +// Mael Rouxel-Labbé + +#if (__GNUC__>4) || (__GNUC__ == 4 && __GNUC_MINOR__ >=6) +# pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif + +#include + +#include +#include + +#include +#include + +template +void _test_for_given_domain (const Traits& traits, + typename Traits::Weighted_point_3* wp) +{ + typedef typename Traits::FT FT; + typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Periodic_3_offset_3 Offset; + + CGAL_USE_TYPE(typename Traits::Weighted_point_3); + CGAL_USE_TYPE(typename Traits::Vector_3); + CGAL_USE_TYPE(typename Traits::Iso_cuboid_3); + + CGAL_USE_TYPE(typename Traits::Segment_3); + CGAL_USE_TYPE(typename Traits::Triangle_3); + CGAL_USE_TYPE(typename Traits::Tetrahedron_3); + + CGAL_USE_TYPE(typename Traits::Comparison_result); + CGAL_USE_TYPE(typename Traits::Orientation); + CGAL_USE_TYPE(typename Traits::Oriented_side); + CGAL_USE_TYPE(typename Traits::Bounded_side); + + CGAL_USE_TYPE(typename Traits::Compare_xyz_3); + CGAL_USE_TYPE(typename Traits::Orientation_3); + CGAL_USE_TYPE(typename Traits::Coplanar_orientation_3); + + CGAL_USE_TYPE(typename Traits::Construct_segment_3); + CGAL_USE_TYPE(typename Traits::Construct_triangle_3); + CGAL_USE_TYPE(typename Traits::Construct_tetrahedron_3); + + typedef typename Traits::Construct_point_3 Construct_point_3; + typedef typename Traits::Power_side_of_oriented_power_sphere_3 Power_side_of_oriented_power_sphere_3; + typedef typename Traits::Compare_power_distance_3 Compare_power_distance_3; + typedef typename Traits::Construct_weighted_circumcenter_3 Construct_weighted_circumcenter_3; + typedef typename Traits::Compare_weighted_squared_radius_3 Compare_weighted_squared_radius_3; + typedef typename Traits::Coplanar_orientation_3 Coplanar_orientation_3; + + // Create offset array for tests + Offset o[9] = { Offset(0, 0, 0), + Offset(1, 0, 0), Offset(0, 1, 0), Offset(0, 0, 1), + Offset(1, 1, 0), Offset(1, 0, 1), Offset(0, 1, 1), + Offset(1, 1, 1), Offset(10, 10, 10)}; + + std::cout << "test of Construct_weighted_circumcenter_3" << std::endl; + Construct_weighted_circumcenter_3 weighted_circumcenter = traits.construct_weighted_circumcenter_3_object(); + + std::cout << "test of Compare_power_distance_3" << std::endl; + Compare_power_distance_3 compare_power_distance = traits.compare_power_distance_3_object(); + + { + // basic version + Point_3 c; + c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3]); + assert (compare_power_distance(c,wp[0],wp[1]) == CGAL::EQUAL); + assert (compare_power_distance(c,wp[4],wp[0]) == CGAL::LARGER); + assert (compare_power_distance(c,wp[6],wp[0]) == CGAL::SMALLER); + c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3]); + assert (compare_power_distance(c,wp[4],wp[2]) == CGAL::EQUAL); + c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3]); + assert (compare_power_distance(c,wp[5],wp[3]) == CGAL::EQUAL); + } + { + // uniform (zero) offsets + Point_3 c; + c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3], o[0],o[0],o[0],o[0]); + assert (compare_power_distance(c,wp[0],wp[1], o[0],o[0],o[0]) == CGAL::EQUAL); + assert (compare_power_distance(c,wp[4],wp[0], o[0],o[0],o[0]) == CGAL::LARGER); + assert (compare_power_distance(c,wp[6],wp[0], o[0],o[0],o[0]) == CGAL::SMALLER); + c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3], o[0],o[0],o[0],o[0]); + assert (compare_power_distance(c,wp[4],wp[2], o[0],o[0],o[0]) == CGAL::EQUAL); + c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3], o[0],o[0],o[0],o[0]); + assert (compare_power_distance(c,wp[5],wp[3], o[0],o[0],o[0]) == CGAL::EQUAL); + } + { + // uniform (non-zero) offsets + Point_3 c; + c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3], o[1],o[1],o[1],o[1]); + assert (compare_power_distance(c,wp[0],wp[1], o[0],o[1],o[1]) == CGAL::EQUAL); + assert (compare_power_distance(c,wp[4],wp[0], o[0],o[1],o[1]) == CGAL::LARGER); + assert (compare_power_distance(c,wp[6],wp[0], o[0],o[1],o[1]) == CGAL::SMALLER); + c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3], o[1],o[1],o[1],o[1]); + assert (compare_power_distance(c,wp[4],wp[2], o[0],o[1],o[1]) == CGAL::EQUAL); + c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3], o[1],o[1],o[1],o[1]); + assert (compare_power_distance(c,wp[5],wp[3], o[0],o[1],o[1]) == CGAL::EQUAL); + } + { + // non-uniform offsets + Point_3 c; + c = weighted_circumcenter(wp[0],wp[1],wp[2],wp[3], o[1],o[2],o[3],o[2]); + assert (compare_power_distance(c,wp[0],wp[1], o[0],o[1],o[2]) == CGAL::EQUAL); + assert (compare_power_distance(c,wp[4],wp[0], o[0],o[2],o[2]) == CGAL::LARGER); + assert (compare_power_distance(c,wp[6],wp[0], o[0],o[2],o[2]) == CGAL::SMALLER); + assert (compare_power_distance(c,wp[1],wp[1], o[0],o[2],o[8]) == CGAL::SMALLER); + assert (compare_power_distance(c,wp[1],wp[4], o[5],o[2],o[6]) == CGAL::LARGER); + c = weighted_circumcenter(wp[4],wp[1],wp[2],wp[3], o[4],o[3],o[2],o[1]); + assert (compare_power_distance(c,wp[4],wp[2], o[0],o[4],o[2]) == CGAL::EQUAL); + c = weighted_circumcenter(wp[5],wp[1],wp[2],wp[3], o[2],o[1],o[3],o[1]); + assert (compare_power_distance(c,wp[5],wp[3], o[0],o[2],o[1]) == CGAL::EQUAL); + } + + std::cout << "test of Power_side_of_oriented_power_sphere_3" << std::endl; + Power_side_of_oriented_power_sphere_3 power_test = traits.power_side_of_oriented_power_sphere_3_object(); + { + // Triangulation_3's testsuite will check the base version in detail + assert(power_test(wp[7],wp[8],wp[9],wp[10],wp[11]) == + traits.side_of_oriented_sphere_3_object()( + wp[7].point(),wp[8].point(),wp[9].point(),wp[10].point(),wp[11].point())); + + assert(power_test(wp[8],wp[7],wp[9],wp[10],wp[13]) == + traits.side_of_oriented_sphere_3_object()( + wp[8].point(),wp[7].point(),wp[9].point(),wp[10].point(),wp[13].point())); + + assert(power_test(wp[7],wp[8],wp[9],wp[13]) == + static_cast(traits.coplanar_side_of_bounded_circle_3_object()( + wp[7].point(),wp[8].point(),wp[9].point(),wp[13].point()))); + + // no weight, with offsets + assert(power_test(wp[8],wp[7],wp[9],wp[10],wp[13]) == + power_test(wp[8],wp[7],wp[9],wp[10],wp[13], o[2],o[2],o[2],o[2],o[2])); + assert(power_test(wp[10],wp[9],wp[8],wp[7]) == + power_test(wp[10],wp[9],wp[8],wp[7], o[3],o[3],o[3],o[3])); + assert(power_test(wp[9],wp[11],wp[13]) == + power_test(wp[9],wp[11],wp[13], o[4],o[4],o[4])); + assert(power_test(wp[8],wp[14]) == + power_test(wp[8],wp[14],o[5],o[5])); + + assert(power_test(wp[7],wp[8],wp[9],wp[10],wp[11], o[0],o[0],o[0],o[0],o[0]) == + traits.side_of_oriented_sphere_3_object()( + wp[7].point(),wp[8].point(),wp[9].point(),wp[10].point(),wp[11].point())); + + assert(power_test(wp[9],wp[13],wp[12],wp[8],wp[11],o[4],o[3],o[2],o[1],o[0]) == CGAL::ON_POSITIVE_SIDE); + assert(power_test(wp[7],wp[8],wp[9],wp[13], o[1], o[2], o[3], o[4]) == CGAL::ON_NEGATIVE_SIDE); + assert(power_test(wp[8],wp[11],wp[8],o[1],o[2],o[1]) == CGAL::ON_ORIENTED_BOUNDARY); + + assert(power_test(wp[0],wp[6],o[1],o[1]) == CGAL::ON_POSITIVE_SIDE); + assert(power_test(wp[0],wp[5],o[2],o[2]) == CGAL::ON_NEGATIVE_SIDE); + assert(power_test(wp[0],wp[0],o[3],o[3]) == CGAL::ON_ORIENTED_BOUNDARY); + } + + std::cout << "test of Compare_weighted_squared_radius_3" << std::endl; + Compare_weighted_squared_radius_3 compare_weighted_squared_radius = traits.compare_weighted_squared_radius_3_object(); + { + // base, no offset + assert(compare_weighted_squared_radius(wp[0],wp[15],wp[2],wp[3], FT(0.)) == CGAL::LARGER); + assert(compare_weighted_squared_radius(wp[0],wp[15],wp[2], FT(1.)) == CGAL::SMALLER); + assert(compare_weighted_squared_radius(wp[0],wp[9], FT(5.)) == CGAL::SMALLER); + assert(compare_weighted_squared_radius(wp[15], FT(-2.)) == CGAL::EQUAL); + + // with offsets + assert(compare_weighted_squared_radius(wp[0],wp[15],wp[2],wp[3], + o[2], o[2], o[2], o[2], + FT(0.)) + == compare_weighted_squared_radius(wp[0],wp[15],wp[2],wp[3], FT(0.))); + assert(compare_weighted_squared_radius(wp[0], wp[11], wp[13], + o[1], o[1], o[1], + FT(1.)) + == compare_weighted_squared_radius(wp[0],wp[11],wp[13], FT(1.))); + assert(compare_weighted_squared_radius(wp[0], wp[11], o[3], o[3], FT(1.)) + == compare_weighted_squared_radius(wp[0],wp[11], FT(1.))); + assert(compare_weighted_squared_radius(wp[4], o[1], FT(1.)) + == compare_weighted_squared_radius(wp[4], FT(1.))); + } + + std::cout << "test of Coplanar_orientation_3" << std::endl; + Construct_point_3 cp = traits.construct_point_3_object(); + Coplanar_orientation_3 coplanar_orientation = traits.coplanar_orientation_3_object(); + { + assert(coplanar_orientation(cp(wp[0]), cp(wp[1]), cp(wp[2]), cp(wp[3]), + o[3], o[3], o[3], o[3]) + == coplanar_orientation(cp(wp[0]), cp(wp[1]), cp(wp[2]), cp(wp[3]))); + assert(coplanar_orientation(cp(wp[0], o[3]), cp(wp[1], o[3]), cp(wp[2], o[3]), cp(wp[3], o[3])) + == coplanar_orientation(cp(wp[0]), cp(wp[1]), cp(wp[2]), cp(wp[3]))); + assert(coplanar_orientation(cp(wp[4]), cp(wp[3]), cp(wp[2]), o[4], o[4], o[4]) + == coplanar_orientation(cp(wp[4]), cp(wp[3]), cp(wp[2]))); + + assert(coplanar_orientation(cp(wp[1]), cp(wp[1]), cp(wp[1]), cp(wp[1]), + o[0], o[7], o[1], o[8]) == CGAL::COLLINEAR); + assert(coplanar_orientation(cp(wp[3]), cp(wp[3]), cp(wp[3]), + o[0], o[7], o[8]) == CGAL::COLLINEAR); + + assert(coplanar_orientation(cp(wp[1]), cp(wp[2]), cp(wp[3]), cp(wp[4]), + o[6], o[7], o[4], o[1]) == CGAL::POSITIVE); + } +} + +template +void _test_cls_periodic_3_regular_triangulation_traits_3_rational () +{ + typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits; + typedef typename Traits::Weighted_point_3 Weighted_point_3; + typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Iso_cuboid_3 Iso_cuboid; + + Traits traits; + + std::cout << "Iso_cuboid(0,0,0,4,4,4)" << std::endl; + + traits.set_domain(Iso_cuboid(0, 0, 0, 4, 4, 4)); + Point_3 p0(0.,0.,0.); + Point_3 p1(2.,0.,0.); + Point_3 p2(0.,2.,0.); + Point_3 p3(0.,0.,2.); + Point_3 p4(2.,2.,2.); + Point_3 p5(1.,0.,0.); + Point_3 p6(3.,0.,0.); + + Weighted_point_3 wp[19] = + { + Weighted_point_3(p0, 9.), + Weighted_point_3(p1, 9.), + Weighted_point_3(p2, 9.), + Weighted_point_3(p3, 9.), + Weighted_point_3(p0, 6.), + Weighted_point_3(p0, 3.), + Weighted_point_3(p0, 12.), + + Weighted_point_3(p0,0.), // [7] + Weighted_point_3(p1,0.), + Weighted_point_3(p2,0.), + Weighted_point_3(p3,0.), + Weighted_point_3(p4,0.), + Weighted_point_3(p5,0.), + Weighted_point_3(p6,0.), + Weighted_point_3(p0,2.), + Weighted_point_3(p1,2.), + Weighted_point_3(p2,2.), + Weighted_point_3(p3,2.), + Weighted_point_3(p4,2.) + }; + + _test_for_given_domain(traits, wp); +} + +template +void _test_cls_periodic_3_regular_triangulation_traits_3_irrational () +{ + typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits; + typedef typename Traits::Weighted_point_3 Weighted_point_3; + typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Iso_cuboid_3 Iso_cuboid; + + Traits traits; + + std::cout << "Iso_cuboid(-pi,-sqrt(3)/2, -0.1, pi/3, pi/2, sqrt(14))" << std::endl; + traits.set_domain(Iso_cuboid(-CGAL_PI, - CGAL::sqrt(3.) / 2., -0.1, + CGAL_PI / 3., CGAL_PI / 2., CGAL::sqrt(14.))); + Point_3 p0(CGAL_PI/4., std::cos(0.7), 1./3.); + Point_3 p1(-0.75, -1.24, CGAL::sqrt(3.)); + Point_3 p2(0.1, std::sin(1./0.002478), CGAL_PI); + Point_3 p3(0., 0., 0.); + Point_3 p4(1./3., 20./6., 0.); + Point_3 p5(-2., 0., 0.); + Point_3 p6(-4., 0., 0.); + + Weighted_point_3 wp[19] = + { + Weighted_point_3(p0, 9.), + Weighted_point_3(p1, 9.), + Weighted_point_3(p2, 9.), + Weighted_point_3(p3, 9.), + Weighted_point_3(p0, 6.), + Weighted_point_3(p0, 3.), + Weighted_point_3(p0, 12.), + + Weighted_point_3(p0,0.), // 7th + Weighted_point_3(p1,0.), + Weighted_point_3(p2,0.), + Weighted_point_3(p3,0.), + Weighted_point_3(p4,0.), + Weighted_point_3(p5,0.), + Weighted_point_3(p6,0.), + Weighted_point_3(p0,2.), + Weighted_point_3(p1,2.), + Weighted_point_3(p2,2.), + Weighted_point_3(p3,2.), + Weighted_point_3(p4,2.) + }; + + _test_for_given_domain(traits, wp); +} diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h index 8894975c815..0db1a91ea3e 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/include/CGAL/_test_cls_periodic_3_triangulation_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 1998 INRIA Sophia-Antipolis (France). +// Copyright (c) 1998, 2015 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -14,21 +14,23 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Francois Rebufat // Manuel Caroli +// Aymeric Pelle + +#include "_test_cls_periodic_3_iterator.h" +#include "_test_cls_periodic_3_circulator.h" #include #include +#include #include #include #include #include -#include "_test_cls_periodic_3_iterator.h" -#include "_test_cls_periodic_3_circulator.h" - template void _test_periodic_3_triangulation_3_constructors(const PeriodicTriangulation &) @@ -38,9 +40,9 @@ _test_periodic_3_triangulation_3_constructors(const PeriodicTriangulation &) assert(PT_def.is_valid()); PeriodicTriangulation PT_dom( - typename PeriodicTriangulation::Iso_cuboid(-1,-2,-3,3,2,1)); + typename PeriodicTriangulation::Iso_cuboid(-1,-2,-3,3,2,1)); assert(PT_def.is_valid()); - + PeriodicTriangulation PT_cp(PT_dom); assert(PT_dom.is_valid()); assert(PT_cp == PT_dom); @@ -49,7 +51,12 @@ _test_periodic_3_triangulation_3_constructors(const PeriodicTriangulation &) template void _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, - bool ex = false, bool hom = false) + const typename PeriodicTriangulation::Point& pointtt, + const char* covering_test_HOM_filename, + const char* covering_test_filename, + bool ex = false, + bool hom = false, + bool test_input_ouput = true) { typedef PeriodicTriangulation P3T3; @@ -64,6 +71,7 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, typedef typename P3T3::Covering_sheets Covering_sheets; CGAL_USE_TYPE(Covering_sheets); + typedef typename P3T3::Point_3 Point_3; typedef typename P3T3::Point Point; typedef typename P3T3::Segment Segment; typedef typename P3T3::Triangle Triangle; @@ -89,7 +97,7 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, CGAL_USE_TYPE(Cell); typedef typename P3T3::Vertex_handle Vertex_handle; - typedef typename P3T3::Cell_handle Cell_handle; + typedef typename P3T3::Cell_handle Cell_handle; typedef typename P3T3::size_type size_type; typedef typename P3T3::difference_type difference_type; @@ -145,13 +153,21 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, std::cout<<" non-degenerate, 1-sheeted covering"<> PT1; - PT1.insert(Point(0.711476,-0.0713565,-0.52312)); +// assert(PT1.number_of_vertices() == 70); + assert(PT1.is_valid()); +// assert(!PT1.is_extensible_triangulation_in_1_sheet_h1()); +// assert(!PT1.is_extensible_triangulation_in_1_sheet_h2()); + PT1.insert(pointtt); + assert(PT1.is_extensible_triangulation_in_1_sheet_h1()); + assert(PT1.is_extensible_triangulation_in_1_sheet_h2()); assert(PT1.number_of_sheets() == CGAL::make_array(1,1,1)); - assert(PT1.number_of_vertices() == 71); +// assert(PT1.number_of_vertices() == 71); assert(PT1.is_valid()); std::cout<<" degenerate, 3-sheeted covering"<(i)*4./8.,static_cast(j)*4./8.,static_cast(k)*4./8.)); assert(PT1_deg.number_of_sheets() == CGAL::make_array(1,1,1)); - assert(PT1_deg.number_of_vertices() == 54); +// assert(PT1_deg.number_of_vertices() == 54); assert(PT1_deg.is_valid()); std::cout<<"Constructor"<vertex(0)->point(),vh)); assert(ch->vertex(0) != vh); @@ -352,54 +370,54 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, assert(ch->vertex(0) == c->vertex(i)); assert(ch->vertex(1) == c->vertex(j)); assert(!PT3.is_edge(ch->vertex(0), - ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j)); + ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j)); assert(PT3.is_edge(ch->vertex(0),off0,ch->vertex(1),off1,c,i,j)); assert(ch->vertex(0) == c->vertex(i)); assert(ch->vertex(1) == c->vertex(j)); assert(!PT3.is_edge(ch->vertex(0),off0,ch->vertex(1),off1+Offset(0,0,1), - c,i,j)); + c,i,j)); assert(PT3.is_facet(ch->vertex(0),ch->vertex(1),ch->vertex(2), c,i,j,k)); assert(ch->vertex(0) == c->vertex(i)); assert(ch->vertex(1) == c->vertex(j)); assert(ch->vertex(2) == c->vertex(k)); assert(!PT3.is_facet(ch->vertex(0),ch->vertex(1), - ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k)); + ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k)); assert(PT3.is_facet(ch->vertex(0),off0,ch->vertex(1),off1,ch->vertex(2),off2, - c,i,j,k)); + c,i,j,k)); assert(ch->vertex(0) == c->vertex(i)); assert(ch->vertex(1) == c->vertex(j)); assert(ch->vertex(2) == c->vertex(k)); assert(!PT3.is_facet(ch->vertex(0),off0,ch->vertex(1),off1, - ch->vertex(2),off2+Offset(0,0,1),c,i,j,k)); + ch->vertex(2),off2+Offset(0,0,1),c,i,j,k)); c = Cell_handle(); assert(PT3.is_cell(ch)); assert(!PT3.is_cell(c)); assert(PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2),ch->vertex(3), - c)); + c)); assert(!PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2), - ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c)); + ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c)); assert(PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2),ch->vertex(3), - c,i,j,k,l)); + c,i,j,k,l)); assert(ch->vertex(0) == c->vertex(i)); assert(ch->vertex(1) == c->vertex(j)); assert(ch->vertex(2) == c->vertex(k)); assert(ch->vertex(3) == c->vertex(l)); assert(!PT3.is_cell(ch->vertex(0),ch->vertex(1),ch->vertex(2), - ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k,l)); + ch->neighbor(0)->vertex(ch->neighbor(0)->index(ch)),c,i,j,k,l)); assert(PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1, - ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l)); + ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l)); assert(PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1, - ch->vertex(2),off2,ch->vertex(3),off3,c)); + ch->vertex(2),off2,ch->vertex(3),off3,c)); assert(ch->vertex(0) == c->vertex(i)); assert(ch->vertex(1) == c->vertex(j)); assert(ch->vertex(2) == c->vertex(k)); assert(ch->vertex(3) == c->vertex(l)); assert(!PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1+Offset(0,0,1), - ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l)); + ch->vertex(2),off2,ch->vertex(3),off3,c,i,j,k,l)); assert(!PT3.is_cell(ch->vertex(0),off0,ch->vertex(1),off1+Offset(0,0,1), - ch->vertex(2),off2,ch->vertex(3),off3,c)); + ch->vertex(2),off2,ch->vertex(3),off3,c)); assert(PT3.has_vertex(Facet(ch,0),ch->vertex(1),i)); assert(PT3.has_vertex(ch,0,ch->vertex(1),i)); @@ -420,14 +438,14 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, std::cout<<"Point location"<neighbor(0),lt,li,lj) - == CGAL::ON_UNBOUNDED_SIDE); + == CGAL::ON_UNBOUNDED_SIDE); c = PT3_deg.locate(Point(2,0.5,0.5),lt,li,lj); assert(lt == P3T3::FACET); - assert( PT3_deg.triangle(PT3_deg.periodic_triangle(c,li)) - == PT3_deg.geom_traits().construct_triangle_3_object()( - Point(2,0,2), Point(2,0,0), Point(2,2,0)) ); + assert( PT3_deg.construct_triangle(PT3_deg.periodic_triangle(c,li)) + == PT3_deg.geom_traits().construct_triangle_3_object()( + Point_3(2,0,2), Point_3(2,0,0), Point_3(2,2,0)) ); assert(PT3_deg.side_of_cell(Point(2,0.5,0.5),c,lt,li,lj) - == CGAL::ON_BOUNDARY); + == CGAL::ON_BOUNDARY); assert(lt == P3T3::FACET); - assert( PT3_deg.triangle(PT3_deg.periodic_triangle(c,li)) - == PT3_deg.geom_traits().construct_triangle_3_object()( - Point(2,0,2), Point(2,0,0), Point(2,2,0)) ); + assert( PT3_deg.construct_triangle(PT3_deg.periodic_triangle(c,li)) + == PT3_deg.geom_traits().construct_triangle_3_object()( + Point_3(2,0,2), Point_3(2,0,0), Point_3(2,2,0)) ); c = PT3_deg.locate(Point(2,2,1),lt,li,lj); assert(lt == P3T3::EDGE); - assert( PT3_deg.segment(PT3_deg.periodic_segment(c,li,lj)) - == PT3_deg.geom_traits().construct_segment_3_object()( - Point(2,2,0), Point(2,2,2)) ); + assert( PT3_deg.construct_segment(PT3_deg.periodic_segment(c,li,lj)) + == PT3_deg.geom_traits().construct_segment_3_object()( + Point_3(2,2,0), Point_3(2,2,2)) ); assert(PT3_deg.side_of_cell(Point(2,2,1),c,lt,li,lj) == CGAL::ON_BOUNDARY); assert(lt == P3T3::EDGE); - assert( PT3_deg.segment(PT3_deg.periodic_segment(c,li,lj)) - == PT3_deg.geom_traits().construct_segment_3_object()( - Point(2,2,0), Point(2,2,2)) ); + assert( PT3_deg.construct_segment(PT3_deg.periodic_segment(c,li,lj)) + == PT3_deg.geom_traits().construct_segment_3_object()( + Point_3(2,2,0), Point_3(2,2,2)) ); c = PT3_deg.locate(Point(2,2,2),lt,li,lj); assert(lt == P3T3::VERTEX); @@ -470,12 +488,12 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, assert(lt == P3T3::VERTEX); assert(c->vertex(li)->point() == Point(2,2,2)); - c = P3T3().locate(Point(1,2,3),lt,li,lj); - assert(c == Cell_handle()); - assert(lt == P3T3::EMPTY); - assert(P3T3().side_of_cell(Point(1,2,3),c,lt,li,lj) - == CGAL::ON_UNBOUNDED_SIDE); - assert(lt == P3T3::EMPTY); + c = P3T3().locate(Point(1,2,3),lt,li,lj); + assert(c == Cell_handle()); + assert(lt == P3T3::EMPTY); + assert(P3T3().side_of_cell(Point(1,2,3),c,lt,li,lj) + == CGAL::ON_UNBOUNDED_SIDE); + assert(lt == P3T3::EMPTY); std::cout << "Testing Iterators "<< std::endl; @@ -511,50 +529,50 @@ _test_cls_periodic_3_triangulation_3(const PeriodicTriangulation &, PT3.incident_cells(PT3.vertices_begin(),std::back_inserter(cellv)); for (unsigned int n=0 ; nvertex(0)) - || (PT3.vertices_begin() == cellv[n]->vertex(1)) - || (PT3.vertices_begin() == cellv[n]->vertex(2)) - || (PT3.vertices_begin() == cellv[n]->vertex(3)) ); + || (PT3.vertices_begin() == cellv[n]->vertex(1)) + || (PT3.vertices_begin() == cellv[n]->vertex(2)) + || (PT3.vertices_begin() == cellv[n]->vertex(3)) ); assert(PT3.is_cell(cellv[n])); assert(PT3.is_cell(cellv[n]->vertex(0),cellv[n]->vertex(1), - cellv[n]->vertex(2),cellv[n]->vertex(3),c)); + cellv[n]->vertex(2),cellv[n]->vertex(3),c)); assert(PT3.is_cell( - cellv[n]->vertex(0),PT3.periodic_point(cellv[n],0).second, - cellv[n]->vertex(1),PT3.periodic_point(cellv[n],1).second, - cellv[n]->vertex(2),PT3.periodic_point(cellv[n],2).second, - cellv[n]->vertex(3),PT3.periodic_point(cellv[n],3).second,c)); + cellv[n]->vertex(0),PT3.periodic_point(cellv[n],0).second, + cellv[n]->vertex(1),PT3.periodic_point(cellv[n],1).second, + cellv[n]->vertex(2),PT3.periodic_point(cellv[n],2).second, + cellv[n]->vertex(3),PT3.periodic_point(cellv[n],3).second,c)); } PT3.incident_facets(PT3.vertices_begin(),std::back_inserter(facetv)); for (unsigned int n=0 ; nvertex((facetv[n].second+1)&3)) - || (PT3.vertices_begin() - == facetv[n].first->vertex((facetv[n].second+2)&3)) - || (PT3.vertices_begin() - == facetv[n].first->vertex((facetv[n].second+3)&3)) ); + == facetv[n].first->vertex((facetv[n].second+1)&3)) + || (PT3.vertices_begin() + == facetv[n].first->vertex((facetv[n].second+2)&3)) + || (PT3.vertices_begin() + == facetv[n].first->vertex((facetv[n].second+3)&3)) ); assert(PT3.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3), - facetv[n].first->vertex((facetv[n].second+2)&3), - facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k)); + facetv[n].first->vertex((facetv[n].second+2)&3), + facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k)); assert(PT3.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3), - PT3.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second, - facetv[n].first->vertex((facetv[n].second+2)&3), - PT3.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second, - facetv[n].first->vertex((facetv[n].second+3)&3), - PT3.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second, - c,i,j,k)); + PT3.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second, + facetv[n].first->vertex((facetv[n].second+2)&3), + PT3.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second, + facetv[n].first->vertex((facetv[n].second+3)&3), + PT3.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second, + c,i,j,k)); } PT3.incident_edges(PT3.vertices_begin(),std::back_inserter(edgev)); for (unsigned int n=0 ; nvertex(edgev[n].second)) - || (PT3.vertices_begin() - == edgev[n].first->vertex(edgev[n].third)) ); + == edgev[n].first->vertex(edgev[n].second)) + || (PT3.vertices_begin() + == edgev[n].first->vertex(edgev[n].third)) ); assert(PT3.is_edge(edgev[n].first->vertex(edgev[n].second), - edgev[n].first->vertex(edgev[n].third),c,i,j)); + edgev[n].first->vertex(edgev[n].third),c,i,j)); assert(PT3.is_edge(edgev[n].first->vertex(edgev[n].second), - PT3.periodic_point(edgev[n].first,edgev[n].second).second, - edgev[n].first->vertex(edgev[n].third), - PT3.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j)); + PT3.periodic_point(edgev[n].first,edgev[n].second).second, + edgev[n].first->vertex(edgev[n].third), + PT3.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j)); } PT3.adjacent_vertices(PT3.vertices_begin(),std::back_inserter(vertexv)); for (unsigned int n=0 ; nvertex(0)) - || (PT1.vertices_begin() == cellv[n]->vertex(1)) - || (PT1.vertices_begin() == cellv[n]->vertex(2)) - || (PT1.vertices_begin() == cellv[n]->vertex(3)) ); + || (PT1.vertices_begin() == cellv[n]->vertex(1)) + || (PT1.vertices_begin() == cellv[n]->vertex(2)) + || (PT1.vertices_begin() == cellv[n]->vertex(3)) ); assert(PT1.is_cell(cellv[n])); assert(PT1.is_cell(cellv[n]->vertex(0),cellv[n]->vertex(1), - cellv[n]->vertex(2),cellv[n]->vertex(3),c)); + cellv[n]->vertex(2),cellv[n]->vertex(3),c)); assert(PT1.is_cell( - cellv[n]->vertex(0),PT1.periodic_point(cellv[n],0).second, - cellv[n]->vertex(1),PT1.periodic_point(cellv[n],1).second, - cellv[n]->vertex(2),PT1.periodic_point(cellv[n],2).second, - cellv[n]->vertex(3),PT1.periodic_point(cellv[n],3).second,c)); + cellv[n]->vertex(0),PT1.periodic_point(cellv[n],0).second, + cellv[n]->vertex(1),PT1.periodic_point(cellv[n],1).second, + cellv[n]->vertex(2),PT1.periodic_point(cellv[n],2).second, + cellv[n]->vertex(3),PT1.periodic_point(cellv[n],3).second,c)); } PT1.incident_facets(PT1.vertices_begin(),std::back_inserter(facetv)); for (unsigned int n=0 ; nvertex((facetv[n].second+1)&3)) - || (PT1.vertices_begin() - == facetv[n].first->vertex((facetv[n].second+2)&3)) - || (PT1.vertices_begin() - == facetv[n].first->vertex((facetv[n].second+3)&3)) ); + == facetv[n].first->vertex((facetv[n].second+1)&3)) + || (PT1.vertices_begin() + == facetv[n].first->vertex((facetv[n].second+2)&3)) + || (PT1.vertices_begin() + == facetv[n].first->vertex((facetv[n].second+3)&3)) ); assert(PT1.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3), - facetv[n].first->vertex((facetv[n].second+2)&3), - facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k)); - assert(PT1.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3), - PT1.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second, - facetv[n].first->vertex((facetv[n].second+2)&3), - PT1.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second, - facetv[n].first->vertex((facetv[n].second+3)&3), - PT1.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second, - c,i,j,k)); + facetv[n].first->vertex((facetv[n].second+2)&3), + facetv[n].first->vertex((facetv[n].second+3)&3),c,i,j,k)); + assert(PT1.is_facet(facetv[n].first->vertex((facetv[n].second+1)&3), + PT1.periodic_point(facetv[n].first,(facetv[n].second+1)&3).second, + facetv[n].first->vertex((facetv[n].second+2)&3), + PT1.periodic_point(facetv[n].first,(facetv[n].second+2)&3).second, + facetv[n].first->vertex((facetv[n].second+3)&3), + PT1.periodic_point(facetv[n].first,(facetv[n].second+3)&3).second, + c,i,j,k)); } PT1.incident_edges(PT1.vertices_begin(),std::back_inserter(edgev)); for (unsigned int n=0 ; nvertex(edgev[n].second)) - || (PT1.vertices_begin() - == edgev[n].first->vertex(edgev[n].third)) ); + == edgev[n].first->vertex(edgev[n].second)) + || (PT1.vertices_begin() + == edgev[n].first->vertex(edgev[n].third)) ); assert(PT1.is_edge(edgev[n].first->vertex(edgev[n].second), - edgev[n].first->vertex(edgev[n].third),c,i,j)); + edgev[n].first->vertex(edgev[n].third),c,i,j)); assert(PT1.is_edge(edgev[n].first->vertex(edgev[n].second), - PT1.periodic_point(edgev[n].first,edgev[n].second).second, - edgev[n].first->vertex(edgev[n].third), - PT1.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j)); + PT1.periodic_point(edgev[n].first,edgev[n].second).second, + edgev[n].first->vertex(edgev[n].third), + PT1.periodic_point(edgev[n].first,edgev[n].third).second,c,i,j)); } PT1.adjacent_vertices(PT1.vertices_begin(),std::back_inserter(vertexv)); for (unsigned int n=0 ; nneighbor(0)->neighbor(PT3.mirror_index(ch,0)) == ch); assert(ch->neighbor(0)->neighbor( - ch->neighbor(0)->index(PT3.mirror_vertex(ch,0))) == ch); + ch->neighbor(0)->index(PT3.mirror_vertex(ch,0))) == ch); assert(ch->neighbor(0)->vertex(PT3.mirror_facet(Facet(ch,0)).second) - == PT3.mirror_vertex(ch,0)); + == PT3.mirror_vertex(ch,0)); assert(PT3.mirror_facet(Facet(ch,0)).first == ch->neighbor(0)); - std::cout << "I/O" << std::endl; - std::cout << " ascii" << std::endl; - - std::stringstream ss1; - std::stringstream ss3; - ss1 << PT1; - ss3 << PT3; - P3T3 PT1r, PT3r; - ss1 >> PT1r; - ss3 >> PT3r; - - assert(CGAL::is_ascii(ss1)); - assert(CGAL::is_ascii(ss3)); - if (!ex) assert(PT1 == PT1r); - if (!ex) assert(PT3 == PT3r); - - std::cout << " binary" << std::endl; - - PT1r.clear(); - PT3r.clear(); // There are problems with the IO of exact number types in binary mode. - if (!ex) { - std::stringstream ss1b; - std::stringstream ss3b; - CGAL::set_binary_mode(ss1b); - CGAL::set_binary_mode(ss3b); - ss1b << PT1; - ss3b << PT3; - - ss1b >> PT1r; - ss3b >> PT3r; - assert(CGAL::is_binary(ss1b)); - assert(CGAL::is_binary(ss3b)); + if(test_input_ouput) + { + std::cout << "I/O" << std::endl; + std::cout << " ascii" << std::endl; - assert(PT1 == PT1r); - assert(PT3 == PT3r); + std::stringstream ss1; + std::stringstream ss3; + ss1 << PT1; + ss3 << PT3; + + P3T3 PT1r, PT3r; + ss1 >> PT1r; + ss3 >> PT3r; + + assert(CGAL::is_ascii(ss1)); + assert(CGAL::is_ascii(ss3)); + if (!ex) assert(PT1 == PT1r); + if (!ex) assert(PT3 == PT3r); + + std::cout << " binary" << std::endl; + + PT1r.clear(); + PT3r.clear(); + if (!ex) { + std::stringstream ss1b; + std::stringstream ss3b; + CGAL::set_binary_mode(ss1b); + CGAL::set_binary_mode(ss3b); + ss1b << PT1; + ss3b << PT3; + + ss1b >> PT1r; + ss3b >> PT3r; + assert(CGAL::is_binary(ss1b)); + assert(CGAL::is_binary(ss3b)); + + assert(PT1 == PT1r); + assert(PT3 == PT3r); + } + + std::cout << " pretty" << std::endl; + + PT1r.clear(); + PT3r.clear(); + std::stringstream ss1p; + std::stringstream ss3p; + CGAL::set_pretty_mode(ss1p); + CGAL::set_pretty_mode(ss3p); + ss1p << PT1; + ss3p << PT3; + + assert(CGAL::is_pretty(ss1p)); + assert(CGAL::is_pretty(ss3p)); } - - std::cout << " pretty" << std::endl; - - PT1r.clear(); - PT3r.clear(); - std::stringstream ss1p; - std::stringstream ss3p; - CGAL::set_pretty_mode(ss1p); - CGAL::set_pretty_mode(ss3p); - ss1p << PT1; - ss3p << PT3; - - assert(CGAL::is_pretty(ss1p)); - assert(CGAL::is_pretty(ss3p)); } diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_p3rt3_as_p3t3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_p3rt3_as_p3t3.cpp new file mode 100644 index 00000000000..6e9031f5602 --- /dev/null +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_p3rt3_as_p3t3.cpp @@ -0,0 +1,59 @@ +// Copyright (c) 2015 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Aymeric Pelle + +#include +#include + +#include + +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_exact_constructions_kernel Epeck; +typedef CGAL::Periodic_3_regular_triangulation_traits_3 PRTT_Exact; +// Explicit instantiation of the whole class: +template class CGAL::Periodic_3_regular_triangulation_3; + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick; +typedef CGAL::Periodic_3_regular_triangulation_traits_3 PRTT_Inexact; +// Explicit instantiation of the whole class: +template class CGAL::Periodic_3_regular_triangulation_3; + +int main(int, char**) +{ + typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3_Exact; + _test_periodic_3_triangulation_3_constructors( P3RT3_Exact() ); + _test_cls_periodic_3_triangulation_3(P3RT3_Exact(), + PRTT_Exact::Weighted_point_3(0.816982, 0.161518, -0.0942375), + "data/P3RT3_covering_test_HOM.tri", + "data/P3RT3_covering_test.tri", + true); + + typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3_Inexact; + _test_periodic_3_triangulation_3_constructors( P3RT3_Inexact() ); + _test_cls_periodic_3_triangulation_3(P3RT3_Inexact(), + PRTT_Inexact::Weighted_point_3(0.816982, 0.161518, -0.0942375), + "data/P3RT3_covering_test_HOM.tri", + "data/P3RT3_covering_test.tri"); + + return 0; +} diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_p3rt3_insert_remove_point_set.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_p3rt3_insert_remove_point_set.cpp new file mode 100644 index 00000000000..d5a3263c035 --- /dev/null +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_p3rt3_insert_remove_point_set.cpp @@ -0,0 +1,189 @@ +// Copyright (c) 1998 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// $Date$ +// +// +// Author(s) : Aymeric PELLE + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits_Epeck; +/* Explicit instantiation. + * It allows us to test if the template class, instantiated with given template parameters, compiles. + */ +template class CGAL::Periodic_3_regular_triangulation_3; + + +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits_Epick; +/* Explicit instantiation. + * It allows us to test if the template class, instantiated with given template parameters, compiles. + */ +template class CGAL::Periodic_3_regular_triangulation_3; + +template +class Tests +{ +public: + typedef Kernel K; + typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits; + + typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3; + typedef typename P3RT3::Vertex_handle Vertex_handle; + typedef typename P3RT3::Facet Facet; + typedef typename P3RT3::Cell Cell; + typedef typename P3RT3::Cell_handle Cell_handle; + typedef typename P3RT3::Vertex_iterator Vertex_iterator; + typedef typename P3RT3::Cell_iterator Cell_iterator; + typedef typename P3RT3::Segment Segment; + typedef typename P3RT3::Triangle Triangle; + typedef typename P3RT3::Tetrahedron Tetrahedron; + typedef typename P3RT3::Periodic_tetrahedron Periodic_tetrahedron; + typedef typename P3RT3::Locate_type Locate_type; + typedef typename P3RT3::Offset Offset; + + typedef typename Traits::Weighted_point_3 Weighted_point_3; + typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Iso_cuboid_3 Iso_cuboid; + + static void test_insert_rnd_then_remove_all (unsigned pt_count, + unsigned seed, + const std::string& path) + { + std::cout << "--- test_insert_rnd (" << pt_count << ", " << seed << ')' << std::endl; + + CGAL::Random random(seed); + typedef CGAL::Creator_uniform_3 Creator; + CGAL::Random_points_in_cube_3 in_cube(0.5, random); + + Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5); + P3RT3 p3rt3(iso_cuboid); + + std::ofstream stream("p3rt3_ir_point_set"); + assert(stream); + std::ifstream input_stream(path.c_str()); + + std::vector insert_set; + insert_set.reserve(pt_count); + std::vector remove_set; + remove_set.reserve(pt_count); + + std::cout << "-- insert" << std::endl; + for (unsigned cnt = 1; cnt <= pt_count; ++cnt) + { +// Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625)); +// std::cout << cnt << " : " << p << std::endl; + Weighted_point_3 p; + input_stream >> p; + assert(p.weight() < 0.015625); + stream << p << std::endl; + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + + Vertex_handle vh = p3rt3.insert(p); + + std::size_t hidden_point_count_2 = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count_2 += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count <= hidden_point_count_2); + assert(hidden_point_count_2 + p3rt3.number_of_vertices() == cnt); + + std::cout << cnt << " - p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl; + if (vh == Vertex_handle()) + { + if (find(insert_set.begin(), insert_set.end(), p) == insert_set.end()) + insert_set.push_back(p); + } + else + insert_set.push_back(p); + } + + stream.close(); + + assert(p3rt3.is_valid()); + + std::cout << "-- remove" << std::endl; + unsigned cnt = 1; + for (; p3rt3.number_of_vertices() != 0; ++cnt) + { + Vertex_iterator iter = p3rt3.vertices_begin(); + for (int j = random.get_int(0, static_cast(p3rt3.number_of_vertices())); j; --j) + ++iter; + + std::cout << cnt << " : " << iter->point() << std::endl; + + remove_set.push_back(iter->point()); + p3rt3.remove(iter); + + std::cout << " p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl; + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + + assert(hidden_point_count + cnt + p3rt3.number_of_vertices() == insert_set.size()); + } + + std::sort(insert_set.begin(), insert_set.end()); + std::sort(remove_set.begin(), remove_set.end()); + assert(insert_set == remove_set); + + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_stored_vertices() == 0); + } + + static void test () + { + ////// Iso_cuboid unitaire -> 0 <= weight < 0.015625 + test_insert_rnd_then_remove_all(800, 7, "data/p3rt3_point_set__s7_n800"); + test_insert_rnd_then_remove_all(800, 12, "data/p3rt3_point_set__s12_n800"); + } +}; + +int main (int, char**) +{ + std::cout << "TESTING ..." << std::endl; + + CGAL::force_ieee_double_precision(); + + std::cout << "Epeck ..." << std::endl; + Tests::test(); + std::cout << "Epick ..." << std::endl; + Tests::test(); + + std::cout << "EXIT SUCCESS" << std::endl; + return EXIT_SUCCESS; +} diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_alpha_shape_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_alpha_shape_3.cpp index b26c407bf48..1875f9bc790 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_alpha_shape_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_alpha_shape_3.cpp @@ -12,10 +12,10 @@ // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // -// $URL$ -// $Id$ +// $URL$ +// $Id$ // $Date$ -// +// // // Author(s) : Mariette Yvinec // Manuel Caroli @@ -64,7 +64,7 @@ typedef CGAL::Triangulation_data_structure_3 ETds; typedef CGAL::Periodic_3_Delaunay_triangulation_3 EP3DT3; typedef CGAL::Alpha_shape_3 EAlpha_shape_3; -int main() +int main(int, char**) { CGAL::Timer timer; timer.start(); diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_3.cpp index d07a0f964e5..aa0806058dd 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_3.cpp @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Nico Kruithof // Manuel Caroli @@ -47,7 +47,7 @@ typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PTT3; template class CGAL::Periodic_3_Delaunay_triangulation_3; #include -int main() +int main(int, char**) { CGAL::Timer timer; timer.start(); diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_hierarchy_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_hierarchy_3.cpp index 9cbf6d5bbc5..fc69998cf99 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_hierarchy_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_hierarchy_3.cpp @@ -14,7 +14,7 @@ // // $URL: svn+ssh://mcaroli@scm.gforge.inria.fr/svn/cgal/trunk/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_delaunay_3.cpp $ // $Id: test_periodic_3_delaunay_3.cpp 48874 2009-04-23 13:54:38Z mcaroli $ -// +// // // Author(s) : Nico Kruithof // Manuel Caroli @@ -30,7 +30,7 @@ #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PTT1; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PTT1; typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> DSVB1; typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> DSCB1; typedef CGAL::Triangulation_vertex_base_3 VBB1; @@ -43,7 +43,7 @@ template class CGAL::Periodic_3_triangulation_hierarchy_3; #include typedef CGAL::Exact_predicates_exact_constructions_kernel K2; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PTT2; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PTT2; typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> DSVB2; typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> DSCB2; typedef CGAL::Triangulation_vertex_base_3 VBB2; @@ -57,7 +57,7 @@ template class CGAL::Periodic_3_triangulation_hierarchy_3; #include #include typedef CGAL::Simple_homogeneous K3; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PTT3; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PTT3; typedef CGAL::Periodic_3_triangulation_ds_vertex_base_3<> DSVB3; typedef CGAL::Periodic_3_triangulation_ds_cell_base_3<> DSCB3; typedef CGAL::Triangulation_vertex_base_3 VBB3; @@ -69,16 +69,16 @@ typedef CGAL::Periodic_3_Delaunay_triangulation_3 PDT3; template class CGAL::Periodic_3_triangulation_hierarchy_3; #include -int main() + +int main(int, char**) { CGAL::Timer timer; timer.start(); typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT1 > P3T3_1; _test_cls_periodic_3_delaunay_3( P3T3_1() ); - // typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT2 > P3T3_2; - // this takes too much time for the test suite. - //_test_cls_periodic_3_delaunay_3( P3T3_2() ); + typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT2 > P3T3_2; + _test_cls_periodic_3_delaunay_3( P3T3_2() ); // typedef CGAL::Periodic_3_triangulation_hierarchy_3< PDT3 > P3T3_3; // this takes too much time for the test suite. diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_offset_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_offset_3.cpp index 740daa4cded..9bec7497187 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_offset_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_offset_3.cpp @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Manuel Caroli @@ -27,7 +27,8 @@ typedef CGAL::Periodic_3_offset_3 Offset; #include -int main() + +int main(int, char**) { CGAL::Timer timer; timer.start(); diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_3.cpp new file mode 100644 index 00000000000..e0297ccdffb --- /dev/null +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_3.cpp @@ -0,0 +1,776 @@ +// Copyright (c) 1998 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// $Date$ +// +// +// Author(s) : Aymeric PELLE + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits_Epeck; +/* Explicit instantiation. + * It allows us to test if the template class, instantiated with given template parameters, compiles. + */ +template class CGAL::Periodic_3_regular_triangulation_3; + + +typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits_Epick; +/* Explicit instantiation. + * It allows us to test if the template class, instantiated with given template parameters, compiles. + */ +template class CGAL::Periodic_3_regular_triangulation_3; + + +template +class Tests +{ +public: + typedef Kernel K; + typedef typename K::FT FT; + typedef CGAL::Periodic_3_regular_triangulation_traits_3 Traits; + + typedef CGAL::Periodic_3_regular_triangulation_3 P3RT3; + typedef typename P3RT3::Vertex_handle Vertex_handle; + typedef typename P3RT3::Cell_handle Cell_handle; + typedef typename P3RT3::Facet Facet; + typedef typename P3RT3::Cell Cell; + typedef typename P3RT3::Vertex_iterator Vertex_iterator; + typedef typename P3RT3::Cell_iterator Cell_iterator; + typedef typename P3RT3::Segment Segment; + typedef typename P3RT3::Triangle Triangle; + typedef typename P3RT3::Tetrahedron Tetrahedron; + typedef typename P3RT3::Periodic_tetrahedron Periodic_tetrahedron; + typedef typename P3RT3::Locate_type Locate_type; + typedef typename P3RT3::Offset Offset; + + typedef typename Traits::Weighted_point_3 Weighted_point_3; + typedef typename Traits::Point_3 Point_3; + typedef typename Traits::Iso_cuboid_3 Iso_cuboid; + + + static Weighted_point_3 read_wpoint (std::istream& stream) + { + FT x = 0., y = 0., z = 0., w = 0.; + stream >> x; + assert(stream && !stream.eof()); + stream >> y; + assert(stream && !stream.eof()); + stream >> z; + assert(stream && !stream.eof()); + stream >> w; + assert(stream); + return Weighted_point_3(Point_3(x, y, z), w); + } + + static void test_construction () + { + std::cout << "--- test_construction" << std::endl; + + P3RT3 p3rt3; + assert(p3rt3.is_valid()); + } + + static void test_insert_1 () + { + std::cout << "--- test_insert_1" << std::endl; + + P3RT3 p3rt3; + + Weighted_point_3 p(Point_3(0,0,0), 0.01); + p3rt3.insert(p); + + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 1); + assert(p3rt3.number_of_stored_vertices() == 27); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + } + + static void test_insert_point () + { + std::cout << "--- test_insert_point" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1)); + + Vertex_handle vh; + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01)); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + Weighted_point_3 p(Point_3(0.4, 0.4, 0.4), 0.001); + vh = p3rt3.insert(p); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 5); + assert(p3rt3.number_of_stored_vertices() == 135); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + } + + static void test_insert_hidden_point () + { + std::cout << "--- test_insert_hidden_point" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1)); + + Vertex_handle vh; + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01)); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + + Weighted_point_3 hidden_point(Point_3(0.101, 0.101, 0.101), 0.001); + vh = p3rt3.insert(hidden_point); + assert(vh == Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + unsigned hidden_found_count = 0; + hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + { + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + hidden_found_count += static_cast(std::find(iter->hidden_points_begin(), iter->hidden_points_end(), hidden_point) != iter->hidden_points_end()); + } + assert(hidden_point_count == 1); + assert(hidden_found_count == 1); + } + + static void test_insert_hiding_point () + { + std::cout << "--- test_insert_hiding_point" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1)); + + Vertex_handle vh; + vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01)); + assert(vh != Vertex_handle()); + Weighted_point_3 hidden_point(Point_3(0.101, 0.101, 0.101), 0.001); + vh = p3rt3.insert(hidden_point); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + unsigned hidden_found_count = 0; + hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + { + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + hidden_found_count += static_cast(std::find(iter->hidden_points_begin(), iter->hidden_points_end(), hidden_point) != iter->hidden_points_end()); + } + assert(hidden_point_count == 1); + assert(hidden_found_count == 1); + } + + static void test_insert_a_point_twice () + { + std::cout << "--- test_insert_a_point_twice" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1)); + + Vertex_handle vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 1); + assert(p3rt3.number_of_stored_vertices() == 27); + + Vertex_handle vh2 = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01)); + assert(vh2 == vh); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 1); + assert(p3rt3.number_of_stored_vertices() == 27); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + } + + static void test_insert_two_points_with_the_same_position () + { + std::cout << "--- test_insert_two_points_with_the_same_position" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1)); + + Weighted_point_3 hidden_point(Point_3(0.1,0.1,0.1),0.01); + Vertex_handle vh = p3rt3.insert(hidden_point); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 1); + assert(p3rt3.number_of_stored_vertices() == 27); + + Vertex_handle vh2 = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.015)); + assert(vh2 != Vertex_handle()); + assert(vh2 != vh); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 1); + assert(p3rt3.number_of_stored_vertices() == 27); + + unsigned hidden_found_count = 0; + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + { + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + hidden_found_count += static_cast(std::find(iter->hidden_points_begin(), iter->hidden_points_end(), hidden_point) != iter->hidden_points_end()); + } + assert(hidden_point_count == 1); + assert(hidden_found_count == 1); + } + + static void test_remove () + { + std::cout << "--- test_remove" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1)); + + Vertex_handle vh; + vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + Weighted_point_3 hidden_point(Point_3(0.101, 0.101, 0.101), 0.001); + Vertex_handle vhh = p3rt3.insert(hidden_point); + assert(vhh == Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + p3rt3.remove(vh); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + + unsigned point_found_count = 0; + for (Vertex_iterator iter = p3rt3.vertices_begin(), end_iter = p3rt3.vertices_end(); iter != end_iter; ++iter) + point_found_count += (iter->point() == hidden_point); + assert(point_found_count == 27); + } + + static void test_insert_rnd_as_delaunay (unsigned pt_count, double weight) + { + std::cout << "--- test_insert_rnd_as_delaunay (" << pt_count << ',' << weight << ')' << std::endl; + + CGAL::Random random(7); + typedef CGAL::Creator_uniform_3 Creator; + CGAL::Random_points_in_cube_3 in_cube(0.5, random); + + Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5); + P3RT3 p3rt3(iso_cuboid); + + for (unsigned cnt = 1; cnt <= pt_count; ++cnt) + { + Point_3 p(*in_cube++); + Weighted_point_3 wp(p, weight); + assert(iso_cuboid.has_on_bounded_side(p)); + assert(weight < 0.015625); + p3rt3.insert(wp); + } + + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == pt_count); + assert(p3rt3.number_of_sheets() == CGAL::make_array(3,3,3) ? + p3rt3.number_of_stored_vertices() == 27 * pt_count + : p3rt3.number_of_stored_vertices() == pt_count); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + } + + static void test_insert_from_file (const char* filename) + { + std::cout << "--- test_insert_from_file" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5)); + + std::ifstream stream(filename); + assert(stream); + + unsigned cnt = 1; + while (stream && !(stream.eof())) + { + Weighted_point_3 p = read_wpoint(stream); + std::cout << cnt << " : " << p << std::endl; + assert(p.weight() < 0.015625); + std::cout << "p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl; + p3rt3.insert(p); + std::cout << "p3rt3.number_of_vertices() : " << p3rt3.number_of_vertices() << " .number_of_stored_vertices : " << p3rt3.number_of_stored_vertices() << std::endl; + ++cnt; + } + + assert(p3rt3.is_valid()); + } + + static void test_insert_rt3_pointset () + { + P3RT3 p3rt3(Iso_cuboid(Point_3(-100,-100,-100), Point_3(100,100,100))); + + for (int a=0;a!=10;a++) + for (int b=0;b!=5;b++) + for (int d=0;d!=5;d++) + { + Weighted_point_3 p( Point_3(a*b-d*a + (a-b)*10 +a , a-b+d +5*b, a*a-d*d+b), a*b-a*d ); + std::cout << p << std::endl; + p3rt3.insert(p); + } + assert(p3rt3.is_valid()); + } + + static void test_27_to_1_sheeted_covering () + { + std::cout << "--- test_27_to_1_sheeted_covering" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0, 0, 0, 1, 1, 1)); + + unsigned count = 1; + for (unsigned i = 0; i < 6; ++i) + for (unsigned j = 0; j < 6; ++j) + for (unsigned k = 0; k < 8; ++k) + { + FT x = FT(i) / FT(6); + if (k % 2) + x += FT(1) / FT(12); + FT y = FT(j) / FT(6); + if (k % 2) + y += FT(1) / FT(12); + FT z = FT(k) / FT(8); + std::cout << count++ << " - " << i << " " << j << " " << k << std::endl; + Weighted_point_3 point(Point_3(x, y, z), 0); + p3rt3.insert(point); + if (CGAL::make_array(i,j,k) != CGAL::make_array(5,5,7)) + { + assert(p3rt3.number_of_sheets() == CGAL::make_array(3,3,3)); + } + } + + assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1)); + assert(p3rt3.number_of_vertices() == 6*6*8); + assert(p3rt3.is_valid()); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + + assert(hidden_point_count == 0); + } + + static void test_dummy_points () + { + std::cout << "--- test_dummy_points" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0, 0, 0, 1, 1, 1)); + + std::vector vertices; + vertices.reserve(p3rt3.number_of_vertices()); + + unsigned count = 1; + for (unsigned i = 0; i < 6; ++i) + for (unsigned j = 0; j < 6; ++j) + for (unsigned k = 0; k < 8; ++k) + { + FT x = FT(i) / FT(6); + if (k % 2) + x += FT(1) / FT(12); + FT y = FT(j) / FT(6); + if (k % 2) + y += FT(1) / FT(12); + FT z = FT(k) / FT(8); + std::cout << count++ << " - " << i << " " << j << " " << k << std::endl; + Weighted_point_3 point(Point_3(x, y, z), 0); + vertices.push_back(p3rt3.insert(point)); + if (CGAL::make_array(i,j,k) != CGAL::make_array(5,5,7)) + { + assert(p3rt3.number_of_sheets() == CGAL::make_array(3,3,3)); + } + } + + assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1)); + assert(p3rt3.number_of_vertices() == 6*6*8); + assert(p3rt3.is_valid()); + + P3RT3 p3rt3_b(Iso_cuboid(0, 0, 0, 1, 1, 1)); + p3rt3_b.insert_dummy_points(); + + assert(p3rt3_b.number_of_sheets() == CGAL::make_array(1,1,1)); + assert(p3rt3_b.number_of_vertices() == 6*6*8); + assert(p3rt3_b.is_valid()); + + assert(p3rt3 == p3rt3_b); + } + + static void test_insert_range (unsigned pt_count, unsigned seed) + { + std::cout << "--- test_insert_range" << std::endl; + + CGAL::Random random(seed); + typedef CGAL::Creator_uniform_3 Creator; + CGAL::Random_points_in_cube_3 in_cube(0.5, random); + + Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5); + P3RT3 p3rt3(iso_cuboid); + + std::vector points; + points.reserve(pt_count); + + std::ifstream input_stream("data/p3rt3_point_set__s7_n800"); + + while (points.size() != pt_count) + { +// Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625)); + Weighted_point_3 p; + input_stream >> p; + points.push_back(p); + } + std::cout << "--- done " << std::endl; + p3rt3.insert(points.begin(), points.end(), true); + + for (Vertex_iterator iter = p3rt3.vertices_begin(), end_iter = p3rt3.vertices_end(); iter != end_iter; ++iter) + { + typename std::vector::iterator it = std::find(points.begin(), points.end(), iter->point()); + assert(it != points.end()); + } + unsigned hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + { + for (typename Cell::Point_iterator it = iter->hidden_points_begin(), end_it = iter->hidden_points_end(); it != end_it; ++it) + { + assert(std::find(points.begin(), points.end(), *it) != points.end()); + ++hidden_point_count; + } + } + + assert(p3rt3.number_of_vertices() == 659); + assert(p3rt3.number_of_vertices() + hidden_point_count == 800); + + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1)); + } + + static void test_construction_and_insert_range (unsigned pt_count, unsigned seed) + { + std::cout << "--- test_construction_and_insert_range" << std::endl; + + CGAL::Random random(seed); + typedef CGAL::Creator_uniform_3 Creator; + CGAL::Random_points_in_cube_3 in_cube(0.5, random); + + Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5); + + std::vector points; + points.reserve(pt_count); + + while (points.size() != pt_count) + { + Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625)); + points.push_back(p); + } + + P3RT3 p3rt3(points.begin(), points.end(), iso_cuboid); + + for (Vertex_iterator iter = p3rt3.vertices_begin(), end_iter = p3rt3.vertices_end(); iter != end_iter; ++iter) + { + typename std::vector::iterator it = std::find(points.begin(), points.end(), iter->point()); + assert(it != points.end()); + } + unsigned hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + { + for (typename Cell::Point_iterator it = iter->hidden_points_begin(), end_it = iter->hidden_points_end(); it != end_it; ++it) + { + assert(std::find(points.begin(), points.end(), *it) != points.end()); + ++hidden_point_count; + } + } + assert(p3rt3.number_of_vertices() == 659); + assert(p3rt3.number_of_vertices() + hidden_point_count == 800); + + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_sheets() == CGAL::make_array(1,1,1)); + } + + static void test_locate_geometry () + { + std::cout << "--- test_locate_geometry" << std::endl; + + unsigned pt_count = 600; + + CGAL::Random random(7); + typedef CGAL::Creator_uniform_3 Creator; + CGAL::Random_points_in_cube_3 in_cube(0.5, random); + + Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5); + P3RT3 p3rt3(iso_cuboid); + + std::vector points; + points.reserve(pt_count); + + while (points.size() != pt_count) + { + Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625)); + points.push_back(p); + } + + p3rt3.insert(points.begin(), points.end(), true); + + Point_3 point(-0.49, -0.49, -0.49); + Weighted_point_3 wpoint(point); + Offset lo; + Cell_handle ch = p3rt3.locate(wpoint, lo); + Periodic_tetrahedron p_tetra = p3rt3.periodic_tetrahedron(ch, lo); + Tetrahedron tetra = p3rt3.construct_tetrahedron(p_tetra); + + assert(p3rt3.orientation(point, tetra[1], tetra[2], tetra[3]) == CGAL::POSITIVE); + assert(p3rt3.orientation(tetra[0], point, tetra[2], tetra[3]) == CGAL::POSITIVE); + assert(p3rt3.orientation(tetra[0], tetra[1], point, tetra[3]) == CGAL::POSITIVE); + assert(p3rt3.orientation(tetra[0], tetra[1], tetra[2], point) == CGAL::POSITIVE); + + CGAL::Vector_3 v(tetra[0], tetra[1]); + v = v * 0.5; + point = tetra[0] + v; + wpoint = Weighted_point_3(point); + Locate_type lt; + int li, lj; + ch = p3rt3.locate(wpoint, lo, lt, li, lj); + assert(lt == P3RT3::EDGE); + Segment segment = p3rt3.construct_segment(p3rt3.periodic_segment(ch, lo, li, lj)); + assert(CGAL::collinear(segment[0], segment[1], point)); + + v = CGAL::Vector_3(point, tetra[2]); + v = v * 0.5; + point = point + v; + wpoint = Weighted_point_3(point); + ch = p3rt3.locate(wpoint, lo, lt, li, lj); + assert(lt == P3RT3::FACET); + Triangle triangle = p3rt3.construct_triangle(p3rt3.periodic_triangle(ch, lo, li)); + assert(p3rt3.coplanar(triangle[0], triangle[1], triangle[2], point)); + } + + static void test_number_of_hidden_points () + { + std::cout << "--- test_number_of_hidden_points" << std::endl; + + P3RT3 p3rt3(Iso_cuboid(0,0,0, 1,1,1)); + + Vertex_handle vh; + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.9,0.1,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.9,0.1),0.01)); + assert(vh != Vertex_handle()); + vh = p3rt3.insert(Weighted_point_3(Point_3(0.1,0.1,0.9),0.01)); + assert(vh != Vertex_handle()); + assert(p3rt3.is_valid()); + assert(p3rt3.number_of_vertices() == 4); + assert(p3rt3.number_of_stored_vertices() == 108); + + std::size_t hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 0); + assert(p3rt3.number_of_hidden_points() == 0); + + vh = p3rt3.insert(Weighted_point_3(Point_3(0.101, 0.101, 0.101), 0.001)); + assert(vh == Vertex_handle()); + hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 1); + assert(p3rt3.number_of_hidden_points() == 1); + + vh = p3rt3.insert(Weighted_point_3(Point_3(0.101, 0.101, 0.102), 0.001)); + assert(vh == Vertex_handle()); + hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 2); + assert(p3rt3.number_of_hidden_points() == 2); + + vh = p3rt3.insert(Weighted_point_3(Point_3(0.101, 0.102, 0.101), 0.001)); + assert(vh == Vertex_handle()); + hidden_point_count = 0; + for (Cell_iterator iter = p3rt3.cells_begin(), end_iter = p3rt3.cells_end(); iter != end_iter; ++iter) + hidden_point_count += std::distance(iter->hidden_points_begin(), iter->hidden_points_end()); + assert(hidden_point_count == 3); + assert(p3rt3.number_of_hidden_points() == 3); + } + + static void test_find_conflicts () + { + std::cout << "--- test_find_conflicts" << std::endl; + + CGAL::Random random(7); + typedef CGAL::Creator_uniform_3 Creator; + CGAL::Random_points_in_cube_3 in_cube(0.5, random); + + Iso_cuboid iso_cuboid(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5); + P3RT3 p3rt3(iso_cuboid); + + std::vector points; + points.reserve(800); + + for(int i=0; i<800; ++i) + { + Weighted_point_3 p(*in_cube++, random.get_double(0., 0.015625)); + points.push_back(p); + } + + p3rt3.insert(points.begin(), points.end(), false); + + std::vector bd_facets; + std::vector conflict_cells; + std::vector int_facets; + Point_3 bp(-0.5,-0.5,0.5); + Weighted_point_3 p(bp); + Cell_handle ch = p3rt3.locate(p); + p3rt3.find_conflicts(p, ch, + std::back_inserter(bd_facets), + std::back_inserter(conflict_cells), + std::back_inserter(int_facets)); + for (unsigned int i = 0; i < bd_facets.size(); i++) + { + assert( + (p3rt3.side_of_power_sphere(bd_facets[i].first, p) == CGAL::ON_BOUNDED_SIDE) + ^ (p3rt3.side_of_power_sphere(bd_facets[i].first->neighbor(bd_facets[i].second), p) + == CGAL::ON_BOUNDED_SIDE)); + } + for (unsigned int i = 0; i < conflict_cells.size(); i++) + { + assert(p3rt3.side_of_power_sphere(conflict_cells[i], p) == CGAL::ON_BOUNDED_SIDE); + } + for (unsigned int i = 0; i < int_facets.size(); i++) + { + assert((p3rt3.side_of_power_sphere(int_facets[i].first, p) == CGAL::ON_BOUNDED_SIDE)); + assert( + (p3rt3.side_of_power_sphere(int_facets[i].first->neighbor(int_facets[i].second), p) + == CGAL::ON_BOUNDED_SIDE)); + } + } + + static void test () + { + test_find_conflicts(); + test_insert_range(800, 7); + test_construction_and_insert_range(800, 7); + test_number_of_hidden_points(); + test_locate_geometry(); + test_dummy_points(); + test_construction(); + test_insert_1(); + test_insert_point(); + test_insert_hidden_point(); + test_insert_hiding_point(); + test_insert_a_point_twice(); + test_insert_two_points_with_the_same_position(); + test_remove(); + test_27_to_1_sheeted_covering(); + ////// Iso_cuboid unitaire -> 0 <= weight < 0.015625 + test_insert_rnd_as_delaunay(100, 0.); + test_insert_rnd_as_delaunay(100, 0.01); + } +}; + +int main (int, char**) +{ + std::cout << "TESTING ..." << std::endl; + + CGAL::force_ieee_double_precision(); + + std::cout << "Epeck ..." << std::endl; + Tests::test(); + std::cout << "Epick ..." << std::endl; + Tests::test(); + + std::cout << "EXIT SUCCESS" << std::endl; + return EXIT_SUCCESS; +} diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_traits_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_traits_3.cpp new file mode 100644 index 00000000000..b1a6ad2202f --- /dev/null +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_traits_3.cpp @@ -0,0 +1,27 @@ +// Copyright (c) 1998 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// $Date$ +// +// +// Author(s) : Aymeric PELLE + +#include "test_periodic_3_regular_triangulation_traits_3.h" + +int main (int, char**) +{ + test_periodic_3_regular_triangulation_traits_3(); +} diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_traits_3.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_traits_3.h new file mode 100644 index 00000000000..28a7ce6da9b --- /dev/null +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_regular_triangulation_traits_3.h @@ -0,0 +1,43 @@ +// Copyright (c) 1998 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// You can redistribute it and/or modify it under the terms of the GNU +// General Public License as published by the Free Software Foundation, +// either version 3 of the License, or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// $Date$ +// +// +// Author(s) : Aymeric PELLE + + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +void test_periodic_3_regular_triangulation_traits_3() +{ + std::cout << "EPECK" << std::endl; + _test_cls_periodic_3_regular_triangulation_traits_3_rational(); + _test_cls_periodic_3_regular_triangulation_traits_3_irrational(); + + std::cout << "EPICK" << std::endl; + _test_cls_periodic_3_regular_triangulation_traits_3_rational(); +} diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_3.cpp index 0823c2d818a..7a573af00e1 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_3.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 1998 INRIA Sophia-Antipolis (France). +// Copyright (c) 1998, 2015 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -14,13 +14,13 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Francois Rebufat // Manuel Caroli +// Aymeric Pelle #include -#include #include @@ -30,21 +30,21 @@ #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PDTT1; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PDTT1; // Explicit instantiation of the whole class: -template class CGAL::Periodic_3_triangulation_3; +template class CGAL::Periodic_3_Delaunay_triangulation_3; #include -typedef CGAL::Exact_predicates_exact_constructions_kernel K2; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PDTT2; +typedef CGAL::Exact_predicates_exact_constructions_kernel K2; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PDTT2; // Explicit instantiation of the whole class: -template class CGAL::Periodic_3_triangulation_3; +template class CGAL::Periodic_3_Delaunay_triangulation_3; #include #include -typedef CGAL::Simple_homogeneous K3; -typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PDTT3; +typedef CGAL::Simple_homogeneous K3; +typedef CGAL::Periodic_3_Delaunay_triangulation_traits_3 PDTT3; // Explicit instantiation of the whole class: template class CGAL::Periodic_3_triangulation_3; @@ -55,24 +55,35 @@ template class CGAL::Periodic_3_triangulation_3; // thus we cannot construct non-trivial triangulations without using // the insert from the periodic Delaunay triangulation. -int main() +int main(int, char**) { CGAL::Timer timer; timer.start(); - typedef CGAL::Periodic_3_triangulation_3 P3T3_1; - _test_periodic_3_triangulation_3_constructors( P3T3_1() ); - typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3_1; - _test_cls_periodic_3_triangulation_3( P3DT3_1() ); - typedef CGAL::Periodic_3_triangulation_3 P3T3_2; - _test_periodic_3_triangulation_3_constructors( P3T3_2() ); - typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3_2; - _test_cls_periodic_3_triangulation_3( P3DT3_2(), true ); + typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3TD3_K1; + _test_periodic_3_triangulation_3_constructors( P3TD3_K1() ); + _test_cls_periodic_3_triangulation_3(P3TD3_K1(), + PDTT1::Point(0.711476,-0.0713565,-0.52312), + "data/P3DT3_covering_test_HOM.tri", + "data/P3DT3_covering_test.tri"); - typedef CGAL::Periodic_3_triangulation_3 P3T3_3; - _test_periodic_3_triangulation_3_constructors( P3T3_3() ); -// typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3DT3_3; -// _test_cls_periodic_3_triangulation_3( P3DT3_3(), false, true ); + typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3TD3_K2; + _test_periodic_3_triangulation_3_constructors( P3TD3_K2() ); + _test_cls_periodic_3_triangulation_3(P3TD3_K2(), + PDTT2::Point(0.711476,-0.0713565,-0.52312), + "data/P3DT3_covering_test_HOM.tri", + "data/P3DT3_covering_test.tri", + true /*exact*/); + + typedef CGAL::Periodic_3_Delaunay_triangulation_3 P3TD3_K3; + _test_periodic_3_triangulation_3_constructors( P3TD3_K3() ); + _test_cls_periodic_3_triangulation_3(P3TD3_K3(), + PDTT3::Point(0.711476,-0.0713565,-0.52312), + "data/P3DT3_covering_test_HOM.tri", + "data/P3DT3_covering_test.tri", + false /*not exact*/, + true /*homogeneous*/, + false /*do not test input/output*/); std::cerr << timer.time() << " sec." << std::endl; return 0; diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_tds.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_tds.cpp index a97c0c57448..ad35e28c69c 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_tds.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_tds.cpp @@ -14,7 +14,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Francois Rebufat // Manuel Caroli @@ -37,7 +37,7 @@ typedef CGAL::Triangulation_data_structure_3< K, CGAL::Periodic_3_triangulation_ds_vertex_base_3<> >, CGAL::Triangulation_cell_base_3< - K, + K, CGAL::Periodic_3_triangulation_ds_cell_base_3<> > > Tds; // Explicit instantiation : @@ -51,9 +51,9 @@ template class CGAL::Triangulation_data_structure_3< CGAL::Triangulation_ds_cell_base_3<> > >; -// just reusing the tests from the T3 package to check whether the +// just reusing the tests from the T3 package to check whether the // periodic vertices and cells fulfill the requirements. -int main() +int main(int, char**) { CGAL::Timer timer; timer.start(); diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.h b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.h index 4c632182e9b..9506840150e 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.h +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_3.h @@ -13,9 +13,9 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ -// $Id$ +// $Id$ // $Date$ -// +// // // Author(s) : Mariette Yvinec // Manuel Caroli diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_C_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_C_3.cpp index 1d64bab024d..808de2880db 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_C_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_C_3.cpp @@ -13,19 +13,19 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ -// $Id$ +// $Id$ // $Date$ -// +// // // Author(s) : Manuel Caroli #define TEST_CARTESIAN 1 -#define KERNEL CGAL::Cartesian< FT > -#define LAZY_KERNEL CGAL::Cartesian< LFT > +#define KERNEL CGAL::Cartesian< FT > +#define LAZY_KERNEL CGAL::Cartesian< LFT > #include "test_periodic_3_triangulation_traits_3.h" -int main() +int main(int, char**) { test_periodic_3_triangulation_traits_3(); } diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_H_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_H_3.cpp index 297f0ca6acd..82fe1859991 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_H_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_H_3.cpp @@ -13,18 +13,18 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ -// $Id$ +// $Id$ // $Date$ -// +// // // Author(s) : Manuel Caroli -#define KERNEL CGAL::Homogeneous< FT > -#define LAZY_KERNEL CGAL::Homogeneous< LFT > +#define KERNEL CGAL::Homogeneous< FT > +#define LAZY_KERNEL CGAL::Homogeneous< LFT > #include "test_periodic_3_triangulation_traits_3.h" -int main() +int main(int, char**) { test_periodic_3_triangulation_traits_3(); } diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SC_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SC_3.cpp index 78d16dc679e..672ad3008e4 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SC_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SC_3.cpp @@ -13,19 +13,19 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ -// $Id$ +// $Id$ // $Date$ -// +// // // Author(s) : Manuel Caroli #define TEST_CARTESIAN 1 -#define KERNEL CGAL::Simple_cartesian< FT > -#define LAZY_KERNEL CGAL::Simple_cartesian< LFT > +#define KERNEL CGAL::Simple_cartesian< FT > +#define LAZY_KERNEL CGAL::Simple_cartesian< LFT > #include "test_periodic_3_triangulation_traits_3.h" -int main() +int main(int, char**) { test_periodic_3_triangulation_traits_3(); } diff --git a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SH_3.cpp b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SH_3.cpp index 639b52d333f..ec2796a8575 100644 --- a/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SH_3.cpp +++ b/Periodic_3_triangulation_3/test/Periodic_3_triangulation_3/test_periodic_3_triangulation_traits_SH_3.cpp @@ -13,18 +13,18 @@ // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ -// $Id$ +// $Id$ // $Date$ -// +// // // Author(s) : Manuel Caroli -#define KERNEL CGAL::Simple_homogeneous< FT > -#define LAZY_KERNEL CGAL::Simple_homogeneous< LFT > +#define KERNEL CGAL::Simple_homogeneous< FT > +#define LAZY_KERNEL CGAL::Simple_homogeneous< LFT > #include "test_periodic_3_triangulation_traits_3.h" -int main() +int main(int, char**) { test_periodic_3_triangulation_traits_3(); } diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index fc7a00e66a3..e78784142e3 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -854,10 +854,8 @@ power_test(const Weighted_point &p0, // We sort the points lexicographically. const Weighted_point * points[4] = {&p0, &p1, &p2, &p}; - std::sort(points, points + 4, - boost::bind(&Self::compare_xy, this, - boost::bind(Dereference(), _1), - boost::bind(Dereference(), _2)) == SMALLER); + + std::sort(points, points + 4, typename Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h index 137817bf671..860f7297b57 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_euclidean_traits_2.h @@ -31,13 +31,13 @@ namespace CGAL { -template < class R, class W = typename R::RT> +template < class K, class W = typename K::RT> class Regular_triangulation_euclidean_traits_2 - : public R + : public K { public: Regular_triangulation_euclidean_traits_2() {} - Regular_triangulation_euclidean_traits_2(const R& k) : R(k) {} + Regular_triangulation_euclidean_traits_2(const K& k) : K(k) {} }; } //namespace CGAL diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_3.h index 2f6369302ed..0508bf8f22a 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_3.h @@ -29,13 +29,13 @@ of all simplices are regular. \tparam Traits is the geometric traits class, and must be a model of `RegularTriangulationTraits_3` \tparam TDS is the triangulation data structure and must be a model of `TriangulationDataStructure_3`. -TDS has default value `Triangulation_data_structure_3, - Regular_triangulation_cell_base_3 >`. +`Default` may be used with default value `Triangulation_data_structure_3, + Regular_triangulation_cell_base_3 >`. Any custom type can be used instead of `Regular_triangulation_vertex_base_3` and `Regular_triangulation_cell_base_3`, provided that they are models of the concepts `RegularTriangulationVertexBase_3` and `RegularTriangulationCellBase_3`, respectively. -`Default` may be used. + \tparam SLDS is an optional parameter to specify the type of the spatial lock data structure. It must be a model of the `SurjectiveLockDataStructure` concept, @@ -90,7 +90,7 @@ Creates an empty regular triangulation, possibly specifying a traits class `traits`. `lock_ds` is an optional pointer to the lock data structure for parallel operations. It must be provided if concurrency is enabled. -*/ +*/ Regular_triangulation_3(const Traits & traits = Traits(), Lock_data_structure *lock_ds = NULL); diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_cell_base_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_cell_base_3.h index 2ec4a8331cb..66235c137f3 100644 --- a/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_cell_base_3.h +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Regular_triangulation_cell_base_3.h @@ -24,7 +24,9 @@ By default, this parameter is instantiated by */ template< typename Traits, typename Cb > -class Regular_triangulation_cell_base_3 : public Cb { +class Regular_triangulation_cell_base_3 + : public Cb +{ public: /// \name Types diff --git a/Triangulation_3/doc/Triangulation_3/CGAL/Robust_weighted_circumcenter_filtered_traits_3.h b/Triangulation_3/doc/Triangulation_3/CGAL/Robust_weighted_circumcenter_filtered_traits_3.h new file mode 100644 index 00000000000..6651624d16d --- /dev/null +++ b/Triangulation_3/doc/Triangulation_3/CGAL/Robust_weighted_circumcenter_filtered_traits_3.h @@ -0,0 +1,61 @@ +namespace CGAL +{ + +/** + * \ingroup PkgTriangulation3TraitsClasses + * + * @class Robust_weighted_circumcenter_filtered_traits_3 + * + * Upgrades the functors models of `Kernel::ConstructWeightedCircumcenter_3`, + * `Kernel::ComputeSquaredRadius_3`, and `Kernel::ComputeSquaredRadiusSmallestOrthogonalSphere_3` + * that are provided by `K` with robust versions. This improved robustness + * is achieved by using exact computations if the geometric configuration + * is close to degenerate (e.g. almost coplanar points). The upgrade is completely + * invisible from an interface point of view as the class `Robust_weighted_circumcenter_filtered_traits_3` + * overrides the types and function objects associated with the basic versions. + * + * \tparam K must be a model of the `Kernel` concept. + * + * \sa \ref devman_robustness + */ +template +class Robust_weighted_circumcenter_filtered_traits_3 + : public K +{ +public: + /// \name Types + /// @{ + + /*! + a model of `Kernel::ConstructWeightedCircumcenter_3` + */ + typedef unspecified_type Construct_weighted_circumcenter_3; + + /*! + a model of `Kernel::ComputeSquaredRadius_3` + */ + typedef unspecified_type Compute_squared_radius_3; + + /*! + a model of `Kernel::ComputeSquaredRadiusSmallestOrthogonalSphere_3` + */ + typedef unspecified_type Compute_squared_radius_smallest_orthogonal_sphere_3; + + /// @} + + /// \name Operations + /// @{ + + Construct_weighted_circumcenter_3 + construct_weighted_circumcenter_3_object(); + + Compute_squared_radius_3 + compute_squared_radius_3_object(); + + Compute_squared_radius_smallest_orthogonal_sphere_3 + compute_squared_radius_smallest_orthogonal_sphere_3_object(); + + /// @} +}; + +} // end namespace CGAL diff --git a/Triangulation_3/doc/Triangulation_3/PackageDescription.txt b/Triangulation_3/doc/Triangulation_3/PackageDescription.txt index a902e280a2c..d958bf55812 100644 --- a/Triangulation_3/doc/Triangulation_3/PackageDescription.txt +++ b/Triangulation_3/doc/Triangulation_3/PackageDescription.txt @@ -104,6 +104,7 @@ is opposite to the vertex with the same index. See ### Traits Classes ### - `CGAL::Regular_triangulation_euclidean_traits_3` +- `CGAL::Robust_weighted_circumcenter_filtered_traits_3` ## Enums ## diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h index aa953ac960b..3f18c2f5e57 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_3.h @@ -905,18 +905,6 @@ protected: void hide_point(Cell_handle, const Point &) {} }; - class Perturbation_order { - const Self *t; - - public: - Perturbation_order(const Self *tr) - : t(tr) {} - - bool operator()(const Point *p, const Point *q) const { - return t->compare_xyz(*p, *q) == SMALLER; - } - }; - #ifdef CGAL_LINKED_WITH_TBB // Functor for parallel insert(begin, end) function template @@ -1132,7 +1120,6 @@ protected: template < class DelaunayTriangulation_3 > class Vertex_inserter; - friend class Perturbation_order; friend class Conflict_tester_3; friend class Conflict_tester_2; @@ -1458,7 +1445,7 @@ side_of_oriented_sphere(const Point &p0, const Point &p1, const Point &p2, // We sort the points lexicographically. const Point * points[5] = {&p0, &p1, &p2, &p3, &p}; - std::sort(points, points+5, Perturbation_order(this) ); + std::sort(points, points + 5, typename Tr_Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. @@ -1502,7 +1489,7 @@ coplanar_side_of_bounded_circle(const Point &p0, const Point &p1, // We sort the points lexicographically. const Point * points[4] = {&p0, &p1, &p2, &p}; - std::sort(points, points+4, Perturbation_order(this) ); + std::sort(points, points + 4, typename Tr_Base::Perturbation_order(this)); Orientation local = coplanar_orientation(p0, p1, p2); diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 1d19bc412bf..6e3b1332934 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -1850,16 +1850,7 @@ namespace CGAL { // We sort the points lexicographically. const Weighted_point * points[5] = {&p0, &p1, &p2, &p3, &p}; - // boost::bind is used twice, to grab the Bare_point within the Weighted_point*. - // `result_of` is used to go around the way the Lazy kernel works - // (simply grabbing it as a `const Bare_point&` would not work) - std::sort(points, points + 5, - boost::bind(geom_traits().compare_xyz_3_object(), - boost::bind::type>( - cp, boost::bind(Dereference(), _1)), - boost::bind::type>( - cp, boost::bind(Dereference(), _2))) - == SMALLER); + std::sort(points, points + 5, typename Tr_Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. @@ -1969,16 +1960,7 @@ namespace CGAL { // We sort the points lexicographically. const Weighted_point * points[4] = {&p0, &p1, &p2, &p}; - // boost::bind is used twice, to grab the Bare_point within the Weighted_point*. - // `result_of` is used to go around the way the Lazy kernel works - // (simply grabbing it as a `const Bare_point&` would not work) - std::sort(points, points + 4, - boost::bind(geom_traits().compare_xyz_3_object(), - boost::bind::type>( - cp, boost::bind(Dereference(), _1)), - boost::bind::type>( - cp, boost::bind(Dereference(), _2))) - == SMALLER); + std::sort(points, points + 4, typename Tr_Base::Perturbation_order(this)); // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h index 4d8add9c4ec..e9424d4f3ef 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_cell_base_3.h @@ -96,6 +96,9 @@ public: void hide_point(const Point& p) { hide_point_internal(p); } + void unhide_point(const Point_iterator pit) + { unhide_point_internal(pit); } + // Memory_policy is Tag_true ------------------------------------------------- template Point_iterator hidden_points_begin_internal(typename boost::enable_if_c::type* = NULL) @@ -115,6 +118,10 @@ public: void hide_point_internal(const Point& p, typename boost::enable_if_c::type* = NULL) { _hidden.push_back(p); } + template + void unhide_point_internal(const Point_iterator pit, typename boost::enable_if_c::type* = NULL) + { _hidden.erase(pit); } + // Memory_policy is Tag_false ------------------------------------------------ template Point_iterator hidden_points_begin_internal(typename boost::disable_if_c::type* = NULL) @@ -135,6 +142,10 @@ public: void hide_point_internal(const Point&, typename boost::disable_if_c::type* = NULL) { } + template + void unhide_point_internal(const Point_iterator, typename boost::disable_if_c::type* = NULL) + { } + //note this function is not requested by the RegularTriangulationCellBase_3 //it should be replaced everywhere by weighted_circumcenter() // but remains here for backward compatibility diff --git a/Mesh_3/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h b/Triangulation_3/include/CGAL/Robust_weighted_circumcenter_filtered_traits_3.h similarity index 70% rename from Mesh_3/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h rename to Triangulation_3/include/CGAL/Robust_weighted_circumcenter_filtered_traits_3.h index 30450f26d68..559f49dc52f 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h +++ b/Triangulation_3/include/CGAL/Robust_weighted_circumcenter_filtered_traits_3.h @@ -23,39 +23,37 @@ // //****************************************************************************** -#ifndef CGAL_MESH_3_ROBUST_WEIGHTED_CIRCUMCENTER_FILTERED_TRAITS_3_H -#define CGAL_MESH_3_ROBUST_WEIGHTED_CIRCUMCENTER_FILTERED_TRAITS_3_H - -#include - +#ifndef CGAL_ROBUST_WEIGHTED_CIRCUMCENTER_FILTERED_TRAITS_3_H +#define CGAL_ROBUST_WEIGHTED_CIRCUMCENTER_FILTERED_TRAITS_3_H +#include #include #include -#include #include #include -namespace CGAL { +namespace CGAL +{ template < typename K > class Robust_filtered_compute_squared_radius_3 - : public K::Compute_squared_radius_3 + : public K::Compute_squared_radius_3 { public: - typedef Exact_predicates_exact_constructions_kernel EK; - typedef Cartesian_converter To_exact; - typedef Cartesian_converter Back_from_exact; - - typedef typename K::Point_3 Point_3; - typedef typename K::FT FT; - typedef FT result_type; + typedef Exact_predicates_exact_constructions_kernel EK; + typedef Cartesian_converter To_exact; + typedef Cartesian_converter Back_from_exact; -#ifndef CGAL_CFG_MATCHING_BUG_6 + typedef typename K::Point_3 Point_3; + typedef typename K::FT FT; + typedef FT result_type; + +#ifndef CGAL_CFG_MATCHING_BUG_6 using K::Compute_squared_radius_3::operator(); #else // CGAL_CFG_MATCHING_BUG_6 - typedef typename K::Sphere_3 Sphere_3; - typedef typename K::Circle_3 Circle_3; + typedef typename K::Sphere_3 Sphere_3; + typedef typename K::Circle_3 Circle_3; result_type operator()( const Sphere_3& s) const @@ -90,21 +88,21 @@ public: const Point_3 & s ) const { typename K::Compute_squared_radius_3 sq_radius = - K().compute_squared_radius_3_object(); - + K().compute_squared_radius_3_object(); + // Compute denominator to swith to exact if it is 0 const FT denom = compute_denom(p,q,r,s); if ( ! CGAL_NTS is_zero(denom) ) { return sq_radius(p,q,r,s); } - + // Switch to exact To_exact to_exact; Back_from_exact back_from_exact; EK::Compute_squared_radius_3 exact_sq_radius = - EK().compute_squared_radius_3_object(); - + EK().compute_squared_radius_3_object(); + return back_from_exact(exact_sq_radius(to_exact(p), to_exact(q), to_exact(r), @@ -150,27 +148,25 @@ template < typename K_ > class Robust_filtered_construct_weighted_circumcenter_3 { public: - typedef Exact_predicates_exact_constructions_kernel EK; - typedef Cartesian_converter To_exact; - typedef Cartesian_converter Back_from_exact; - - typedef K_ Rt; - typedef EK Exact_Rt; - - typedef typename Rt::Weighted_point_3 Weighted_point_3; - typedef typename Rt::Point_3 Point_3; - typedef typename Rt::FT FT; - typedef typename Rt::Sphere_3 Sphere_3; - - typedef Point_3 result_type; - - typename Rt::Construct_point_3 wp2p; - typename Rt::Construct_weighted_point_3 p2wp; + typedef K_ K; + typedef Exact_predicates_exact_constructions_kernel EK; + typedef Cartesian_converter To_exact; + typedef Cartesian_converter Back_from_exact; + + typedef typename K::Weighted_point_3 Weighted_point_3; + typedef typename K::Point_3 Point_3; + typedef typename K::FT FT; + typedef typename K::Sphere_3 Sphere_3; + + typedef Point_3 result_type; + + typename K::Construct_point_3 wp2p; + typename K::Construct_weighted_point_3 p2wp; Robust_filtered_construct_weighted_circumcenter_3() : - wp2p(Rt().construct_point_3_object()), - p2wp(Rt().construct_weighted_point_3_object()) + wp2p(K().construct_point_3_object()), + p2wp(K().construct_weighted_point_3_object()) { } Point_3 operator() ( const Weighted_point_3 & p, @@ -179,19 +175,20 @@ public: const Weighted_point_3 & s, bool force_exact = false) const { - CGAL_precondition(Rt().orientation_3_object()( + CGAL_precondition(K().orientation_3_object()( wp2p(p), wp2p(q), wp2p(r), wp2p(s)) == CGAL::POSITIVE); - + if(! force_exact) { // We use power_side_of_power_sphere_3: it is static filtered and // we know that p,q,r,s are positive oriented - typename Rt::Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere = - Rt().power_side_of_oriented_power_sphere_3_object(); + typename K::Power_side_of_oriented_power_sphere_3 power_side_of_oriented_power_sphere = + K().power_side_of_oriented_power_sphere_3_object(); // Compute denominator to swith to exact if it is 0 FT num_x, num_y, num_z, den; - bool unweighted = (p.weight() == 0) && (q.weight() == 0) && (r.weight() == 0) && (s.weight() == 0); + bool unweighted = (p.weight() == 0) && (q.weight() == 0) && + (r.weight() == 0) && (s.weight() == 0); if(unweighted){ determinants_for_circumcenterC3(p.x(), p.y(), p.z(), @@ -227,99 +224,93 @@ public: // Switch to exact To_exact to_exact; Back_from_exact back_from_exact; - Exact_Rt::Construct_weighted_circumcenter_3 exact_weighted_circumcenter = - Exact_Rt().construct_weighted_circumcenter_3_object(); - + EK::Construct_weighted_circumcenter_3 exact_weighted_circumcenter = + EK().construct_weighted_circumcenter_3_object(); + return back_from_exact(exact_weighted_circumcenter(to_exact(p), to_exact(q), to_exact(r), to_exact(s))); } - + Point_3 operator() ( const Weighted_point_3 & p, const Weighted_point_3 & q, const Weighted_point_3 & r ) const { - CGAL_precondition(! Rt().collinear_3_object()(wp2p(p), - wp2p(q), - wp2p(r)) ); - - typename Rt::Side_of_bounded_sphere_3 side_of_bounded_sphere = - Rt().side_of_bounded_sphere_3_object(); - + CGAL_precondition(! K().collinear_3_object()(wp2p(p), wp2p(q), wp2p(r))); + + typename K::Side_of_bounded_sphere_3 side_of_bounded_sphere = + K().side_of_bounded_sphere_3_object(); + // Compute denominator to swith to exact if it is 0 FT num_x, num_y, num_z, den; determinants_for_weighted_circumcenterC3(p.x(), p.y(), p.z(), p.weight(), q.x(), q.y(), q.z(), q.weight(), r.x(), r.y(), r.z(), r.weight(), num_x, num_y, num_z, den); - + if ( ! CGAL_NTS is_zero(den) ) { FT inv = FT(1)/(FT(2) * den); Point_3 res(p.x() + num_x*inv, p.y() - num_y*inv, p.z() + num_z*inv); - + // Fast output if ( side_of_bounded_sphere(wp2p(p),wp2p(q),wp2p(r),res) == CGAL::ON_BOUNDED_SIDE ) return res; } - + // Switch to exact To_exact to_exact; Back_from_exact back_from_exact; - Exact_Rt::Construct_weighted_circumcenter_3 exact_weighted_circumcenter = - Exact_Rt().construct_weighted_circumcenter_3_object(); - + EK::Construct_weighted_circumcenter_3 exact_weighted_circumcenter = + EK().construct_weighted_circumcenter_3_object(); + return back_from_exact(exact_weighted_circumcenter(to_exact(p), to_exact(q), to_exact(r))); } - + Point_3 operator() ( const Weighted_point_3 & p, const Weighted_point_3 & q ) const { - typename Rt::Construct_weighted_circumcenter_3 weighted_circumcenter = - Rt().construct_weighted_circumcenter_3_object(); - - typename Rt::Side_of_bounded_sphere_3 side_of_bounded_sphere = - Rt().side_of_bounded_sphere_3_object(); - typename Rt::Construct_point_3 cp = - Rt().construct_point_3_object(); + typename K::Construct_weighted_circumcenter_3 weighted_circumcenter = + K().construct_weighted_circumcenter_3_object(); + + typename K::Side_of_bounded_sphere_3 side_of_bounded_sphere = + K().side_of_bounded_sphere_3_object(); + typename K::Construct_point_3 cp = + K().construct_point_3_object(); // No division here result_type point = weighted_circumcenter(p,q); - + // Fast output if ( side_of_bounded_sphere(cp(p), cp(q), point) == CGAL::ON_BOUNDED_SIDE ) return point; - + // Switch to exact To_exact to_exact; Back_from_exact back_from_exact; - Exact_Rt::Construct_weighted_circumcenter_3 exact_weighted_circumcenter = - Exact_Rt().construct_weighted_circumcenter_3_object(); - + EK::Construct_weighted_circumcenter_3 exact_weighted_circumcenter = + EK().construct_weighted_circumcenter_3_object(); + return back_from_exact(exact_weighted_circumcenter(to_exact(p), to_exact(q))); } }; - - - + template < typename K_ > class Robust_filtered_compute_squared_radius_smallest_orthogonal_sphere_3 { public: - typedef Exact_predicates_exact_constructions_kernel EK; - typedef Cartesian_converter To_exact; - typedef Cartesian_converter Back_from_exact; - - typedef K_ Rt; - typedef EK Exact_Rt; - - typedef typename Rt::Weighted_point_3 Weighted_point_3; - typedef typename Rt::FT FT; - + typedef K_ K; + typedef Exact_predicates_exact_constructions_kernel EK; + typedef Cartesian_converter To_exact; + typedef Cartesian_converter Back_from_exact; + + typedef typename K::Weighted_point_3 Weighted_point_3; + typedef typename K::FT FT; + FT operator() ( const Weighted_point_3& p, const Weighted_point_3& q, const Weighted_point_3& r, @@ -335,23 +326,22 @@ public: if ( ! CGAL_NTS is_zero(den) ) { FT inv = FT(1)/(FT(2) * den); - - return ( CGAL_NTS square(num_x) - + CGAL_NTS square(num_y) - + CGAL_NTS square(num_z) ) * CGAL_NTS square(inv) - p.weight(); + + return ( CGAL_NTS square(num_x) + + CGAL_NTS square(num_y) + + CGAL_NTS square(num_z) ) * CGAL_NTS square(inv) - p.weight(); } - + // Switch to exact To_exact to_exact; Back_from_exact back_from_exact; - Exact_Rt::Compute_squared_radius_smallest_orthogonal_sphere_3 exact_compute_radius = - Exact_Rt().compute_squared_radius_smallest_orthogonal_sphere_3_object(); - + EK::Compute_squared_radius_smallest_orthogonal_sphere_3 exact_compute_radius = + EK().compute_squared_radius_smallest_orthogonal_sphere_3_object(); + return back_from_exact(exact_compute_radius(to_exact(p),to_exact(q), to_exact(r),to_exact(s))); } - - + FT operator() (const Weighted_point_3& p, const Weighted_point_3& q, const Weighted_point_3& r) const @@ -362,26 +352,25 @@ public: q.x(), q.y(), q.z(), q.weight(), r.x(), r.y(), r.z(), r.weight(), num_x, num_y, num_z, den); - + if ( ! CGAL_NTS is_zero(den) ) { FT inv = FT(1)/(FT(2) * den); - - return ( CGAL_NTS square(num_x) - + CGAL_NTS square(num_y) - + CGAL_NTS square(num_z) ) * CGAL_NTS square(inv) - p.weight(); + + return ( CGAL_NTS square(num_x) + + CGAL_NTS square(num_y) + + CGAL_NTS square(num_z) ) * CGAL_NTS square(inv) - p.weight(); } // Switch to exact To_exact to_exact; Back_from_exact back_from_exact; - Exact_Rt::Compute_squared_radius_smallest_orthogonal_sphere_3 exact_compute_radius = - Exact_Rt().compute_squared_radius_smallest_orthogonal_sphere_3_object(); - + EK::Compute_squared_radius_smallest_orthogonal_sphere_3 exact_compute_radius = + EK().compute_squared_radius_smallest_orthogonal_sphere_3_object(); + return back_from_exact(exact_compute_radius(to_exact(p),to_exact(q),to_exact(r))); } - - + FT operator() (const Weighted_point_3& p, const Weighted_point_3& q) const { @@ -390,45 +379,41 @@ public: FT qpy = q.y() - p.y(); FT qpz = q.z() - p.z(); FT qp2 = CGAL_NTS square(qpx) + CGAL_NTS square(qpy) + CGAL_NTS square(qpz); - + if ( ! CGAL_NTS is_zero(qp2) ) { FT inv = FT(1)/(FT(2)*qp2); FT alpha = 1/FT(2) + (p.weight()-q.weight())*inv; - - return CGAL_NTS square(alpha)*qp2 - p.weight(); + + return CGAL_NTS square(alpha)*qp2 - p.weight(); } - + // Switch to exact To_exact to_exact; Back_from_exact back_from_exact; - Exact_Rt::Compute_squared_radius_smallest_orthogonal_sphere_3 exact_compute_radius = - Exact_Rt().compute_squared_radius_smallest_orthogonal_sphere_3_object(); - + EK::Compute_squared_radius_smallest_orthogonal_sphere_3 exact_compute_radius = + EK().compute_squared_radius_smallest_orthogonal_sphere_3_object(); + return back_from_exact(exact_compute_radius(to_exact(p),to_exact(q))); } - - + FT operator() (const Weighted_point_3& p) const { return -p.weight(); - } + } }; - -/** - * @class Robust_weighted_circumcenter_filtered_traits_3 - */ template -struct Robust_weighted_circumcenter_filtered_traits_3 -: public K_ +class Robust_weighted_circumcenter_filtered_traits_3 + : public K_ { +public: typedef CGAL::Robust_filtered_construct_weighted_circumcenter_3 Construct_weighted_circumcenter_3; typedef CGAL::Robust_filtered_compute_squared_radius_3 Compute_squared_radius_3; typedef CGAL::Robust_filtered_compute_squared_radius_smallest_orthogonal_sphere_3 - Compute_squared_radius_smallest_orthogonal_sphere_3; + Compute_squared_radius_smallest_orthogonal_sphere_3; Construct_weighted_circumcenter_3 construct_weighted_circumcenter_3_object() const @@ -437,14 +422,15 @@ struct Robust_weighted_circumcenter_filtered_traits_3 Compute_squared_radius_3 compute_squared_radius_3_object() const { return Compute_squared_radius_3(); } - + Compute_squared_radius_smallest_orthogonal_sphere_3 compute_squared_radius_smallest_orthogonal_sphere_3_object() const { return Compute_squared_radius_smallest_orthogonal_sphere_3(); } - -}; // end class Robust_weighted_circumcenter_filtered_traits_3 + Robust_weighted_circumcenter_filtered_traits_3() { } + Robust_weighted_circumcenter_filtered_traits_3(const K_& k) : K_(k) { } +}; } // end namespace CGAL -#endif // CGAL_MESH_3_ROBUST_WEIGHTED_CIRCUMCENTER_FILTERED_TRAITS_3_H +#endif // CGAL_ROBUST_WEIGHTED_CIRCUMCENTER_FILTERED_TRAITS_3_H diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 5e277ea25c4..06ba9e2b7cd 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -648,6 +648,19 @@ protected: return AFTER; } + // used as functor in std::sort in Delaunay and regular triangulations + struct Perturbation_order + { + bool operator()(const Point* p, const Point* q) const { + return t->compare_xyz(*p, *q) == SMALLER; + } + + Perturbation_order(const Self *tr) + : t(tr) {} + + const Self *t; + }; + void init_tds() { infinite = _tds.insert_increase_dimension(); diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index 247a6b3256f..936cdea5c2f 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -35,6 +35,7 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_regular_remove_3.cpp" ) create_single_source_cgal_program( "test_regular_traits_3.cpp" ) create_single_source_cgal_program( "test_RT_cell_base_with_weighted_circumcenter_3.cpp" ) + create_single_source_cgal_program( "test_robust_weighted_circumcenter.cpp" ) create_single_source_cgal_program( "test_simplex_3.cpp" ) create_single_source_cgal_program( "test_static_filters.cpp" ) create_single_source_cgal_program( "test_triangulation_3.cpp" ) diff --git a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_euclidean_traits_3.h b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_euclidean_traits_3.h index 1072873bca6..797da0b5ff7 100644 --- a/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_euclidean_traits_3.h +++ b/Triangulation_3/test/Triangulation_3/include/CGAL/_test_cls_regular_euclidean_traits_3.h @@ -17,9 +17,12 @@ // $Date$ // Author(s) : Mariette Yvinec +// Mael Rouxel-Labbé #include +#include + template void _test_cls_regular_euclidean_traits_3 (const Traits &) @@ -44,11 +47,11 @@ _test_cls_regular_euclidean_traits_3 (const Traits &) typedef typename Traits:: Compute_power_distance_to_power_sphere_3 - Compute_power_distance_to_power_sphere_3; + Compute_power_distance_to_power_sphere_3; CGAL_USE_TYPE(Segment_3); Traits traits; - Power_side_of_oriented_power_sphere_3 power_test = + Power_side_of_oriented_power_sphere_3 power_test = traits.power_side_of_oriented_power_sphere_3_object(); Compare_power_distance_3 compare_power_distance = traits.compare_power_distance_3_object(); @@ -63,7 +66,7 @@ _test_cls_regular_euclidean_traits_3 (const Traits &) traits.compute_squared_radius_smallest_orthogonal_sphere_3_object(); Compute_power_distance_to_power_sphere_3 compute_power_distance_to_power_sphere_3 = traits.compute_power_distance_to_power_sphere_3_object(); - + // test of Does_simplex_intersect_dual_support_3 std::cout << "test of Does_simplex_intersect_dual_support_3" << std::endl; @@ -81,7 +84,6 @@ _test_cls_regular_euclidean_traits_3 (const Traits &) Weighted_point_3 wp04(p0,18.); Weighted_point_3 wp05(p0,24.); - // test of Construct_weighted_circumcenter_3 and compare_power_distance std::cout << "test of Construct_weighted_circumcenter_3" << std::endl; std::cout << "test Of Compare_power_distance_3" << std::endl; @@ -125,59 +127,38 @@ _test_cls_regular_euclidean_traits_3 (const Traits &) typedef typename Traits::FT FT; FT ww02 = FT(2)/FT(3); Weighted_point_3 wq02(q0, ww02); - - assert(bounded_power_test(wq0, wq1, wq2) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq1, wq0, wq2) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq1, wq2, wq0) - == CGAL::ON_BOUNDARY); - assert(bounded_power_test(wq1, wq2, wq01) - == CGAL::ON_BOUNDED_SIDE); - assert(bounded_power_test(wq2, wq1, wq01) - == CGAL::ON_BOUNDED_SIDE); - assert(bounded_power_test(wq11, wq21, wq0) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq21, wq11, wq0) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq0, wq1, wq2, wq3) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq1, wq0, wq2, wq3) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq1, wq2, wq3, wq0) - == CGAL::ON_BOUNDED_SIDE); - assert(bounded_power_test(wq1, wq3, wq2, wq0) - == CGAL::ON_BOUNDED_SIDE); - assert(bounded_power_test(wq11, wq21, wq31, wq02) - == CGAL::ON_BOUNDARY); - assert(bounded_power_test(wq31, wq21, wq11, wq02) - == CGAL::ON_BOUNDARY); - - assert(bounded_power_test(wq0, wq1, wq2, wq3, wq4) - == CGAL::ON_BOUNDARY); - assert(bounded_power_test(wq1, wq0, wq2, wq3, wq4) - == CGAL::ON_BOUNDARY); - assert(bounded_power_test(wq01, wq11, wq21, wq31, wq4) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq01, wq21, wq11, wq31, wq4) - == CGAL::ON_UNBOUNDED_SIDE); - assert(bounded_power_test(wq0, wq1, wq2, wq3, wq41) - == CGAL::ON_BOUNDED_SIDE); - assert(bounded_power_test(wq0, wq1, wq3, wq2, wq41) - == CGAL::ON_BOUNDED_SIDE); - + assert(bounded_power_test(wq0, wq1, wq2) == CGAL::ON_UNBOUNDED_SIDE); + assert(bounded_power_test(wq1, wq0, wq2) == CGAL::ON_UNBOUNDED_SIDE); + assert(bounded_power_test(wq1, wq2, wq0) == CGAL::ON_BOUNDARY); + assert(bounded_power_test(wq1, wq2, wq01) == CGAL::ON_BOUNDED_SIDE); + assert(bounded_power_test(wq2, wq1, wq01) == CGAL::ON_BOUNDED_SIDE); + assert(bounded_power_test(wq11, wq21, wq0) == CGAL::ON_UNBOUNDED_SIDE); + assert(bounded_power_test(wq21, wq11, wq0) == CGAL::ON_UNBOUNDED_SIDE); + + assert(bounded_power_test(wq0, wq1, wq2, wq3) == CGAL::ON_UNBOUNDED_SIDE); + assert(bounded_power_test(wq1, wq0, wq2, wq3) == CGAL::ON_UNBOUNDED_SIDE); + assert(bounded_power_test(wq1, wq2, wq3, wq0) == CGAL::ON_BOUNDED_SIDE); + assert(bounded_power_test(wq1, wq3, wq2, wq0) == CGAL::ON_BOUNDED_SIDE); + assert(bounded_power_test(wq11, wq21, wq31, wq02) == CGAL::ON_BOUNDARY); + assert(bounded_power_test(wq31, wq21, wq11, wq02) == CGAL::ON_BOUNDARY); + + assert(bounded_power_test(wq0, wq1, wq2, wq3, wq4) == CGAL::ON_BOUNDARY); + assert(bounded_power_test(wq1, wq0, wq2, wq3, wq4) == CGAL::ON_BOUNDARY); + assert(bounded_power_test(wq01, wq11, wq21, wq31, wq4) == CGAL::ON_UNBOUNDED_SIDE); + assert(bounded_power_test(wq01, wq21, wq11, wq31, wq4) == CGAL::ON_UNBOUNDED_SIDE); + assert(bounded_power_test(wq0, wq1, wq2, wq3, wq41) == CGAL::ON_BOUNDED_SIDE); + assert(bounded_power_test(wq0, wq1, wq3, wq2, wq41) == CGAL::ON_BOUNDED_SIDE); + // test weighted_circumcenter // test squared_radius_smallest_orthogonal_sphere - // test critical_squared_radius - std::cout << "test of squared_radius_smallest_orthogonal_sphere" - << std::endl; - std::cout << "test of critical_squared_radius" << std::endl; + std::cout << "test of weighted_circumcenter" << std::endl; + std::cout << "test of squared_radius_smallest_orthogonal_sphere" << std::endl; Weighted_point_3 wc(weighted_circumcenter(wq11,wq21,wq31,wq41), squared_radius_smallest_orthogonal_sphere(wq11,wq21,wq31,wq41)); Weighted_point_3 wt(Point_3(1.,1.,1.), 0.); - // this test requires a weighted point with a zero weight - assert( power_product(wc,wt) == + // this test requires a weighted point with a zero weight + assert( power_product(wc,wt) == compute_power_distance_to_power_sphere_3(wq11,wq21,wq31,wq41,wt)); wc = Weighted_point_3(weighted_circumcenter(wp0,wp1,wp2,wp3), @@ -187,9 +168,10 @@ _test_cls_regular_euclidean_traits_3 (const Traits &) wc = Weighted_point_3(weighted_circumcenter(wp01,wp1,wp2,wp3), squared_radius_smallest_orthogonal_sphere(wp01,wp1,wp2,wp3)); - assert( power_product(wc,wt) == + + assert( power_product(wc,wt) == compute_power_distance_to_power_sphere_3(wp01,wp1,wp2,wp3,wt)); - + // test power_test // null weights assert(power_test(wq0,wq1,wq2,wq3,wq4) == @@ -199,15 +181,7 @@ _test_cls_regular_euclidean_traits_3 (const Traits &) assert(power_test(wq0,wq1,wq2,wq5) == CGAL::ON_NEGATIVE_SIDE && traits.coplanar_side_of_bounded_circle_3_object()(q0,q1,q2,q5) == CGAL::ON_UNBOUNDED_SIDE); - /* - assert(power_test(wq5,wq1,wq0) == CGAL::ON_POSITIVE_SIDE && - (Segment_3(wq5,wq1)).has_on(wq0)); - assert(power_test(wq5,wq1,wq5) == CGAL::ON_ORIENTED_BOUNDARY && - (Segment_3(wq5,wq1)).has_on(wq5)); - assert(power_test(wq5,wq1,wq6) == CGAL::ON_NEGATIVE_SIDE && - !(Segment_3(wq5,wq1)).has_on(wq6)); - assert(power_test(wq3,wq2) == CGAL::ON_ORIENTED_BOUNDARY); - */ + // wc = (1,1,1) -3 assert(power_test(wp01,wp1,wp2,wp3,wc) == CGAL::ON_NEGATIVE_SIDE); Weighted_point_3 wt2(wc.point(), wc.weight()+6); diff --git a/Mesh_3/test/Mesh_3/test_robust_weighted_circumcenter.cpp b/Triangulation_3/test/Triangulation_3/test_robust_weighted_circumcenter.cpp similarity index 78% rename from Mesh_3/test/Mesh_3/test_robust_weighted_circumcenter.cpp rename to Triangulation_3/test/Triangulation_3/test_robust_weighted_circumcenter.cpp index d05d70dd852..9c4d51a204c 100644 --- a/Mesh_3/test/Mesh_3/test_robust_weighted_circumcenter.cpp +++ b/Triangulation_3/test/Triangulation_3/test_robust_weighted_circumcenter.cpp @@ -16,33 +16,27 @@ // $Id$ // // -// Author(s) : Stephane Tayeb +// Author(s) : Stephane Tayeb, Mael Rouxel-Labbé // //****************************************************************************** // File Description : // //****************************************************************************** -#include "test_utilities.h" -#include -#include +#include +#include + +#include + #include template struct Tester { - typedef CGAL::Polyhedron_3 Polyhedron; - typedef CGAL::Polyhedral_mesh_domain_3 Mesh_traits; - - typedef typename CGAL::Mesh_triangulation_3::type Tr; - - typedef typename Tr::Bare_point Bare_point; - typedef typename Tr::Weighted_point Weighted_point; - - typedef typename Tr::Geom_traits Gt; - typedef typename Gt::FT FT; - - typedef CGAL::Regular_triangulation_3 Triangulation; + typedef CGAL::Robust_weighted_circumcenter_filtered_traits_3 Gt; + typedef typename Gt::FT FT; + typedef typename Gt::Point_3 Point_3; + typedef typename Gt::Weighted_point_3 Weighted_point_3; void operator()() const { @@ -52,12 +46,12 @@ struct Tester FT little(1e-10); FT tiny(1e-25); - Weighted_point p1(little,1,tiny); - Weighted_point p2(1,little,0); - Weighted_point p3(-1*little,1,0); - Weighted_point p4(1,-1*little,0); - Weighted_point p5(0,0,1); - Weighted_point p6(0,1,0); + Weighted_point_3 p1(little, 1, tiny); + Weighted_point_3 p2(1, little, 0); + Weighted_point_3 p3(-1*little, 1, 0); + Weighted_point_3 p4(1, -1*little, 0); + Weighted_point_3 p5(0, 0, 1); + Weighted_point_3 p6(0, 1, 0); std::cerr << "Using points: p1[" << p1 << "]\tp2[" << p2 << "]\tp3[" << p3 << "]\tp4[" << p4 << "]\tp5[" << p5 @@ -69,7 +63,7 @@ struct Tester typename Gt::Construct_weighted_circumcenter_3 circumcenter = Gt().construct_weighted_circumcenter_3_object(); - Bare_point center = circumcenter(p1,p2); + Point_3 center = circumcenter(p1,p2); std::cerr << "\tcircumcenter(p1,p2)=[" << center << "]\n"; center = circumcenter(p1,p3,p6); @@ -85,7 +79,6 @@ struct Tester center = circumcenter(p1,p3,p2,p5); std::cerr << "\tcircumcenter(p1,p3,p2,p5)=[" << center << "]\n"; - //------------------------------------------------------- // Test speed //------------------------------------------------------- @@ -109,10 +102,10 @@ struct Tester std::cerr << "\t" << nb_loop*1000/timer.time() << " circumcenter computation / second\n"; - + std::cerr << "Test speed: compute loops of: 999*c(p2,p3,p4,p1) " << "and 1*c(p1,p3,p2,p5)\n"; - + timer.reset(); timer.start(); nb_loop = 0; @@ -121,7 +114,7 @@ struct Tester // Compute 1 exact queries for ( int i = 0 ; i < 999 ; ++i) circumcenter(p2,p3,p4,p1); - + // Compute 1 fast query circumcenter(p1,p3,p2,p5); ++nb_loop; @@ -129,21 +122,22 @@ struct Tester timer.stop(); std::cerr << "\t" << nb_loop*1000/timer.time() << " circumcenter computation / second\n"; - } }; - int main() { + typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick; + typedef CGAL::Exact_predicates_exact_constructions_kernel Epeck; + std::cerr << "TESTING WITH Exact_predicates_inexact_constructions_kernel...\n"; - Tester test_epic; + Tester test_epic; test_epic(); std::cerr << "\nTESTING WITH Exact_predicates_exact_constructions_kernel...\n"; - Tester test_epec; + Tester test_epec; test_epec(); - + // std::cerr << "\nTESTING WITH Filtered_kernel > kernel...\n"; // Tester > > test_scf; // test_scf();