diff --git a/Packages/Alpha_shapes_3/changes.txt b/Packages/Alpha_shapes_3/changes.txt index b585c0ed97f..cf2faa1952c 100644 --- a/Packages/Alpha_shapes_3/changes.txt +++ b/Packages/Alpha_shapes_3/changes.txt @@ -1,3 +1,7 @@ +version 3.18 (25/05/03) +- Upgrade to Triangulation_3's new design. +- Remove calls to undocumented .handle(). + version 3.17 (22/08/02) MY - fixed a bug in function classify(Point p, ..) of Alpha_shapes_3.h diff --git a/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_alpha.C b/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_alpha.C index a4d5f7f5cd9..7d6d9e346d8 100644 --- a/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_alpha.C +++ b/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_alpha.C @@ -18,7 +18,6 @@ to the Alpha Shape. #include -#include #include #include #include @@ -62,9 +61,7 @@ typedef K::Triangle_3 Triangle; typedef CGAL::Alpha_shape_euclidean_traits_3 Gt; typedef CGAL::Alpha_shape_vertex_base_3 Vb; - -typedef CGAL::Triangulation_cell_base_3 Df; -typedef CGAL::Alpha_shape_cell_base_3 Fb; +typedef CGAL::Alpha_shape_cell_base_3 Fb; typedef CGAL::Triangulation_data_structure_3 Tds; typedef CGAL::Delaunay_triangulation_3 Triangulation_3; diff --git a/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_weight.C b/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_weight.C index bffbf30812a..21023e74695 100644 --- a/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_weight.C +++ b/Packages/Alpha_shapes_3/demo/Alpha_shapes_3/demo_weight.C @@ -15,7 +15,6 @@ to the Alpha Shape. #include #include -#include #include #include #include @@ -59,9 +58,7 @@ typedef CGAL::Weighted_alpha_shape_euclidean_traits_3 Gt; typedef Gt::Point Wpoint; typedef CGAL::Alpha_shape_vertex_base_3 Vb; - -typedef CGAL::Triangulation_cell_base_3 Df; -typedef CGAL::Alpha_shape_cell_base_3 Fb; +typedef CGAL::Alpha_shape_cell_base_3 Fb; typedef CGAL::Triangulation_data_structure_3 Tds; typedef CGAL::Regular_triangulation_3 Triangulation_3; diff --git a/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h b/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h index 79a9afc69d0..96939af8d42 100644 --- a/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h +++ b/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_3.h @@ -799,22 +799,15 @@ template void Alpha_shape_3
::initialize_interval_cell_map() { - Finite_cells_iterator cell_it; - Cell_handle pCell; + Finite_cells_iterator cell_it, done = finite_cells_end(); Coord_type alpha_f; - for( cell_it = finite_cells_begin(); - cell_it != finite_cells_end(); - ++cell_it) - { - pCell = cell_it->handle(); - - alpha_f = squared_radius(pCell); - - _interval_cell_map.insert(Interval_cell(alpha_f, (pCell))); + for( cell_it = finite_cells_begin(); cell_it != done; ++cell_it) { + alpha_f = squared_radius(cell_it); + _interval_cell_map.insert(Interval_cell(alpha_f, cell_it)); // cross references - pCell->set_alpha(alpha_f); + cell_it->set_alpha(alpha_f); } } @@ -1047,12 +1040,8 @@ Alpha_shape_3
::initialize_interval_vertex_map() vertex_it != finite_vertices_end(); ++vertex_it) { - Vertex_handle v = vertex_it->handle(); - - if (!is_infinite(v)) // TBC + if (!is_infinite(vertex_it)) // TBC { - Cell_handle s; - alpha_max_v = 0; alpha_mid_v = (!_interval_cell_map.empty() ? (--_interval_cell_map.end())->first : @@ -1064,7 +1053,7 @@ Alpha_shape_3
::initialize_interval_vertex_map() // regular means incident to a 3-dimensional face //-------------------------------------------------------------- -// Cell_circulator cell_circ = v->incident_simplices(), +// Cell_circulator cell_circ = vertex_it->incident_simplices(), // done(cell_circ); // if ((*cell_circ) != NULL) @@ -1096,13 +1085,11 @@ Alpha_shape_3
::initialize_interval_vertex_map() // TBC if cell_circulator become available // at the moment takes v*s time - Cell_iterator cell_it; - for( cell_it = cells_begin(); - cell_it != cells_end(); - ++cell_it) + Cell_iterator cell_it, done = cells_end(); + for( cell_it = cells_begin(); cell_it != done; ++cell_it) { - s = cell_it->handle(); - if (s->has_vertex(vertex_it->handle())) + Cell_handle s = cell_it; + if (s->has_vertex(vertex_it)) { if (is_infinite(s)) { @@ -1124,11 +1111,10 @@ Alpha_shape_3
::initialize_interval_vertex_map() } Interval2 interval = std::make_pair(alpha_mid_v, alpha_max_v); - _interval_vertex_map.insert(Interval_vertex(interval, - vertex_it->handle())); + _interval_vertex_map.insert(Interval_vertex(interval, vertex_it)); // cross references - vertex_it->handle()->set_range(interval); + vertex_it->set_range(interval); } } } @@ -1736,15 +1722,13 @@ Alpha_shape_3
::number_of_solid_components(const Coord_type& alpha) const // O(#alpha_shape log n) otherwise { Marked_cell_set marked_cell_set; - Finite_cells_iterator cell_it; + Finite_cells_iterator cell_it, done = finite_cells_end(); int nb_solid_components = 0; // only finite simplices - for( cell_it = finite_cells_begin(); - cell_it != finite_cells_end(); - ++cell_it) + for( cell_it = finite_cells_begin(); cell_it != done; ++cell_it) { - Cell_handle pCell = cell_it->handle(); + Cell_handle pCell = cell_it; assert(pCell != NULL); if (classify(pCell, alpha) == INTERIOR && @@ -1847,14 +1831,12 @@ Alpha_shape_3
::find_alpha_solid() const { Coord_type alpha_solid = 0; - Vertex_iterator vertex_it; + Vertex_iterator vertex_it, done = vertices_end(); // at the moment all finite + infinite vertices - for( vertex_it = vertices_begin(); - vertex_it != vertices_end(); - ++vertex_it) + for( vertex_it = vertices_begin(); vertex_it != done; ++vertex_it) { - if (!is_infinite(vertex_it->handle())) + if (!is_infinite(vertex_it)) { // consider only finite vertices Coord_type alpha_min_v = (--_interval_cell_map.end())->first; @@ -1876,20 +1858,12 @@ Alpha_shape_3
::find_alpha_solid() const // TBC if cell_circulator become available // at the moment takes v*s time - Cell_iterator cell_it; - for( cell_it = cells_begin(); - cell_it != cells_end(); - ++cell_it) + Cell_iterator cell_it, done = cells_end(); + for( cell_it = cells_begin(); cell_it != done; ++cell_it) { - Cell_handle s = cell_it->handle(); - if (s->has_vertex(vertex_it->handle())) - { - if (! is_infinite(s)) - { - alpha_min_v = CGAL::min(find_interval(s), - alpha_min_v); - } - } + Cell_handle s = cell_it; + if (s->has_vertex(vertex_it) && ! is_infinite(s)) + alpha_min_v = CGAL::min(find_interval(s), alpha_min_v); } alpha_solid = CGAL::max(alpha_min_v, alpha_solid); diff --git a/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_cell_base_3.h b/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_cell_base_3.h index e7833c5dae6..9ddedcd4d05 100644 --- a/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_cell_base_3.h +++ b/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_cell_base_3.h @@ -26,14 +26,22 @@ #include #include +#include CGAL_BEGIN_NAMESPACE -template < class Gt, class Df > -class Alpha_shape_cell_base_3 : public Df +template < class Gt, class Cb = Triangulation_cell_base_3 > +class Alpha_shape_cell_base_3 + : public Cb { public: + template < typename TDS2 > + struct Rebind_TDS { + typedef typename Cb::template Rebind_TDS::Other Cb2; + typedef Alpha_shape_cell_base_3 Other; + }; + typedef typename Gt::FT Coord_type; typedef Triple Interval3; @@ -48,16 +56,16 @@ private: public: Alpha_shape_cell_base_3() - : Df() + : Cb() {} Alpha_shape_cell_base_3(void* v0, void* v1, void* v2, void* v3) - : Df( v0, v1, v2, v3) + : Cb( v0, v1, v2, v3) {} Alpha_shape_cell_base_3(void* v0, void* v1, void* v2, void* v3, void* n0, void* n1, void* n2, void* n3) - : Df(v0, v1, v2, v3, + : Cb(v0, v1, v2, v3, n0, n1, n2, n3) {} diff --git a/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_vertex_base_3.h b/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_vertex_base_3.h index 1c4f13bb4d3..78a6d14cca7 100644 --- a/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_vertex_base_3.h +++ b/Packages/Alpha_shapes_3/include/CGAL/Alpha_shape_vertex_base_3.h @@ -32,34 +32,36 @@ CGAL_BEGIN_NAMESPACE //------------------------------------------------------------------- -template -class Alpha_shape_vertex_base_3 : public Triangulation_vertex_base_3 +template > +class Alpha_shape_vertex_base_3 + : public Vb { public: + template < typename TDS2 > + struct Rebind_TDS { + typedef typename Vb::template Rebind_TDS::Other Vb2; + typedef Alpha_shape_vertex_base_3 Other; + }; + typedef typename Gt::Coord_type Coord_type; typedef std::pair< Coord_type, Coord_type > Interval2; typedef typename Gt::Point Point; - //------------------------------------------------------------------- private: Interval2 I; - //------------------------------------------------------------------- public: Alpha_shape_vertex_base_3() - : Triangulation_vertex_base_3() - {} + : Vb() {} Alpha_shape_vertex_base_3(const Point& p) - : Triangulation_vertex_base_3(p) - {} + : Vb(p) {} Alpha_shape_vertex_base_3(const Point& p, void* f) - : Triangulation_vertex_base_3(p, f) - {} + : Vb(p, f) {} //------------------------------------------------------------------- diff --git a/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_alpha.C b/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_alpha.C index d631086967f..337203dc228 100644 --- a/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_alpha.C +++ b/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_alpha.C @@ -14,7 +14,6 @@ the Alpha Shape. #include #include -#include #include #include #include @@ -48,9 +47,7 @@ typedef K::Triangle_3 Triangle; typedef CGAL::Alpha_shape_euclidean_traits_3 Gt; typedef CGAL::Alpha_shape_vertex_base_3 Vb; - -typedef CGAL::Triangulation_cell_base_3 Df; -typedef CGAL::Alpha_shape_cell_base_3 Fb; +typedef CGAL::Alpha_shape_cell_base_3 Fb; typedef CGAL::Triangulation_data_structure_3 Tds; typedef CGAL::Delaunay_triangulation_3 Triangulation_3; diff --git a/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_weight.C b/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_weight.C index ca10119d5e6..7849c10c24b 100644 --- a/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_weight.C +++ b/Packages/Alpha_shapes_3/test/Alpha_shapes_3/test_weight.C @@ -14,7 +14,6 @@ the Alpha Shape. #include #include -#include #include #include #include @@ -47,10 +46,9 @@ typedef K::Triangle_3 Triangle; typedef CGAL::Weighted_alpha_shape_euclidean_traits_3 Gt; typedef Gt::Point Wpoint; -typedef CGAL::Alpha_shape_vertex_base_3 Vb; -typedef CGAL::Triangulation_cell_base_3 Df; -typedef CGAL::Alpha_shape_cell_base_3 Fb; +typedef CGAL::Alpha_shape_vertex_base_3 Vb; +typedef CGAL::Alpha_shape_cell_base_3 Fb; typedef CGAL::Triangulation_data_structure_3 Tds; typedef CGAL::Regular_triangulation_3 Triangulation_3;