bug fixes in Edge and Facet iterators

This commit is contained in:
Monique Teillaud 1998-11-25 13:28:37 +00:00
parent dca969665f
commit 3d455f634e
2 changed files with 36 additions and 9 deletions

View File

@ -554,6 +554,9 @@ public:
notfound = false; notfound = false;
} }
} }
else {
b=0; e=1;
}
} while ( (pos != _tds->past_end_cell()) && } while ( (pos != _tds->past_end_cell()) &&
notfound ); notfound );
break; break;
@ -604,13 +607,21 @@ public:
e--; e--;
} }
} }
if (pos != _tds->past_end_cell()) {
Cell_circulator ccir = _tds->incident_cells(CGAL_make_triple(pos,b,e)); Cell_circulator ccir = _tds->incident_cells(CGAL_make_triple(pos,b,e));
while ( &(*ccir) > pos ) { // while ( &(*ccir) > pos ) {
--ccir; // --ccir;
} // }
do {
++ccir;
} while ( &(*ccir) > pos );
if ( &(*ccir) == pos ) {// pos is the cell with minimum pointer if ( &(*ccir) == pos ) {// pos is the cell with minimum pointer
notfound = false; notfound = false;
} }
}
else {
b=0; e=1;
}
} while ( (pos != _tds->past_end_cell()) && } while ( (pos != _tds->past_end_cell()) &&
notfound ); notfound );
break; break;

View File

@ -338,7 +338,8 @@ public:
} }
CGAL_Triangulation_edge_iterator_3(CGAL_Triangulation_3<Gt,Tds> *tr) CGAL_Triangulation_edge_iterator_3(CGAL_Triangulation_3<Gt,Tds> *tr)
: _ib( &(tr->_tds), 1), _tr(tr) : _ib( &(tr->_tds), 1), _tr(tr), _inf(true)
// _inf is initialized but should never be used
{ } { }
CGAL_Triangulation_edge_iterator_3(const Edge_iterator & ei) CGAL_Triangulation_edge_iterator_3(const Edge_iterator & ei)
@ -357,7 +358,14 @@ public:
bool bool
operator==(const Edge_iterator & ei) const operator==(const Edge_iterator & ei) const
{ {
return ( _ib == ei._ib); if ( _tr != ei._tr )
return false;
if ( ( _ib == _tr->_tds.edges_end() )
|| ( ei._ib == _tr->_tds.edges_end() ) )
return ( _ib == ei._ib );
return ( ( _ib == ei._ib ) && ( _inf == ei._inf ) );
} }
bool bool
@ -458,6 +466,7 @@ public:
CGAL_Triangulation_facet_iterator_3(CGAL_Triangulation_3<Gt,Tds> *tr) CGAL_Triangulation_facet_iterator_3(CGAL_Triangulation_3<Gt,Tds> *tr)
: _ib( &(tr->_tds), 1), _tr(tr), _inf(true) : _ib( &(tr->_tds), 1), _tr(tr), _inf(true)
// _inf is initialized but should never be used
{ } { }
CGAL_Triangulation_facet_iterator_3(const Facet_iterator & fi) CGAL_Triangulation_facet_iterator_3(const Facet_iterator & fi)
@ -476,7 +485,14 @@ public:
bool bool
operator==(const Facet_iterator & fi) const operator==(const Facet_iterator & fi) const
{ {
return ( _ib == fi._ib); if ( _tr != fi._tr )
return false;
if ( ( _ib == _tr->_tds.facets_end() )
|| ( fi._ib == _tr->_tds.facets_end() ) )
return ( _ib == fi._ib );
return ( ( _ib == fi._ib ) && ( _inf == fi._inf ) );
} }
bool bool
@ -509,7 +525,7 @@ public:
else{ else{
do { do {
--_ib; --_ib;
} while ( ( _ib != _tr->_tds.edges_end() ) } while ( ( _ib != _tr->_tds.facets_end() )
&& _tr->is_infinite(make_pair(Cell_handle( (Cell *) (*_ib).first), (*_ib).second )) ); && _tr->is_infinite(make_pair(Cell_handle( (Cell *) (*_ib).first), (*_ib).second )) );
} }
return *this; return *this;