- Replace NULL by default constructed Handles.

This commit is contained in:
Sylvain Pion 2004-01-13 09:37:13 +00:00
parent d7bce7f322
commit 40e44e255e
11 changed files with 135 additions and 120 deletions

View File

@ -1,5 +1,6 @@
Version 1.188 (?? January 04)
- Remove useless friend declarations.
- Replace NULL by default constructed Handles.
Version 1.187 (07 January 04)
- cleaning in demos and doc (#include for geomview)

View File

@ -187,7 +187,7 @@ public:
return number_of_vertices() - n;
}
Vertex_handle insert(const Point & p, Cell_handle start = NULL);
Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle());
Vertex_handle insert(const Point & p, Locate_type lt,
Cell_handle c, int li, int);
@ -345,7 +345,7 @@ public:
nearest_vertex_in_cell(const Point& p, const Cell_handle& c) const;
Vertex_handle
nearest_vertex(const Point& p, Cell_handle c = NULL) const;
nearest_vertex(const Point& p, Cell_handle c = Cell_handle()) const;
Point dual(Cell_handle c) const;
@ -543,7 +543,7 @@ move_point(Vertex_handle v, const Point & p)
CGAL_triangulation_expensive_assertion(number_of_vertices() == 0
|| tds().is_cell(c));
return insert(p, number_of_vertices() == 0 ? Cell_handle(NULL) : c);
return insert(p, number_of_vertices() == 0 ? Cell_handle() : c);
}
template < class Gt, class Tds >
@ -716,7 +716,7 @@ make_hole_2D(Vertex_handle v, std::list<Edge_2D> & hole)
int in = fn->index(f);
f->vertex(cw(i))->set_cell(fn);
fn->set_neighbor(in, NULL);
fn->set_neighbor(in, Cell_handle());
hole.push_back(Edge_2D(fn, in));
to_delete.push_back(f);
@ -822,7 +822,7 @@ remove_3D_new(Vertex_handle v)
Unique_hash_map<Vertex_handle,Vertex_handle> vmap;
Cell_handle ch(NULL);
Cell_handle ch = Cell_handle();
for(i=0; i < vertices.size(); i++){
if(! is_infinite(vertices[i])){
Vertex_handle vh = aux.insert(vertices[i]->point(), ch);
@ -935,7 +935,7 @@ bool
Delaunay_triangulation_3<Gt,Tds>::
remove(Vertex_handle v)
{
CGAL_triangulation_precondition( v != NULL);
CGAL_triangulation_precondition( v != Vertex_handle());
CGAL_triangulation_precondition( !is_infinite(v));
CGAL_triangulation_expensive_precondition( tds().is_vertex(v) );
@ -1251,7 +1251,7 @@ Delaunay_triangulation_3<Gt,Tds>::
nearest_vertex(const Point& p, Cell_handle start) const
{
if (number_of_vertices() == 0)
return Vertex_handle(NULL);
return Vertex_handle();
// Use a brute-force algorithm if dimension < 3.
if (dimension() < 3) {
@ -1356,7 +1356,7 @@ is_valid(bool verbose, int level) const
return false;
}
if ( infinite_vertex() == NULL ) {
if ( infinite_vertex() == Vertex_handle() ) {
if (verbose)
std::cerr << "no infinite vertex" << std::endl;
CGAL_triangulation_assertion(false);

View File

@ -1,4 +1,4 @@
// Copyright (c) 1999 INRIA Sophia-Antipolis (France).
// Copyright (c) 1999-2004 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
@ -93,7 +93,8 @@ public:
return number_of_vertices() - n;
}
Vertex_handle insert(const Weighted_point & p, Cell_handle start = NULL);
Vertex_handle insert(const Weighted_point & p,
Cell_handle start = Cell_handle());
Vertex_handle insert(const Weighted_point & p, Locate_type lt,
Cell_handle c, int li, int);
@ -187,10 +188,10 @@ private:
for (int i=0; i<4; i++)
{
Vertex_handle v = c->vertex(i);
if (v->cell() != NULL)
if (v->cell() != Cell_handle())
{
cv.push_back(v);
v->set_cell(NULL);
v->set_cell(Cell_handle());
}
}
return true;
@ -222,10 +223,10 @@ private:
for (int i=0; i<3; i++)
{
Vertex_handle v = c->vertex(i);
if (v->cell() != NULL)
if (v->cell() != Cell_handle())
{
cv.push_back(v);
v->set_cell(NULL);
v->set_cell(Cell_handle());
}
}
return true;
@ -392,7 +393,7 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
if (lt == Tr_Base::VERTEX)
return c->vertex(li); // by coinciding point
else
return NULL; // by cell
return Vertex_handle(); // by cell
}
// Should I mark c's vertices too ?
@ -403,7 +404,7 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
it = tester.conflict_vector().begin();
it != tester.conflict_vector().end(); ++it)
{
if ((*it)->cell() == NULL)
if ((*it)->cell() == Cell_handle())
{
// vertex has to be deleted
tds().delete_vertex(*it);
@ -425,7 +426,7 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
if (lt == Tr_Base::VERTEX)
return c->vertex(li); // by coinciding point
else
return NULL; // by face
return Vertex_handle(); // by face
}
Conflict_tester_2 tester(p, this);
@ -435,7 +436,7 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
it = tester.conflict_vector().begin();
it != tester.conflict_vector().end(); ++it)
{
if ((*it)->cell() == NULL)
if ((*it)->cell() == Cell_handle())
{
// vertex has to be deleted
tds().delete_vertex(*it);
@ -462,7 +463,7 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
if (lt == Tr_Base::VERTEX)
return c->vertex(li); // by coinciding point
else
return NULL; // by edge
return Vertex_handle(); // by edge
}
Cell_handle bound[2];
@ -488,8 +489,10 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
Vertex_handle v = tds().create_vertex();
v->set_point(p);
Cell_handle c0 = tds().create_face(v, bound[0]->vertex(0), NULL);
Cell_handle c1 = tds().create_face(bound[1]->vertex(1), v, NULL);
Cell_handle c0 = tds().create_face(v, bound[0]->vertex(0),
Vertex_handle());
Cell_handle c1 = tds().create_face(bound[1]->vertex(1), v,
Vertex_handle());
tds().set_adjacency(c0, 1, c1, 0);
tds().set_adjacency(bound[0], 1, c0, 0);
tds().set_adjacency(c1, 1, bound[1], 0);
@ -507,7 +510,7 @@ insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
case Tr_Base::CELL:
// impossible in dimension 1
CGAL_assertion(false);
return NULL;
return Vertex_handle();
}
}
case 0:

View File

@ -453,10 +453,10 @@ public:
Cell_handle
locate(const Point & p,
Locate_type & lt, int & li, int & lj,
Cell_handle start = NULL) const;
Cell_handle start = Cell_handle()) const;
Cell_handle
locate(const Point & p, Cell_handle start = NULL) const
locate(const Point & p, Cell_handle start = Cell_handle()) const
{
Locate_type lt;
int li, lj;
@ -542,7 +542,7 @@ public:
//INSERTION
Vertex_handle insert(const Point & p, Cell_handle start = NULL);
Vertex_handle insert(const Point & p, Cell_handle start = Cell_handle());
Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle c,
int li, int lj);
@ -689,7 +689,7 @@ protected:
insert_conflict_2(Cell_handle c, const Conflict_test &tester)
{
CGAL_triangulation_precondition( dimension() == 2 );
CGAL_triangulation_precondition( c != NULL );
CGAL_triangulation_precondition( c != Cell_handle() );
CGAL_triangulation_precondition( tester(c) );
std::vector<Cell_handle> cells;
@ -714,7 +714,7 @@ protected:
insert_conflict_3(Cell_handle c, const Conflict_test &tester)
{
CGAL_triangulation_precondition( dimension() == 3 );
CGAL_triangulation_precondition( c != NULL );
CGAL_triangulation_precondition( c != Cell_handle() );
CGAL_triangulation_precondition( tester(c) );
std::vector<Cell_handle> cells;
@ -1434,7 +1434,7 @@ locate(const Point & p, Locate_type & lt, int & li, int & lj,
{
int i, inf;
if ( dimension() >= 1 && start == NULL )
if ( dimension() >= 1 && start == Cell_handle() )
// there is at least one finite "cell" (or facet or edge)
start = infinite_vertex()->cell()->neighbor
( infinite_vertex()->cell()->index( infinite_vertex()) );
@ -1442,8 +1442,8 @@ locate(const Point & p, Locate_type & lt, int & li, int & lj,
switch (dimension()) {
case 3:
{
CGAL_triangulation_precondition( start != NULL );
Cell_handle previous(NULL);
CGAL_triangulation_precondition( start != Cell_handle() );
Cell_handle previous = Cell_handle();
Cell_handle c;
int ind_inf;
if ( start->has_vertex(infinite, ind_inf) )
@ -1574,7 +1574,7 @@ locate(const Point & p, Locate_type & lt, int & li, int & lj,
}
case 2:
{
CGAL_triangulation_precondition( start != NULL );
CGAL_triangulation_precondition( start != Cell_handle() );
Cell_handle c;
int ind_inf;
if ( start->has_vertex(infinite, ind_inf) )
@ -1663,7 +1663,7 @@ locate(const Point & p, Locate_type & lt, int & li, int & lj,
}
case 1:
{
CGAL_triangulation_precondition( start != NULL );
CGAL_triangulation_precondition( start != Cell_handle() );
Cell_handle c;
int ind_inf;
if ( start->has_vertex(infinite, ind_inf) )
@ -1729,12 +1729,12 @@ locate(const Point & p, Locate_type & lt, int & li, int & lj,
case -1:
{
lt = OUTSIDE_AFFINE_HULL;
return NULL;
return Cell_handle();
}
default:
{
CGAL_triangulation_assertion(false);
return NULL;
return Cell_handle();
}
}
}
@ -2551,7 +2551,7 @@ is_valid(bool verbose, int level) const
return false;
}
if ( infinite_vertex() == NULL ) {
if ( infinite_vertex() == Vertex_handle() ) {
if (verbose)
std::cerr << "no infinite vertex" << std::endl;
CGAL_triangulation_assertion(false);

View File

@ -118,8 +118,10 @@ public:
Vertex_handle() : _v() {}
Vertex_handle(Vertex_iterator v) : _v(v) {}
#ifndef CGAL_NO_DEPRECATED_CODE // must be kept
Vertex_handle(void * CGAL_triangulation_precondition_code(n)) : _v()
{ CGAL_triangulation_precondition(n == NULL); }
#endif
Vertex* operator->() const { return &*_v; }
Vertex& operator*() const { return *_v; }
@ -127,8 +129,10 @@ public:
bool operator==(Vertex_handle v) const { return _v == v._v; }
bool operator!=(Vertex_handle v) const { return _v != v._v; }
#ifndef CGAL_NO_DEPRECATED_CODE // must be kept
// For std::set and co.
bool operator<(Vertex_handle v) const { return &*_v < &*v._v; }
#endif
// Should be private to the TDS :
const Vertex_iterator & base() const { return _v; }
@ -157,8 +161,10 @@ public:
Cell_handle(Cell_circulator c) : _c(c.base()._c) {}
Cell_handle(Face_circulator c) : _c(c.base()._c) {}
#endif
#ifndef CGAL_NO_DEPRECATED_CODE // must be kept
Cell_handle(void * CGAL_triangulation_precondition_code(n)) : _c()
{ CGAL_triangulation_precondition(n == NULL); }
#endif
Cell* operator->() const { return &*_c; }
Cell& operator*() const { return *_c; }
@ -166,8 +172,10 @@ public:
bool operator==(Cell_handle c) const { return _c == c._c; }
bool operator!=(Cell_handle c) const { return _c != c._c; }
#ifndef CGAL_NO_DEPRECATED_CODE // must be kept
// For std::set and co.
bool operator<(Cell_handle c) const { return &*_c < &*c._c; }
#endif
// These should be private to the TDS :
const Cell_iterator & base() const { return _c; }
@ -454,7 +462,7 @@ public:
Vertex_handle _insert_in_hole(CellIt cell_begin, CellIt cell_end,
const Cell_handle& begin, int i)
{
CGAL_triangulation_precondition(begin != NULL);
CGAL_triangulation_precondition(begin != Cell_handle());
// if begin == NULL (default arg), we could compute one by walking in
// CellIt. At the moment, the functionality is not available, you have
// to specify a starting facet.
@ -692,7 +700,7 @@ public:
OutputIterator
incident_cells(const Vertex_handle& v, OutputIterator cells) const
{
CGAL_triangulation_precondition( v != NULL );
CGAL_triangulation_precondition( v != Vertex_handle() );
CGAL_triangulation_expensive_precondition( is_vertex(v) );
if ( dimension() < 3 )
@ -714,7 +722,7 @@ public:
OutputIterator
incident_vertices(const Vertex_handle& v, OutputIterator vertices) const
{
CGAL_triangulation_precondition( v != NULL );
CGAL_triangulation_precondition( v != Vertex_handle() );
CGAL_triangulation_precondition( dimension() >= -1 );
CGAL_triangulation_expensive_precondition( is_vertex(v) );
CGAL_triangulation_expensive_precondition( is_valid() );
@ -846,7 +854,7 @@ create_star_3(const Vertex_handle& v, const Cell_handle& c, int li,
// Look for the other neighbors of cnew.
for (int ii=0; ii<4; ++ii) {
if (ii == prev_ind2 || cnew->neighbor(ii) != NULL)
if (ii == prev_ind2 || cnew->neighbor(ii) != Cell_handle())
continue;
cnew->vertex(ii)->set_cell(cnew);
@ -901,7 +909,7 @@ create_star_2(const Vertex_handle& v, const Cell_handle& c, int li )
int ind = c->neighbor(li)->index(c); // to be able to find the
// first cell that will be created
Cell_handle cur;
Cell_handle pnew = NULL;
Cell_handle pnew = Cell_handle();
do {
cur = bound;
// turn around v2 until we reach the boundary of region
@ -915,12 +923,12 @@ create_star_2(const Vertex_handle& v, const Cell_handle& c, int li )
cnew = create_face( v, v1, cur->vertex( ccw(i1) ) );
set_adjacency(cnew, 0, cur->neighbor(cw(i1)),
cur->neighbor(cw(i1))->index(cur));
cnew->set_neighbor(1, NULL);
cnew->set_neighbor(1, Cell_handle());
cnew->set_neighbor(2, pnew);
// pnew is null at the first iteration
v1->set_cell(cnew);
//pnew->set_neighbor( cw(pnew->index(v1)), cnew );
if (pnew != NULL) { pnew->set_neighbor( 1, cnew );}
if (pnew != Cell_handle()) { pnew->set_neighbor( 1, cnew );}
bound = cur;
i1 = ccw(i1);
@ -1680,7 +1688,7 @@ Triangulation_data_structure_3<Vb,Cb>::
insert_in_cell(const Cell_handle& c)
{
CGAL_triangulation_precondition( dimension() == 3 );
CGAL_triangulation_precondition( c != NULL );
CGAL_triangulation_precondition( c != Cell_handle() );
CGAL_triangulation_expensive_precondition( is_cell(c) );
Vertex_handle v = create_vertex();
@ -1725,7 +1733,7 @@ Triangulation_data_structure_3<Vb,Cb>::
insert_in_facet(const Cell_handle& c, int i)
{ // inserts v in the facet opposite to vertex i of cell c
CGAL_triangulation_precondition( c != NULL );
CGAL_triangulation_precondition( c != Cell_handle() );
CGAL_triangulation_precondition( dimension() >= 2 );
Vertex_handle v = create_vertex();
@ -1834,7 +1842,7 @@ Triangulation_data_structure_3<Vb,Cb>::
insert_in_edge(const Cell_handle& c, int i, int j)
// inserts a vertex in the edge of cell c with vertices i and j
{
CGAL_triangulation_precondition( c != NULL );
CGAL_triangulation_precondition( c != Cell_handle() );
CGAL_triangulation_precondition( i != j );
CGAL_triangulation_precondition( dimension() >= 1 );
@ -1926,7 +1934,7 @@ insert_increase_dimension(Vertex_handle star)
int dim = dimension();
if (dim != -2) {
CGAL_triangulation_precondition( star != NULL );
CGAL_triangulation_precondition( star != Vertex_handle() );
// In this case, this precondition is not relatively expensive.
CGAL_triangulation_precondition( is_vertex(star) );
}
@ -1987,7 +1995,7 @@ insert_increase_dimension(Vertex_handle star)
Cell_handle e = c->neighbor(i);
Cell_handle cnew = c;
Cell_handle enew = NULL;
Cell_handle enew = Cell_handle();
while( e != d ){
enew = create_cell();
@ -2038,10 +2046,10 @@ insert_increase_dimension(Vertex_handle star)
// Here we must be careful since we create_cells in a loop controlled
// by an iterator. So we first take care of the cells newly created
// by the following test :
if (it->neighbor(0) == NULL)
if (it->neighbor(0) == Cell_handle())
continue;
it->set_neighbor(3, NULL);
it->set_vertex(3,v);
it->set_neighbor(3, Cell_handle());
it->set_vertex(3, v);
if ( ! it->has_vertex(star) ) {
Cell_handle cnew = create_cell( it->vertex(0), it->vertex(2),
it->vertex(1), star);
@ -2049,7 +2057,7 @@ insert_increase_dimension(Vertex_handle star)
// function "set_adjacency": the adjacency is not changed.
Cell_handle ch_it = it;
set_adjacency(cnew, 3, ch_it, 3);
cnew->set_neighbor(0, NULL);
cnew->set_neighbor(0, Cell_handle());
new_cells.push_back(cnew);
}
}
@ -2064,7 +2072,7 @@ insert_increase_dimension(Vertex_handle star)
else j=3-i; // vertex 1 and vertex 2 are always switched when
// creating a new cell (see above)
Cell_handle c = n->neighbor(i)->neighbor(3);
if ( c != NULL ) {
if ( c != Cell_handle() ) {
// i.e. star is not a vertex of n->neighbor(i)
(*ncit)->set_neighbor(j, c);
// opposite relation will be set when ncit arrives on c
@ -2122,8 +2130,8 @@ remove_decrease_dimension(const Vertex_handle& v)
if (dimension() >= 1)
change_orientation(f);
}
f->set_vertex(dimension(), NULL);
f->set_neighbor(dimension(), NULL);
f->set_vertex(dimension(), Vertex_handle());
f->set_neighbor(dimension(), Cell_handle());
// Update vertex->cell() pointers.
for (int i = 0; i < dimension(); ++i)
@ -2149,7 +2157,7 @@ remove_from_maximal_dimension_simplex(const Vertex_handle& v)
if (number_of_vertices() == (size_type) dimension() + 2) {
remove_decrease_dimension(v);
return NULL;
return Cell_handle();
}
if (dimension() == 3)
@ -2442,7 +2450,7 @@ Triangulation_data_structure_3<Vb,Cb>::
copy_tds(const Tds & tds, Vertex_handle vert )
// returns the new vertex corresponding to vert in the new tds
{
CGAL_triangulation_expensive_precondition( vert == NULL
CGAL_triangulation_expensive_precondition( vert == Vertex_handle()
|| tds.is_vertex(vert) );
clear();
@ -2494,7 +2502,7 @@ copy_tds(const Tds & tds, Vertex_handle vert )
CGAL_triangulation_postcondition( is_valid() );
return (vert != NULL) ? V[vert] : vert;
return (vert != Vertex_handle()) ? V[vert] : vert;
}
template <class Vb, class Cb >

View File

@ -123,20 +123,22 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
case -2:
case -1:
{
if ( vertex(0) == NULL ) {
if ( vertex(0) == Vertex_handle() ) {
if (verbose)
std::cerr << "vertex 0 NULL" << std::endl;
CGAL_triangulation_assertion(false);
return false;
}
vertex(0)->is_valid(verbose,level);
if ( vertex(1) != NULL || vertex(2) != NULL) {
if ( vertex(1) != Vertex_handle() || vertex(2) != Vertex_handle()) {
if (verbose)
std::cerr << "vertex 1 or 2 != NULL" << std::endl;
CGAL_triangulation_assertion(false);
return false;
}
if ( neighbor(0) != NULL || neighbor(1) != NULL || neighbor(2) != NULL) {
if ( neighbor(0) != Cell_handle() ||
neighbor(1) != Cell_handle() ||
neighbor(2) != Cell_handle()) {
if (verbose)
std::cerr << "one neighbor != NULL" << std::endl;
CGAL_triangulation_assertion(false);
@ -147,26 +149,26 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
case 0:
{
if ( vertex(0) == NULL ) {
if ( vertex(0) == Vertex_handle() ) {
if (verbose)
std::cerr << "vertex 0 NULL" << std::endl;
CGAL_triangulation_assertion(false);
return false;
}
vertex(0)->is_valid(verbose,level);
if ( neighbor (0) == NULL ) {
if ( neighbor (0) == Cell_handle() ) {
if (verbose)
std::cerr << "neighbor 0 NULL" << std::endl;
CGAL_triangulation_assertion(false);
return false;
}
if ( vertex(1) != NULL || vertex(2) != NULL ) {
if ( vertex(1) != Vertex_handle() || vertex(2) != Vertex_handle() ) {
if (verbose)
std::cerr << "vertex 1 or 2 != NULL" << std::endl;
CGAL_triangulation_assertion(false);
return false;
}
if ( neighbor(1) != NULL || neighbor(2) != NULL ) {
if ( neighbor(1) != Cell_handle() || neighbor(2) != Cell_handle() ) {
if (verbose)
std::cerr << "neighbor 1 or 2 != NULL" << std::endl;
CGAL_triangulation_assertion(false);
@ -189,7 +191,7 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
Cell_handle n0 = neighbor(0);
Cell_handle n1 = neighbor(1);
if ( v0 == NULL || v1 == NULL ) {
if ( v0 == Vertex_handle() || v1 == Vertex_handle() ) {
if (verbose)
std::cerr << "vertex 0 or 1 NULL" << std::endl;
CGAL_triangulation_assertion(false);
@ -197,7 +199,7 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
}
vertex(0)->is_valid(verbose,level);
vertex(1)->is_valid(verbose,level);
if ( n0 == NULL || n1 == NULL ) {
if ( n0 == Cell_handle() || n1 == Cell_handle() ) {
if (verbose)
std::cerr << "neighbor 0 or 1 NULL" << std::endl;
CGAL_triangulation_assertion(false);
@ -239,7 +241,9 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
case 2:
{
if ( vertex(0) == NULL || vertex(1) == NULL || vertex(2) == NULL ) {
if ( vertex(0) == Vertex_handle() ||
vertex(1) == Vertex_handle() ||
vertex(2) == Vertex_handle() ) {
if (verbose)
std::cerr << "vertex 0, 1, or 2 NULL" << std::endl;
CGAL_triangulation_assertion(false);
@ -252,7 +256,7 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
Cell_handle n;
for(int i = 0; i < 3; i++) {
n = neighbor(i);
if ( n == NULL ) {
if ( n == Cell_handle() ) {
if (verbose)
std::cerr << "neighbor " << i << " NULL" << std::endl;
CGAL_triangulation_assertion(false);
@ -290,7 +294,7 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
{
int i;
for(i = 0; i < 4; i++) {
if ( vertex(i) == NULL ) {
if ( vertex(i) == Vertex_handle() ) {
if (verbose)
std::cerr << "vertex " << i << " NULL" << std::endl;
CGAL_triangulation_assertion(false);
@ -301,7 +305,7 @@ Triangulation_ds_cell_3<Cb>::is_valid(int dim, bool verbose, int level) const
for(i = 0; i < 4; i++) {
Cell_handle n = neighbor(i);
if ( n == NULL ) {
if ( n == Cell_handle() ) {
if (verbose)
std::cerr << "neighbor " << i << " NULL" << std::endl;
CGAL_triangulation_assertion(false);

View File

@ -138,7 +138,7 @@ public:
void set_vertices()
{
V[0] = V[1] = V[2] = V[3] = NULL;
V[0] = V[1] = V[2] = V[3] = Vertex_handle();
}
void set_vertices(const Vertex_handle& v0, const Vertex_handle& v1,
@ -152,7 +152,7 @@ public:
void set_neighbors()
{
N[0] = N[1] = N[2] = N[3] = NULL;
N[0] = N[1] = N[2] = N[3] = Cell_handle();
}
void set_neighbors(const Cell_handle& n0, const Cell_handle& n1,

View File

@ -58,24 +58,24 @@ public:
bool operator==(CGAL_NULL_TYPE CGAL_triangulation_assertion_code(n)) const
{
CGAL_triangulation_assertion( n == NULL);
return pos == NULL;
return pos == Cell_handle();
}
bool operator!=(CGAL_NULL_TYPE CGAL_triangulation_assertion_code(n)) const
{
CGAL_triangulation_assertion( n == NULL);
return pos != NULL;
return pos != Cell_handle();
}
#endif
Triangulation_ds_cell_circulator_3()
: _s(NULL), _t(NULL), pos(NULL)
: _s(), _t(), pos()
{}
Triangulation_ds_cell_circulator_3(Cell_handle c, int s, int t)
: _s(c->vertex(s)), _t(c->vertex(t)), pos(c)
{
CGAL_triangulation_precondition( c != NULL &&
CGAL_triangulation_precondition( c != Cell_handle() &&
s >= 0 && s < 4 &&
t >= 0 && t < 4 );
}
@ -83,7 +83,7 @@ public:
Triangulation_ds_cell_circulator_3(const Edge & e)
: _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)), pos(e.first)
{
CGAL_triangulation_precondition( e.first != NULL &&
CGAL_triangulation_precondition( e.first != Cell_handle() &&
e.second >=0 && e.second < 4 &&
e.third >=0 && e.third < 4);
}
@ -92,7 +92,7 @@ public:
Cell_handle start)
: _s(c->vertex(s)), _t(c->vertex(t)), pos(start)
{
CGAL_triangulation_precondition( c != NULL &&
CGAL_triangulation_precondition( c != Cell_handle() &&
s >= 0 && s < 4 &&
t >= 0 && t < 4 &&
start->has_vertex( _s ) &&
@ -102,7 +102,7 @@ public:
Triangulation_ds_cell_circulator_3(const Edge & e, Cell_handle start)
: _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)), pos(start)
{
CGAL_triangulation_precondition( e.first != NULL &&
CGAL_triangulation_precondition( e.first != Cell_handle() &&
e.second >=0 && e.second < 4 &&
e.third >=0 && e.third < 4 &&
start->has_vertex( _s ) &&
@ -111,7 +111,7 @@ public:
Cell_circulator & operator++()
{
CGAL_triangulation_precondition( pos != NULL );
CGAL_triangulation_precondition( pos != Cell_handle() );
//then dimension() cannot be < 3
pos = pos->neighbor(next_around_edge(pos->index(_s), pos->index(_t)));
@ -127,7 +127,7 @@ public:
Cell_circulator & operator--()
{
CGAL_triangulation_precondition( pos != NULL );
CGAL_triangulation_precondition( pos != Cell_handle() );
pos = pos->neighbor(next_around_edge(pos->index(_t), pos->index(_s)));
return *this;
@ -210,13 +210,13 @@ class Triangulation_ds_facet_circulator_3
public:
Triangulation_ds_facet_circulator_3()
: _s(NULL), _t(NULL), pos(NULL)
: _s(), _t(), pos()
{}
Triangulation_ds_facet_circulator_3(Cell_handle c, int s, int t)
: _s(c->vertex(s)), _t(c->vertex(t)), pos(c)
{
CGAL_triangulation_precondition( c != NULL &&
CGAL_triangulation_precondition( c != Cell_handle() &&
s >= 0 && s < 4 &&
t >= 0 && t < 4 );
}
@ -224,7 +224,7 @@ public:
Triangulation_ds_facet_circulator_3(const Edge & e)
: _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third)), pos(e.first)
{
CGAL_triangulation_precondition( e.first != NULL &&
CGAL_triangulation_precondition( e.first != Cell_handle() &&
e.second >= 0 && e.second < 4 &&
e.third >= 0 && e.third < 4);
}
@ -233,7 +233,7 @@ public:
Cell_handle start, int f)
: _s(c->vertex(s)), _t(c->vertex(t))
{
CGAL_triangulation_precondition( c != NULL &&
CGAL_triangulation_precondition( c != Cell_handle() &&
s >= 0 && s < 4 &&
t >= 0 && t < 4 &&
f >= 0 && f < 4 &&
@ -255,7 +255,7 @@ public:
const Facet & start)
: _s(c->vertex(s)), _t(c->vertex(t))
{
CGAL_triangulation_precondition( c != NULL &&
CGAL_triangulation_precondition( c != Cell_handle() &&
s >= 0 && s < 4 &&
t >= 0 && t < 4 &&
start.first->has_vertex( _s ) &&
@ -275,7 +275,7 @@ public:
Triangulation_ds_facet_circulator_3(const Edge & e, Cell_handle start, int f)
: _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third))
{
CGAL_triangulation_precondition( e.first != NULL &&
CGAL_triangulation_precondition( e.first != Cell_handle() &&
e.second >= 0 && e.second < 4 &&
e.third >= 0 && e.third < 4 &&
f >= 0 && f < 4 &&
@ -296,7 +296,7 @@ public:
Triangulation_ds_facet_circulator_3(const Edge & e, const Facet & start)
: _s(e.first->vertex(e.second)), _t(e.first->vertex(e.third))
{
CGAL_triangulation_precondition( e.first != NULL &&
CGAL_triangulation_precondition( e.first != Cell_handle() &&
e.second >= 0 && e.second < 4 &&
e.third >= 0 && e.third < 4 &&
start.first->has_vertex( _s ) &&
@ -313,7 +313,7 @@ public:
Facet_circulator & operator++()
{
CGAL_triangulation_precondition( pos != NULL );
CGAL_triangulation_precondition( pos != Cell_handle() );
//then dimension() cannot be < 3
pos = pos->neighbor( next_around_edge( pos->index(_s), pos->index(_t) ) );
@ -329,7 +329,7 @@ public:
Facet_circulator & operator--()
{
CGAL_triangulation_precondition( pos != NULL );
CGAL_triangulation_precondition( pos != Cell_handle() );
pos = pos->neighbor( next_around_edge( pos->index(_t), pos->index(_s) ) );
return *this;
@ -390,16 +390,14 @@ class Triangulation_ds_face_circulator_3
public:
Triangulation_ds_face_circulator_3()
: _s(NULL), pos(NULL)
{}
: _s(), pos() {}
Triangulation_ds_face_circulator_3(Vertex_handle v, Cell_handle c)
: _s(v), pos(c)
{}
: _s(v), pos(c) {}
Face_circulator & operator++()
{
CGAL_triangulation_precondition( pos != NULL );
CGAL_triangulation_precondition( pos != Cell_handle() );
//then dimension() cannot be < 3
pos = pos->neighbor(ccw(pos->index(_s)));
@ -415,7 +413,7 @@ public:
Face_circulator & operator--()
{
CGAL_triangulation_precondition( pos != NULL );
CGAL_triangulation_precondition( pos != Cell_handle() );
pos = pos->neighbor(cw(pos->index(_s)));
return *this;

View File

@ -38,7 +38,7 @@ public:
struct Rebind_TDS { typedef Triangulation_ds_vertex_base_3<TDS2> Other; };
Triangulation_ds_vertex_base_3()
: _c(NULL) {}
: _c() {}
Triangulation_ds_vertex_base_3(const Cell_handle& c)
: _c(c) {}
@ -54,7 +54,7 @@ public:
// to add their own purpose checking
bool is_valid(bool, int ) const
{
return cell() != NULL;
return cell() != Cell_handle();
}
// For use by the Compact_container.

View File

@ -123,7 +123,7 @@ public:
Cell_handle locate(const Point& p) const;
Vertex_handle
nearest_vertex(const Point& p, Cell_handle start = NULL) const;
nearest_vertex(const Point& p, Cell_handle start = Cell_handle()) const;
private:
@ -187,7 +187,7 @@ Triangulation_hierarchy_3(const Triangulation_hierarchy_3<Tr> &tr)
for( Finite_vertices_iterator it=hierarchy[0]->finite_vertices_begin();
it != hierarchy[0]->finite_vertices_end(); ++it)
if (it->up() != NULL)
if (it->up() != Vertex_handle())
V[ it->up()->down() ] = it;
for(int j=1; j<maxlevel; ++j) {
@ -198,7 +198,7 @@ Triangulation_hierarchy_3(const Triangulation_hierarchy_3<Tr> &tr)
// make reverse link
it->down()->set_up( it );
// make map for next level
if (it->up() != NULL)
if (it->up() != Vertex_handle())
V[ it->up()->down() ] = it;
}
}
@ -246,7 +246,7 @@ is_valid(bool verbose, int level) const
// verify that lower level has no down pointers
for( Finite_vertices_iterator it = hierarchy[0]->finite_vertices_begin();
it != hierarchy[0]->finite_vertices_end(); ++it)
result = result && (it->down() == NULL);
result = result && (it->down() == Vertex_handle());
// verify that other levels has down pointer and reciprocal link is fine
for(int j=1; j<maxlevel; ++j)
@ -258,7 +258,7 @@ is_valid(bool verbose, int level) const
for(int k=0; k<maxlevel-1; ++k)
for( Finite_vertices_iterator it = hierarchy[k]->finite_vertices_begin();
it != hierarchy[k]->finite_vertices_end(); ++it)
result = result && ( it->up() == NULL ||
result = result && ( it->up() == Vertex_handle() ||
&*it == &*(it->up())->down() );
return result;
@ -286,7 +286,7 @@ insert(const Point &p)
int level = 1;
while (level <= vertex_level ){
if (positions[level].pos == NULL)
if (positions[level].pos == Cell_handle())
vertex = hierarchy[level]->insert(p);
else
vertex = hierarchy[level]->insert(p,
@ -307,12 +307,12 @@ bool
Triangulation_hierarchy_3<Tr>::
remove(Vertex_handle v)
{
CGAL_triangulation_precondition(v != NULL);
CGAL_triangulation_precondition(v != Vertex_handle());
Vertex_handle u = v->up();
int l = 0;
while (1) {
hierarchy[l++]->remove(v);
if (u == NULL || l > maxlevel)
if (u == Vertex_handle() || l > maxlevel)
break;
v = u;
u = v->up();
@ -325,7 +325,7 @@ typename Triangulation_hierarchy_3<Tr>::Vertex_handle
Triangulation_hierarchy_3<Tr>::
move_point(Vertex_handle v, const Point & p)
{
CGAL_triangulation_precondition(v != NULL);
CGAL_triangulation_precondition(v != Vertex_handle());
Vertex_handle u = v->up();
Vertex_handle old, ret;
int l = 0;
@ -338,7 +338,7 @@ move_point(Vertex_handle v, const Point & p)
w->set_down(old);
}
old = w;
if (u == NULL || l > maxlevel)
if (u == Vertex_handle() || l > maxlevel)
break;
v = u;
u = v->up();
@ -383,9 +383,9 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj,
}
for (int i=level+1; i<maxlevel; ++i)
pos[i].pos = NULL;
pos[i].pos = Cell_handle();
Cell_handle position = NULL;
Cell_handle position = Cell_handle();
while(level > 0) {
// locate at that level from "position"
// result is stored in "position" for the next level
@ -414,7 +414,8 @@ typename Triangulation_hierarchy_3<Tr>::Vertex_handle
Triangulation_hierarchy_3<Tr>::
nearest_vertex(const Point& p, Cell_handle start) const
{
return Tr_Base::nearest_vertex(p, start != NULL ? start : locate(p));
return Tr_Base::nearest_vertex(p, start != Cell_handle() ? start
: locate(p));
}
template <class Tr>

View File

@ -41,16 +41,16 @@ _test_vertex_tds_3(const Vertex &)
c2->set_vertex(0, v1);
assert(v1->is_valid());
// Compatibility of handles with NULL.
Vertex_handle v = NULL;
v = NULL;
assert(v == NULL);
assert(v1 != NULL);
// Unicity of the default constructed handle.
Vertex_handle v = Vertex_handle();
v = Vertex_handle();
assert(v == Vertex_handle());
assert(v1 != Vertex_handle());
Cell_handle c = NULL;
c = NULL;
assert(c == NULL);
assert(c1 != NULL);
Cell_handle c = Cell_handle();
c = Cell_handle();
assert(c == Cell_handle());
assert(c1 != Cell_handle());
// We want the following comparisons to work for use in std::set<>...
bool b1 = v<v1; (void) b1;