mirror of https://github.com/CGAL/cgal
improve the is_valid() method: more thorough test
This commit is contained in:
parent
e9d2061ac3
commit
0aa3a83f6f
|
|
@ -68,7 +68,7 @@ public:
|
||||||
return full_cell_;
|
return full_cell_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_valid(bool verbose = true, int /* level */ = 0) const /* Concept */
|
bool is_valid(bool verbose = false, int /* level */ = 0) const /* Concept */
|
||||||
{
|
{
|
||||||
if( Full_cell_handle() == full_cell() )
|
if( Full_cell_handle() == full_cell() )
|
||||||
{
|
{
|
||||||
|
|
@ -76,6 +76,28 @@ public:
|
||||||
CGAL_warning_msg(false, "vertex has no incident full cell.");
|
CGAL_warning_msg(false, "vertex has no incident full cell.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool found(false);
|
||||||
|
// These two typename below are OK because TDS fullfils the
|
||||||
|
// TriangulationDataStructure concept.
|
||||||
|
typename TDS::Full_cell::Vertex_handle_iterator vit(full_cell()->vertices_begin());
|
||||||
|
typedef typename TDS::Vertex_handle Vertex_handle;
|
||||||
|
while( vit != full_cell()->vertices_end() )
|
||||||
|
{
|
||||||
|
if( Vertex_handle() == *vit )
|
||||||
|
break; // The full cell has no more vertices
|
||||||
|
if( this == &(**vit) )
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++vit;
|
||||||
|
}
|
||||||
|
if( ! found )
|
||||||
|
{
|
||||||
|
if( verbose )
|
||||||
|
CGAL_warning_msg(false, "vertex's adjacent full cell does not contain that vertex.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue