revised is_valid code and doc for Triangulation class

This commit is contained in:
Samuel Hornus 2012-07-10 13:13:41 +00:00
parent f4bc57b8ef
commit ba7c89c860
3 changed files with 39 additions and 32 deletions

View File

@ -38,6 +38,14 @@ check all is_valid function, precise in the doc what they are doing.
details)", and that we re document the same function in the class documentation
with details on what exactly is performed by the implementation.
OD: seems reasonable
SAM: I've changed my mind a little. We need some easy mandatory checks in
concepts T...DSFullCell and T...DSVertex so that we can rely on these tests in
the implementation of T.._data_structure, instead of having to re-implement them.
So : the concepts lists simple validity checks taht must be present, and refers
to the documentation of the models for possible additional validity checks
that are implemented.
--> This scheme is done (code&doc) for TDS TDSFullCell and TDSVertex and Triangulation.
--> ALL DONE.
small feature with iterator "all tuples"

View File

@ -477,22 +477,20 @@ defined by the infinite full cell \ccc{c} must contain \ccc{p}.}
\begin{ccDebug}
\ccHeading{Validity check}
\ccMethod{bool is_valid(bool verbose = true) const;}
\ccMethod{bool is_valid(bool verbose=false) const;}
{Partially checks whether \ccVar\ is a triangulation. This function returns
\ccc{true} if the combinatorial triangulation data structure's \ccc{is_valid()}
test returns \ccc{true} and if some geometric tests are passed with success.
%\note{is it really necessary to have the following :
%For each infinite full cell, it is checked that the index of the infinite
%vertex is 0. }
For each finite full cell, it is checked that its orientation is
positive.
\ccc{verbose} parameter is not used.
test returns \ccc{true} and if some geometric tests are passed with success: It
is checked that the orientation of each finite full cell is positive and that
the orientation of each infinite full cell is consistent with their finite
adjacent full cells.
The \ccc{verbose} parameter is not used.%
}
\ccMethod{bool are_incident_full_cells_valid(Vertex_const_handle v, bool
verbose = true) const;} {Returns \ccc{true} if and only if all
verbose = false) const;} {Returns \ccc{true} if and only if all
finite full cells incident to \ccc{v} have positive orientation.
\ccc{verbose} parameter is not used.
The \ccc{verbose} parameter is not used.%
}
\end{ccDebug}

View File

@ -372,15 +372,15 @@ public:
bool is_infinite(Full_cell_const_handle s) const
{
CGAL_precondition(Full_cell_const_handle() != s);
for ( int i=0; i<= current_dimension(); ++i)
if (is_infinite(s->vertex(i))) return true;
return false;
for(int i(0); i <= current_dimension(); ++i)
if (is_infinite(s->vertex(i))) return true;
return false;
}
bool is_infinite(const Full_cell & s) const
{
for ( int i=0; i<= current_dimension(); ++i)
if (is_infinite(s.vertex(i))) return true;
return false;
for ( int i=0; i<= current_dimension(); ++i)
if (is_infinite(s.vertex(i))) return true;
return false;
}
bool is_infinite(const Facet & ft) const
@ -388,7 +388,7 @@ public:
Full_cell_const_handle s = full_cell(ft);
CGAL_precondition(s != Full_cell_handle());
if( is_infinite(s) )
return (s->vertex(index_of_covertex(ft)) != infinite_vertex());
return (s->vertex(index_of_covertex(ft)) != infinite_vertex());
return false;
}
@ -398,10 +398,10 @@ public:
CGAL_precondition(s != Full_cell_handle());
if( is_infinite(s) )
{
Vertex_handle v;
for( int i(0); i<= f.face_dimension(); ++i)
if ( is_infinite( f.vertex(i) )) return true;
}
Vertex_handle v;
for( int i(0); i<= f.face_dimension(); ++i)
if ( is_infinite( f.vertex(i) )) return true;
}
return false;
}
@ -439,7 +439,8 @@ public:
template< typename OutputIterator >
OutputIterator incident_upper_faces( Vertex_const_handle v, const int d,
OutputIterator out)
{
{ // FIXME: uncomment this function, since it uses a comparator specific to
// *geometric* triangulation (taking infinite vertex into account)
internal::Triangulation::Compare_vertices_for_upper_face<Self> cmp(*this);
return tds().incident_upper_faces(v, d, out, cmp);
}
@ -498,8 +499,8 @@ public:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VALIDITY
bool is_valid(bool = true, int = 0) const;
bool are_incident_full_cells_valid(Vertex_const_handle, bool = true, int = 0) const;
bool is_valid(bool = false, int = 0) const;
bool are_incident_full_cells_valid(Vertex_const_handle, bool = false, int = 0) const;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - POINT LOCATION
@ -883,14 +884,14 @@ Triangulation<TT, TDS>
continue; // go to next full_cell's facet
}
typedef typename Self::Full_cell::Point_const_iterator Point_const_iterator;
Point_equality_predicate pred(s->vertex(i)->point());
Substitute_iterator< Point_const_iterator, Point_equality_predicate >
begin( s->points_begin(), pred, p),
end ( s->points_begin()+ (cur_dim+1), pred, p);
orientations_[i] = orientation_pred( begin, end);
typedef typename Self::Full_cell::Point_const_iterator Point_const_iterator;
Point_equality_predicate pred(s->vertex(i)->point());
Substitute_iterator< Point_const_iterator, Point_equality_predicate >
begin( s->points_begin(), pred, p),
end ( s->points_begin()+ (cur_dim+1), pred, p);
orientations_[i] = orientation_pred( begin, end);
/* // we temporarily substitute |p| to the |i|-th point of the
/* // we temporarily substitute |p| to the |i|-th point of the
// full_cell
Point backup = s->vertex(i)->point();
s->vertex(i)->set_point(p);
@ -1046,7 +1047,7 @@ Triangulation<TT, TDS>
{
if( current_dimension() > 1 )
{
int i = c->index( infinite_vertex() );
int i = c->index( infinite_vertex() );
Full_cell_handle n = c->neighbor(i);
infinite_vertex()->set_point(n->vertex(c->mirror_index(i))->point());
o = - orientation(c, true);