- Upgrade to Triangulation_3's new design.

- Remove calls to undocumented .handle().
This commit is contained in:
Sylvain Pion 2003-05-25 19:09:13 +00:00
parent 27544bb8ad
commit a844c28589
8 changed files with 58 additions and 81 deletions

View File

@ -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

View File

@ -18,7 +18,6 @@ to the Alpha Shape.
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Triangulation_cell_base_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Alpha_shape_euclidean_traits_3.h>
@ -62,9 +61,7 @@ typedef K::Triangle_3 Triangle;
typedef CGAL::Alpha_shape_euclidean_traits_3<K> Gt;
typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb;
typedef CGAL::Triangulation_cell_base_3<Gt> Df;
typedef CGAL::Alpha_shape_cell_base_3<Gt, Df> Fb;
typedef CGAL::Alpha_shape_cell_base_3<Gt> Fb;
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_3<Gt,Tds> Triangulation_3;

View File

@ -15,7 +15,6 @@ to the Alpha Shape.
#include <list>
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Triangulation_cell_base_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Weighted_alpha_shape_euclidean_traits_3.h>
@ -59,9 +58,7 @@ typedef CGAL::Weighted_alpha_shape_euclidean_traits_3<K> Gt;
typedef Gt::Point Wpoint;
typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb;
typedef CGAL::Triangulation_cell_base_3<Gt> Df;
typedef CGAL::Alpha_shape_cell_base_3<Gt, Df> Fb;
typedef CGAL::Alpha_shape_cell_base_3<Gt> Fb;
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Regular_triangulation_3<Gt,Tds> Triangulation_3;

View File

@ -799,22 +799,15 @@ template <class Dt>
void
Alpha_shape_3<Dt>::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<Dt>::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<Dt>::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<Dt>::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<Dt>::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<Dt>::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<Dt>::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<Dt>::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);

View File

@ -26,14 +26,22 @@
#include <vector>
#include <CGAL/utility.h>
#include <CGAL/Triangulation_cell_base_3.h>
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<Gt> >
class Alpha_shape_cell_base_3
: public Cb
{
public:
template < typename TDS2 >
struct Rebind_TDS {
typedef typename Cb::template Rebind_TDS<TDS2>::Other Cb2;
typedef Alpha_shape_cell_base_3<Gt, Cb2> Other;
};
typedef typename Gt::FT Coord_type;
typedef Triple<Coord_type, Coord_type, Coord_type> 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)
{}

View File

@ -32,34 +32,36 @@
CGAL_BEGIN_NAMESPACE
//-------------------------------------------------------------------
template <class Gt>
class Alpha_shape_vertex_base_3 : public Triangulation_vertex_base_3<Gt>
template <class Gt, class Vb = Triangulation_vertex_base_3<Gt> >
class Alpha_shape_vertex_base_3
: public Vb
{
public:
template < typename TDS2 >
struct Rebind_TDS {
typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
typedef Alpha_shape_vertex_base_3<Gt, Vb2> 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<Gt>()
{}
: Vb() {}
Alpha_shape_vertex_base_3(const Point& p)
: Triangulation_vertex_base_3<Gt>(p)
{}
: Vb(p) {}
Alpha_shape_vertex_base_3(const Point& p, void* f)
: Triangulation_vertex_base_3<Gt>(p, f)
{}
: Vb(p, f) {}
//-------------------------------------------------------------------

View File

@ -14,7 +14,6 @@ the Alpha Shape.
#include <list>
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Triangulation_cell_base_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Alpha_shape_euclidean_traits_3.h>
@ -48,9 +47,7 @@ typedef K::Triangle_3 Triangle;
typedef CGAL::Alpha_shape_euclidean_traits_3<K> Gt;
typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb;
typedef CGAL::Triangulation_cell_base_3<Gt> Df;
typedef CGAL::Alpha_shape_cell_base_3<Gt, Df> Fb;
typedef CGAL::Alpha_shape_cell_base_3<Gt> Fb;
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Delaunay_triangulation_3<Gt,Tds> Triangulation_3;

View File

@ -14,7 +14,6 @@ the Alpha Shape.
#include <list>
#include <CGAL/Alpha_shape_vertex_base_3.h>
#include <CGAL/Triangulation_cell_base_3.h>
#include <CGAL/Alpha_shape_cell_base_3.h>
#include <CGAL/Triangulation_data_structure_3.h>
#include <CGAL/Weighted_alpha_shape_euclidean_traits_3.h>
@ -47,10 +46,9 @@ typedef K::Triangle_3 Triangle;
typedef CGAL::Weighted_alpha_shape_euclidean_traits_3<K> Gt;
typedef Gt::Point Wpoint;
typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb;
typedef CGAL::Triangulation_cell_base_3<Gt> Df;
typedef CGAL::Alpha_shape_cell_base_3<Gt, Df> Fb;
typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb;
typedef CGAL::Alpha_shape_cell_base_3<Gt> Fb;
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Regular_triangulation_3<Gt,Tds> Triangulation_3;