change NULL to default constructed handles

This commit is contained in:
Mariette Yvinec 2004-01-20 13:48:50 +00:00
parent eb08fabe12
commit 4e89287da1
13 changed files with 132 additions and 124 deletions

View File

@ -104,7 +104,7 @@ public:
bool test_conflict(Face_handle fh, const Point& p) const; //deprecated
bool test_conflict(const Point& p, Face_handle fh) const;
void find_conflicts(const Point& p, std::list<Edge>& le, //deprecated
Face_handle hint= Face_handle(NULL)) const;
Face_handle hint= Face_handle()) const;
// //template member functions, declared and defined at the end
// template <class OutputItFaces, class OutputItBoundaryEdges>
// std::pair<OutputItFaces,OutputItBoundaryEdges>
@ -125,7 +125,7 @@ public:
// INSERTION-REMOVAL
Vertex_handle insert(const Point & a, Face_handle start = Face_handle(NULL));
Vertex_handle insert(const Point & a, Face_handle start = Face_handle());
Vertex_handle insert(const Point& p,
Locate_type lt,
Face_handle loc, int li );
@ -146,7 +146,7 @@ public:
protected:
virtual Vertex_handle virtual_insert(const Point & a,
Face_handle start = Face_handle(NULL));
Face_handle start = Face_handle());
virtual Vertex_handle virtual_insert(const Point& a,
Locate_type lt,
Face_handle loc,
@ -183,7 +183,7 @@ public:
get_conflicts_and_boundary(const Point &p,
OutputItFaces fit,
OutputItBoundaryEdges eit,
Face_handle start = Face_handle(NULL)) const {
Face_handle start = Face_handle()) const {
CGAL_triangulation_precondition( dimension() == 2);
int li;
Locate_type lt;
@ -211,7 +211,7 @@ public:
OutputItFaces
get_conflicts (const Point &p,
OutputItFaces fit,
Face_handle start= Face_handle(NULL)) const {
Face_handle start= Face_handle()) const {
std::pair<OutputItFaces,Emptyset_iterator> pp =
get_conflicts_and_boundary(p,fit,Emptyset_iterator(),start);
return pp.first;
@ -221,7 +221,7 @@ public:
OutputItBoundaryEdges
get_boundary_of_conflicts(const Point &p,
OutputItBoundaryEdges eit,
Face_handle start= Face_handle(NULL)) const {
Face_handle start= Face_handle()) const {
std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp =
get_conflicts_and_boundary(p,Emptyset_iterator(),eit,start);
return pp.second;
@ -546,7 +546,7 @@ remove(Vertex_handle v)
// remove a vertex and updates the constrained edges of the new faces
// precondition : there is no incident constraints
{
CGAL_triangulation_precondition( v != NULL );
CGAL_triangulation_precondition( v != Vertex_handle() );
CGAL_triangulation_precondition( ! is_infinite(v));
CGAL_triangulation_precondition( ! are_there_incident_constraints(v));
if (dimension() <= 1) Ctr::remove(v);

View File

@ -112,7 +112,7 @@ public:
// INSERTION
Vertex_handle insert(const Point& p,
Face_handle start = Face_handle(NULL) );
Face_handle start = Face_handle() );
Vertex_handle insert(const Point& p,
Locate_type lt,
Face_handle loc,
@ -161,7 +161,7 @@ public:
protected:
virtual Vertex_handle virtual_insert(const Point& a,
Face_handle start = Face_handle(NULL));
Face_handle start = Face_handle());
virtual Vertex_handle virtual_insert(const Point& a,
Locate_type lt,
Face_handle loc,
@ -577,7 +577,7 @@ intersect(Face_handle , int ,
<< std::endl
<< " intersecting constraints" << std::endl;
CGAL_triangulation_assertion(false);
return Vertex_handle(NULL);
return Vertex_handle() ;
}
template <class Gt, class Tds, class Itag >
@ -852,7 +852,7 @@ remove(Vertex_handle v)
// remove a vertex and updates the constrained edges of the new faces
// precondition : there is no incident constraints
{
CGAL_triangulation_precondition( v != NULL );
CGAL_triangulation_precondition( v != Vertex_handle() );
CGAL_triangulation_precondition( ! is_infinite(v));
CGAL_triangulation_precondition( ! are_there_incident_constraints(v));
@ -987,7 +987,7 @@ triangulate_half_hole(List_edges & list_edges, List_edges & new_edges)
n1=(*current).first;
ind1=(*current).second;
// in case n1 is no longer a triangle of the new triangulation
if ( n1->neighbor(ind1) != NULL ) {
if ( n1->neighbor(ind1) != Face_handle() ) {
n=n1->neighbor(ind1);
//ind=n1->mirror_index(ind1);
// mirror_index does not work in this case
@ -998,7 +998,7 @@ triangulate_half_hole(List_edges & list_edges, List_edges & new_edges)
n2=(*next).first;
ind2=(*next).second;
// in case n2 is no longer a triangle of the new triangulation
if (n2->neighbor(ind2) != NULL ) {
if (n2->neighbor(ind2) != Face_handle() ) {
n=n2->neighbor(ind2);
// ind=n2->mirror_index(ind2);
// mirror_index does not work in this case

View File

@ -115,7 +115,7 @@ public:
// INSERTION
Vertex_handle insert(const Point& a,
Face_handle start = Face_handle(NULL) );
Face_handle start = Face_handle() );
Vertex_handle insert(const Point& p,
Locate_type lt,
Face_handle loc, int li );
@ -390,7 +390,7 @@ intersect(Face_handle , int ,
<< std::endl
<< " intersecting constraints" << std::endl;
CGAL_triangulation_assertion(false);
return Vertex_handle(NULL);
return Vertex_handle();
}
template <class Tr>

View File

@ -156,8 +156,8 @@ public:
bool is_removable(Face_handle fh)
{
return ( (*fh).vertex(1) == (*fh).vertex(2) &&
(*fh).neighbor(1) != NULL &&
(*fh).neighbor(2) != NULL );
(*fh).neighbor(1) != Face_handle() &&
(*fh).neighbor(2) != Face_handle() );
}
void remove_flat(Face_handle fh)
@ -165,9 +165,9 @@ public:
CGAL_triangulation_precondition((*fh).vertex(1) == (*fh).vertex(2));
Face_handle f2= (*fh).neighbor(2);
Face_handle f1= (*fh).neighbor(1);
if ( f2 != NULL ) { (*f2).set_neighbor( (*f2).index(fh), f1);}
if ( f1 != NULL ) { (*f1).set_neighbor( (*f1).index(fh), f2);}
( (*fh). vertex(0))->set_face( f2!= NULL ? f2 : f1 );
if ( f2 != Face_handle() ) { (*f2).set_neighbor( (*f2).index(fh), f1);}
if ( f1 != Face_handle() ) { (*f1).set_neighbor( (*f1).index(fh), f2);}
( (*fh). vertex(0))->set_face( f2!= Face_handle() ? f2 : f1 );
_tr->delete_face(fh);
return;
}
@ -261,7 +261,7 @@ public:
Neighbor_list down;
public:
Chain(Ctriangulation* tr) : rm(NULL), up(tr), down(tr) {}
Chain(Ctriangulation* tr) : rm(), up(tr), down(tr) {}
Vertex_handle right_most() { return rm;}
Neighbor_list* up_list(){return &up;}
Neighbor_list* down_list(){return &down;}
@ -290,7 +290,7 @@ public:
public:
Constrained_triangulation_sweep_2()
: _tr(NULL), _lc(NULL), upper_chain(NULL)
: _tr(NULL), _lc(), upper_chain()
{
}
@ -422,7 +422,7 @@ treat_in_edges(const Event_queue_iterator & event,
if (loc == status.end()) { pch = &upper_chain;}
else { pch = (Chain*)((*loc).second);}
Vertex_handle w = pch->right_most();
if (w == NULL ) { // first event is treated
if (w == Vertex_handle() ) { // first event is treated
pch->set_right_most(v);
return v;
}
@ -455,11 +455,11 @@ treat_in_edges(const Event_queue_iterator & event,
last= nl->up_visit(v,last);
//delete flat newf if possible
// i. e. if at least one of its neighbor is not NULL
if ( newf->neighbor(2) != NULL || newf->neighbor(1)!= NULL ) {
if (first == newf ) { // means newf->neighbor(1) == NULL
// i. e. if at least one of its neighbor is not Face_handle()
if ( newf->neighbor(2) != Face_handle() || newf->neighbor(1)!= Face_handle() ) {
if (first == newf ) { // means newf->neighbor(1) == Face_handle()
first = newf->neighbor(2);}
if (last == newf) { // means newf->neighbor(2) == NULL
if (last == newf) { // means newf->neighbor(2) == Face_handle()
last = newf->neighbor(1);}
nl->remove_flat(newf);
}
@ -569,7 +569,7 @@ set_infinite_faces()
Vertex_handle infinite= _tr->infinite_vertex();
// Triangulation may be empty;
if (upper_chain.right_most() == NULL ) {return;}
if (upper_chain.right_most() == Vertex_handle() ) {return;}
Neighbor_list* upper_list= upper_chain.up_list();
Neighbor_list* lower_list= upper_chain.down_list();
@ -597,7 +597,7 @@ set_infinite_faces()
//both test are necessary because it may remain some flat faces
//in the upper chain.
_tr->set_dimension(1);
newf = _tr->create_face(infinite, first->vertex(1), NULL);
newf = _tr->create_face(infinite, first->vertex(1), Face_handle());
first = last = newf;
infinite->set_face(first);
typename Neighbor_list::iterator it = lower_list->begin();
@ -606,13 +606,13 @@ set_infinite_faces()
//turn the vertex [vww] into [wvNULL]
fn->set_vertex(1, fn->vertex(0));
fn->set_vertex(0, fn->vertex(2));
fn->set_vertex(2, Vertex_handle(NULL));
fn->set_vertex(2, Vertex_handle());
fn->vertex(0)->set_face(fn);
fn->set_neighbor(1,last);
last->set_neighbor(0,fn);
last = fn;
}
fn = _tr->create_face(last->vertex(1), infinite,NULL);
fn = _tr->create_face(last->vertex(1), infinite, Vertex_handle());
fn->vertex(0)->set_face(fn);
fn->set_neighbor(1,last);
last->set_neighbor(0,fn);

View File

@ -78,9 +78,9 @@ draw_new_faces(Vertex_handle v, Window_stream& W)
drawing_mode dm=W.set_mode(leda_src_mode);
W << BLUE;
Face_handle f = v->face();
if (f == NULL ) { return;} //first point, no face
if (f == Face_handle() ) { return;} //first point, no face
draw_face(f,W);
while( f->neighbor(1) != NULL ) {
while( f->neighbor(1) != Face_handle() ) {
f = f->neighbor(1);
draw_face(f,W);
}

View File

@ -69,13 +69,13 @@ public:
bool is_valid(bool verbose = false, int level = 0) const;
Vertex_handle
nearest_vertex(const Point& p, Face_handle f= Face_handle(NULL)) const;
nearest_vertex(const Point& p, Face_handle f= Face_handle()) const;
bool does_conflict(const Point &p, Face_handle fh) const;// deprecated
bool test_conflict(const Point &p, Face_handle fh) const;
bool find_conflicts(const Point &p, //deprecated
std::list<Face_handle>& conflicts,
Face_handle start= Face_handle(NULL) ) const;
Face_handle start= Face_handle() ) const;
// //template member functions, declared and defined at the end
// template <class OutputItFaces, class OutputItBoundaryEdges>
// std::pair<OutputItFaces,OutputItBoundaryEdges>
@ -103,7 +103,7 @@ public:
//INSERTION-REMOVAL
Vertex_handle insert(const Point &p,
Face_handle start = Face_handle(NULL) );
Face_handle start = Face_handle() );
Vertex_handle insert(const Point& p,
Locate_type lt,
Face_handle loc, int li );
@ -160,7 +160,7 @@ public:
get_conflicts_and_boundary(const Point &p,
OutputItFaces fit,
OutputItBoundaryEdges eit,
Face_handle start = Face_handle(NULL)) const {
Face_handle start = Face_handle()) const {
CGAL_triangulation_precondition( dimension() == 2);
int li;
Locate_type lt;
@ -188,7 +188,7 @@ public:
OutputItFaces
get_conflicts (const Point &p,
OutputItFaces fit,
Face_handle start= Face_handle(NULL)) const {
Face_handle start= Face_handle()) const {
std::pair<OutputItFaces,Emptyset_iterator> pp =
get_conflicts_and_boundary(p,fit,Emptyset_iterator(),start);
return pp.first;
@ -198,7 +198,7 @@ public:
OutputItBoundaryEdges
get_boundary_of_conflicts(const Point &p,
OutputItBoundaryEdges eit,
Face_handle start= Face_handle(NULL)) const {
Face_handle start= Face_handle()) const {
std::pair<Emptyset_iterator, OutputItBoundaryEdges> pp =
get_conflicts_and_boundary(p,Emptyset_iterator(),eit,start);
return pp.second;
@ -281,7 +281,7 @@ nearest_vertex(const Point &p, Face_handle f) const
{
switch (dimension()) {
case 0:
if (number_of_vertices() == 0) return NULL;
if (number_of_vertices() == 0) return Vertex_handle();
if (number_of_vertices() == 1) return finite_vertex();
//break;
case 1:
@ -291,7 +291,7 @@ nearest_vertex(const Point &p, Face_handle f) const
return nearest_vertex_2D(p,f);
//break;
}
return NULL;
return Vertex_handle();
}
template < class Gt, class Tds >
@ -300,7 +300,7 @@ Delaunay_triangulation_2<Gt,Tds>::
nearest_vertex_2D(const Point& p, Face_handle f) const
{
CGAL_triangulation_precondition(dimension() == 2);
if (f == Face_handle(NULL)) f = locate(p);
if (f == Face_handle()) f = locate(p);
else
CGAL_triangulation_precondition(oriented_side(f,p)!=ON_NEGATIVE_SIDE);
@ -488,7 +488,7 @@ void
Delaunay_triangulation_2<Gt,Tds>::
remove(Vertex_handle v )
{
CGAL_triangulation_precondition( v != NULL);
CGAL_triangulation_precondition( v != Vertex_handle());
CGAL_triangulation_precondition( !is_infinite(v));
if ( dimension() <= 1) Triangulation::remove(v);

View File

@ -192,7 +192,7 @@ public:
// OutputItBoundaryEdges eit,
// OutputItHiddenVertices vit,
// Face_handle start =
// Face_handle(NULL)) const;
// Face_handle()) const;
// template <class OutputItFaces, class OutputItBoundaryEdges>
// std::pair<OutputItFaces,OutputItBoundaryEdges>
// get_conflicts_and_boundary(const Point &p,
@ -215,13 +215,13 @@ public:
// OutputItBoundaryEdges eit,
// OutputItHiddenVertices vit,
// Face_handle start=
// Face_handle(NULL)) const;
// Face_handle()) const;
// template <class OutputItHiddenVertices>
// OutputItHiddenVertices
// get_hidden_vertices(const Weighted_point &p,
// OutputItHiddenVertices vit,
// Face_handle start=
// Face_handle(NULL)) const;
// Face_handle()) const;
// DUAL
Bare_point dual (Face_handle f) const;
@ -236,7 +236,7 @@ public:
// Insertion, Deletion and Flip
Vertex_handle push_back(const Weighted_point &p);
Vertex_handle insert(const Weighted_point &p,
Face_handle f = Face_handle(NULL) );
Face_handle f = Face_handle() );
Vertex_handle insert(const Weighted_point &p,
Locate_type lt,
Face_handle loc, int li );
@ -244,7 +244,7 @@ public:
Vertex_handle insert_in_edge(const Weighted_point &p, Face_handle f, int i);
void flip(Face_handle f, int i);
void remove_degree_3(Vertex_handle v,
Face_handle f = Face_handle(NULL));
Face_handle f = Face_handle());
void remove(Vertex_handle v);
All_vertices_iterator all_vertices_begin () const;
@ -332,7 +332,7 @@ public:
OutputItBoundaryEdges eit,
OutputItHiddenVertices vit,
Face_handle start =
Face_handle(NULL)) const
Face_handle()) const
{
CGAL_triangulation_precondition( dimension() == 2);
int li;
@ -420,7 +420,7 @@ public:
get_conflicts_and_boundary (const Weighted_point &p,
OutputItFaces fit,
OutputItBoundaryEdges eit,
Face_handle start = Face_handle(NULL)) const
Face_handle start = Face_handle()) const
{
Triple<OutputItFaces,OutputItBoundaryEdges,Emptyset_iterator>
pp =
@ -435,7 +435,7 @@ public:
OutputItFaces fit,
OutputItHiddenVertices vit,
Face_handle start =
Face_handle(NULL)) const
Face_handle()) const
{
Triple<OutputItFaces, Emptyset_iterator,OutputItHiddenVertices>
pp =
@ -453,7 +453,7 @@ public:
OutputItBoundaryEdges eit,
OutputItHiddenVertices vit,
Face_handle start =
Face_handle(NULL)) const
Face_handle()) const
{
Triple<Emptyset_iterator,OutputItBoundaryEdges,
OutputItHiddenVertices>
@ -469,7 +469,7 @@ public:
OutputItFaces
get_conflicts (const Weighted_point &p,
OutputItFaces fit,
Face_handle start= Face_handle(NULL)) const
Face_handle start= Face_handle()) const
{
Triple<OutputItFaces,Emptyset_iterator,Emptyset_iterator>
pp =
@ -484,7 +484,7 @@ public:
OutputItBoundaryEdges
get_boundary_of_conflicts(const Weighted_point &p,
OutputItBoundaryEdges eit,
Face_handle start= Face_handle(NULL)) const
Face_handle start= Face_handle()) const
{
Triple<Emptyset_iterator, OutputItBoundaryEdges,Emptyset_iterator>
pp =
@ -498,7 +498,7 @@ public:
template <class OutputItHiddenVertices>
OutputItHiddenVertices
get_hidden_vertices(const Weighted_point &p, OutputItHiddenVertices vit,
Face_handle start= Face_handle(NULL)) const
Face_handle start= Face_handle()) const
{
Triple<Emptyset_iterator,Emptyset_iterator,
OutputItHiddenVertices>
@ -999,7 +999,7 @@ Regular_triangulation_2<Gt,Tds>::
insert(const Weighted_point &p, Locate_type lt, Face_handle loc, int li)
{
if (number_of_vertices() <= 1) return Base::insert(p);
Vertex_handle v(NULL);
Vertex_handle v();
Oriented_side os;
switch (lt) {
case Base::VERTEX:
@ -1193,7 +1193,7 @@ void
Regular_triangulation_2<Gt,Tds>::
remove_degree_3(Vertex_handle v, Face_handle f)
{
if (f == Face_handle(NULL)) f=v->face();
if (f == Face_handle()) f=v->face();
update_hidden_points_3_1(f, f->neighbor( cw(f->index(v))),
f->neighbor(ccw(f->index(v))));
Triangulation_2<Gt,Tds>::remove_degree_3(v,f);
@ -1222,7 +1222,7 @@ void
Regular_triangulation_2<Gt,Tds>::
remove(Vertex_handle v )
{
CGAL_triangulation_precondition( v != NULL );
CGAL_triangulation_precondition( v != Vertex_handle() );
CGAL_triangulation_precondition(!is_infinite(v));
if (v->is_hidden()) {

View File

@ -251,7 +251,7 @@ public:
Vertex_handle insert_in_face(const Point& p, Face_handle f);
Vertex_handle insert_outside_convex_hull(const Point& p, Face_handle f);
Vertex_handle insert_outside_affine_hull(const Point& p);
Vertex_handle insert(const Point &p, Face_handle start = Face_handle(NULL) );
Vertex_handle insert(const Point &p, Face_handle start = Face_handle() );
Vertex_handle insert(const Point& p,
Locate_type lt,
Face_handle loc, int li );
@ -259,7 +259,7 @@ public:
// int insert(InputIterator first, InputIterator last);
Vertex_handle push_back(const Point& a);
void remove_degree_3(Vertex_handle v, Face_handle f = Face_handle(NULL));
void remove_degree_3(Vertex_handle v, Face_handle f = Face_handle());
void remove_first(Vertex_handle v);
void remove_second(Vertex_handle v);
void remove(Vertex_handle v);
@ -276,11 +276,11 @@ public:
locate(const Point& p,
Locate_type& lt,
int& li,
Face_handle start = Face_handle(NULL)) const;
Face_handle start = Face_handle()) const;
Face_handle
locate(const Point &p,
Face_handle start = Face_handle(NULL)) const;
Face_handle start = Face_handle()) const;
@ -310,15 +310,15 @@ public:
Vertex_iterator vertices_end() const {return finite_vertices_end();}
Face_circulator incident_faces( Vertex_handle v,
Face_handle f = Face_handle(NULL)) const;
Face_handle f = Face_handle()) const;
Vertex_circulator incident_vertices(Vertex_handle v,
Face_handle f = Face_handle(NULL)) const;
Face_handle f = Face_handle()) const;
Edge_circulator incident_edges(Vertex_handle v,
Face_handle f = Face_handle(NULL)) const;
Face_handle f = Face_handle()) const;
Line_face_circulator line_walk(const Point& p,
const Point& q,
Face_handle f = Face_handle(NULL)) const;
Face_handle f = Face_handle()) const;
// TO DEBUG
void show_all() const;
@ -829,7 +829,7 @@ void
Triangulation_2<Gt, Tds>::
flip(Face_handle f, int i)
{
CGAL_triangulation_precondition ( f != NULL );
CGAL_triangulation_precondition ( f != Face_handle() );
CGAL_triangulation_precondition (i == 0 || i == 1 || i == 2);
CGAL_triangulation_precondition( dimension()==2);
@ -1050,7 +1050,7 @@ insert(const Point& p, Locate_type lt, Face_handle loc, int li)
return loc->vertex(li);
}
CGAL_triangulation_assertion(false); // locate step failed
return Vertex_handle(NULL);
return Vertex_handle();
}
@ -1068,7 +1068,7 @@ inline void
Triangulation_2<Gt,Tds>::
remove_degree_3(Vertex_handle v, Face_handle f)
{
if (f == Face_handle(NULL)) f=v->face();
if (f == Face_handle()) f=v->face();
_tds.remove_degree_3(v, f);
return;
}
@ -1096,7 +1096,7 @@ void
Triangulation_2<Gt,Tds>::
remove(Vertex_handle v)
{
CGAL_triangulation_precondition( v != NULL);
CGAL_triangulation_precondition( v != Verex_handle());
CGAL_triangulation_precondition( !is_infinite(v));
if (number_of_vertices() == 1) remove_first(v);
@ -1184,7 +1184,7 @@ make_hole ( Vertex_handle v, std::list<Edge> & hole)
if( vv->face()== f) vv->set_face(fn);
vv = f->vertex(ccw(i));
if( vv->face()== f) vv->set_face(fn);
fn->set_neighbor(in, NULL);
fn->set_neighbor(in, Face_handle());
hole.push_back(Edge(fn,in));
to_delete.push_back(f);
}
@ -1566,7 +1566,7 @@ march_locate_1D(const Point& t,
if(pqt == RIGHT_TURN || pqt == LEFT_TURN) {
lt = OUTSIDE_AFFINE_HULL;
li = 4 ;// should not be used
return Face_handle(NULL);
return Face_handle();
}
int i= f->index(ff);
@ -1614,7 +1614,7 @@ march_locate_1D(const Point& t,
}
}
CGAL_triangulation_assertion(false);
return Face_handle(NULL);
return Face_handle();
}
template <class Gt, class Tds >
@ -1703,13 +1703,13 @@ locate(const Point& p,
}
li = 4; // li should not be used in this case
}
return NULL;
return Face_handle();
}
if(dimension() == 1){
return march_locate_1D(p, lt, li);
}
if(start == NULL){
if(start == Face_handle()){
start = infinite_face()->
neighbor(infinite_face()->index(infinite_vertex()));
}else if(is_infinite(start)){
@ -1891,7 +1891,7 @@ line_walk(const Point& p, const Point& q, Face_handle f) const
{
CGAL_triangulation_precondition( (dimension() == 2) &&
! xy_equal(p,q));
Line_face_circulator lfc = (f == NULL)
Line_face_circulator lfc = (f == Face_handle())
? Line_face_circulator(p, q, this)
: Line_face_circulator(p, q, f, this);

View File

@ -86,14 +86,16 @@ public:
Face&
operator*() const
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() &&
_v != Vertex_handle());
return *pos;
}
Face*
operator->() const
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() &&
_v != Vertex_handle());
return &*pos;
}
@ -164,14 +166,16 @@ public:
Vertex&
operator*() const
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() &&
_v != Vertex_handle());
return *(pos->vertex(_ri));
}
Vertex*
operator->() const
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() &&
_v != Vertex_handle());
return &*(pos->vertex(_ri));
}
@ -222,11 +226,11 @@ private:
public:
Triangulation_ds_edge_circulator_2()
: _v(NULL), pos(NULL)
: _v(), pos()
{}
Triangulation_ds_edge_circulator_2( Vertex_handle v,
Face_handle f = NULL);
Face_handle f = Face_handle());
Edge_circulator& operator++();
Edge_circulator operator++(int);
@ -259,11 +263,11 @@ Triangulation_ds_face_circulator_2<Tds> ::
Triangulation_ds_face_circulator_2(Vertex_handle v, Face_handle f)
: _v(v), pos(f)
{
if (_v == NULL) pos = NULL;
else if ( pos == NULL) pos = v->face();
if (_v == Vertex_handle()) pos = Face_handle();
else if ( pos == Face_handle()) pos = v->face();
if (pos == NULL || pos->dimension() < 2) {
_v = NULL ; pos = NULL; return;}
if (pos == Face_handle()|| pos->dimension() < 2) {
_v = Vertex_handle() ; pos = Face_handle(); return;}
else CGAL_triangulation_precondition( pos->has_vertex(v));
}
@ -284,7 +288,8 @@ Triangulation_ds_face_circulator_2<Tds>&
Triangulation_ds_face_circulator_2<Tds> ::
operator++()
{
CGAL_triangulation_precondition( (pos != NULL) && (_v != NULL) );
CGAL_triangulation_precondition( (pos != Face_handle() &&
_v != Vertex_handle());
int i = pos->index(_v);
pos = pos->neighbor(ccw(i));
return *this;
@ -295,7 +300,8 @@ Triangulation_ds_face_circulator_2<Tds>
Triangulation_ds_face_circulator_2<Tds> ::
operator++(int)
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() &&
_v != Vertex_handle());
Face_circulator tmp(*this);
++(*this);
return tmp;
@ -306,7 +312,8 @@ Triangulation_ds_face_circulator_2<Tds>&
Triangulation_ds_face_circulator_2<Tds> ::
operator--()
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() &&
_v != Vertex_handle());
int i = pos->index(_v);
pos = pos->neighbor(cw(i));
return *this;
@ -317,7 +324,8 @@ Triangulation_ds_face_circulator_2<Tds>
Triangulation_ds_face_circulator_2<Tds> ::
operator--(int)
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() &&
_v != Vertex_handle());
Face_circulator tmp(*this);
--(*this);
return tmp;
@ -344,7 +352,7 @@ inline bool
Triangulation_ds_face_circulator_2<Tds> ::
is_empty() const
{
return ((_v == NULL) || (pos == NULL));
return (_v == Vertex_handle() || pos == Face_handle() );
}
template < class Tds >
@ -353,7 +361,7 @@ Triangulation_ds_face_circulator_2<Tds> ::
operator==(CGAL_NULL_TYPE CGAL_triangulation_assertion_code(n)) const
{
CGAL_triangulation_assertion( n == NULL);
return (_v == NULL || pos == NULL);
return (_v == Vertex_handle() || pos == Face_handle() );
}
template < class Tds >
@ -419,7 +427,7 @@ Triangulation_ds_vertex_circulator_2<Tds>&
Triangulation_ds_vertex_circulator_2<Tds> ::
operator--()
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() && _v != Vertex_handle());
int i = pos->index(_v);
if (pos->dimension() == 1) {
@ -492,11 +500,11 @@ Triangulation_ds_edge_circulator_2<Tds> ::
Triangulation_ds_edge_circulator_2(Vertex_handle v, Face_handle f)
: _v(v), pos(f)
{
if (_v == NULL) { pos = NULL;}
else if (pos==NULL) {pos = v->face();}
if (_v == Vertex_handle()) { pos = Face_handle();}
else if (pos==Face_handle()) {pos = v->face();}
if (pos == NULL || pos->dimension() < 1){
_v = NULL; pos = NULL;return;}
if (pos == Face_handle() || pos->dimension() < 1){
_v = Vertex_handle(); pos = Face_handle();return;}
int i = pos->index(_v);
if (pos->dimension() == 2) {_ri = ccw(i);}
else {_ri = 2;}
@ -508,7 +516,7 @@ Triangulation_ds_edge_circulator_2<Tds>&
Triangulation_ds_edge_circulator_2<Tds> ::
operator++()
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() && _v != Vertex_handle());
int i = pos->index(_v);
if (pos->dimension() == 1) {
pos = pos->neighbor(1-i);
@ -537,7 +545,7 @@ Triangulation_ds_edge_circulator_2<Tds>&
Triangulation_ds_edge_circulator_2<Tds> ::
operator--()
{
CGAL_triangulation_precondition(pos != NULL && _v != NULL);
CGAL_triangulation_precondition(pos != Face_handle() && _v != Vertex_handle());
int i = pos->index(_v);
if (pos->dimension() == 1) {
@ -583,7 +591,7 @@ inline bool
Triangulation_ds_edge_circulator_2<Tds> ::
is_empty() const
{
return (_v == NULL || pos == NULL);
return (_v == Vertex_handle() || pos == Face_handle());
}
template < class Tds >
@ -592,7 +600,7 @@ Triangulation_ds_edge_circulator_2<Tds> ::
operator==(CGAL_NULL_TYPE CGAL_triangulation_assertion_code(n)) const
{
CGAL_triangulation_assertion( n == NULL);
return (_v == NULL || pos == NULL);
return (v == Vertex_handle() || pos == Face_handle());
}
template < class Tds >

View File

@ -72,7 +72,7 @@ typename Triangulation_ds_face_2<Fb>::Vertex_handle
Triangulation_ds_face_2<Fb>::
mirror_vertex(int i) const
{
CGAL_triangulation_precondition ( neighbor(i) != NULL && dimension() >= 1);
CGAL_triangulation_precondition ( neighbor(i) != Face_handle() && dimension() >= 1);
//return neighbor(i)->vertex(neighbor(i)->index(this->handle()));
return neighbor(i)->vertex(mirror_index(i));
}

View File

@ -110,7 +110,7 @@ is_valid(bool verbose, int level)
{
bool result = Vb::is_valid(verbose, level);
CGAL_triangulation_assertion(result);
if (face() != NULL) { // face==NULL if dim <0
if (face() != Face_handle()) { // face==NULL if dim <0
result = result && ( &*face()->vertex(0) == this ||
&*face()->vertex(1) == this ||
&*face()->vertex(2) == this );

View File

@ -73,7 +73,7 @@ public:
bool is_valid(bool verbose = false, int level = 0) const;
// INSERT REMOVE
Vertex_handle insert(const Point &p, Face_handle start = Face_handle(NULL) );
Vertex_handle insert(const Point &p, Face_handle start = Face_handle() );
Vertex_handle insert(const Point& p,
Locate_type lt,
Face_handle loc, int li );
@ -100,11 +100,11 @@ public:
locate(const Point& p,
Locate_type& lt,
int& li,
Face_handle start = Face_handle(NULL)) const;
Face_handle start = Face_handle()) const;
Face_handle
locate(const Point &p,
Face_handle start = Face_handle(NULL)) const;
Face_handle start = Face_handle()) const;
private:
void locate_in_all(const Point& p,
@ -168,7 +168,7 @@ copy_triangulation(const Triangulation_hierarchy_2<Tr> &tr)
{
for( Finite_vertices_iterator it=hierarchy[0]->finite_vertices_begin();
it != hierarchy[0]->finite_vertices_end(); ++it) {
if (it->up() != NULL) V[ it->up()->down() ] = it;
if (it->up() != Vertex_handle()) V[ it->up()->down() ] = it;
}
}
{
@ -180,7 +180,7 @@ copy_triangulation(const Triangulation_hierarchy_2<Tr> &tr)
// make reverse link
it->down()->set_up(it);
// make map for next level
if (it->up()!= NULL ) V[ it->up()->down() ] = it;
if (it->up()!= Vertex_handle() ) V[ it->up()->down() ] = it;
}
}
}
@ -238,7 +238,7 @@ is_valid(bool verbose, int level) const
//verify that lower level has no down pointers
for( 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 have down pointer and reciprocal link is fine
for(i=1;i<Triangulation_hierarchy_2__maxlevel;++i)
for( it = hierarchy[i]->finite_vertices_begin();
@ -249,7 +249,7 @@ is_valid(bool verbose, int level) const
for(i=0;i<Triangulation_hierarchy_2__maxlevel-1;++i)
for( it = hierarchy[i]->finite_vertices_begin();
it != hierarchy[i]->finite_vertices_end(); ++it)
result = result && ( it->up() == NULL ||
result = result && ( it->up() == Vertex_handle() ||
&*it == &*(it->up())->down() );
return result;
}
@ -334,7 +334,7 @@ remove(Vertex_handle v )
int l = 0 ;
while(1){
hierarchy[l++]->remove(v);
if (u == NULL) break;
if (u == Vertex_handle()) break;
if(l>Triangulation_hierarchy_2__maxlevel) break;
v=u; u=v->up();
}
@ -393,8 +393,8 @@ locate_in_all(const Point& p,
int& li,
Face_handle pos[Triangulation_hierarchy_2__maxlevel]) const
{
Face_handle position(NULL);
Vertex_handle nearest(NULL);
Face_handle position();
Vertex_handle nearest();
int level = Triangulation_hierarchy_2__maxlevel;
typename Geom_traits::Compare_distance_2
closer = geom_traits().compare_distance_2_object();

View File

@ -69,7 +69,7 @@ private:
public:
Triangulation_line_face_circulator_2()
: pos(NULL), _tr(NULL), s(undefined), i(-1)
: pos(), _tr(NULL), s(undefined), i(-1)
{}
Triangulation_line_face_circulator_2(Vertex_handle v,
@ -157,7 +157,7 @@ Triangulation_line_face_circulator_2<Gt,Tds>::
Triangulation_line_face_circulator_2(Vertex_handle v,
const Triangulation_2<Gt,Tds>* tr,
const Point& dir)
:pos(NULL), _tr(tr), s(undefined)
:pos(), _tr(tr), s(undefined)
// begin at the face incident to v, traversed by the ray from v to
// dir
// or null iterator
@ -239,7 +239,7 @@ Triangulation_line_face_circulator_2<Gt,Tds>::
Triangulation_line_face_circulator_2(const Point& pp,
const Point& qq,
const Triangulation_2<Gt,Tds> * t)
: pos(NULL), _tr(t), s(undefined), p(pp), q(qq)
: pos(), _tr(t), s(undefined), p(pp), q(qq)
//begins at the first finite face traversed be the oriented line pq
{
Vertex_handle inf = _tr->infinite_vertex();
@ -425,7 +425,7 @@ void
Triangulation_line_face_circulator_2<Gt,Tds>::
increment()
{
CGAL_triangulation_precondition(pos != CGAL_CIRC_NULL);
CGAL_triangulation_precondition(pos != Face_handle());
if(s == vertex_vertex || s == edge_vertex) {
Orientation o;
do{
@ -478,7 +478,7 @@ void
Triangulation_line_face_circulator_2<Gt,Tds>::
decrement()
{
CGAL_triangulation_precondition(pos != CGAL_CIRC_NULL);
CGAL_triangulation_precondition(pos != Face_handle());
if(s == vertex_vertex || s == vertex_edge) {
if(s == vertex_vertex){
i = cw(i);
@ -598,7 +598,7 @@ Triangulation_line_face_circulator_2<Gt,Tds>&
Triangulation_line_face_circulator_2<Gt,Tds>::
operator++()
{
CGAL_triangulation_precondition( pos != CGAL_CIRC_NULL) ;
CGAL_triangulation_precondition( pos != Face_handle()) ;
increment();
return *this;
}
@ -609,7 +609,7 @@ Triangulation_line_face_circulator_2<Gt,Tds>&
Triangulation_line_face_circulator_2<Gt,Tds>::
operator--()
{
CGAL_triangulation_precondition(*this != CGAL_CIRC_NULL) ;
CGAL_triangulation_precondition(pos != Face_handle()) ;
decrement();
return *this;
}
@ -641,8 +641,8 @@ inline bool
Triangulation_line_face_circulator_2<Gt,Tds>::
operator==(const Line_face_circulator& lfc) const
{
CGAL_triangulation_precondition( *this != CGAL_CIRC_NULL &&
lfc != CGAL_CIRC_NULL);
CGAL_triangulation_precondition( pos != Face_handle() &&
lfc.pos != Face_handle());
return ( pos == lfc.pos && _tr == lfc._tr &&
s== lfc.s && p==lfc.p && q==lfc.q);
}
@ -660,7 +660,7 @@ inline bool
Triangulation_line_face_circulator_2<Gt,Tds>::
is_empty() const
{
return pos == (CGAL_CIRC_NULL);
return pos == Face_handle();
}
template < class Gt, class Tds >
@ -669,7 +669,7 @@ Triangulation_line_face_circulator_2<Gt,Tds>::
operator==(CGAL_NULL_TYPE CGAL_triangulation_assertion_code(n)) const
{
CGAL_triangulation_assertion( n == NULL);
return pos ==(CGAL_CIRC_NULL);
return pos == Face_handle();
}
template < class Gt, class Tds >