fixed is_valid() in Triangulation_ds_face_2.h

This commit is contained in:
Mariette Yvinec 2002-11-28 17:50:37 +00:00
parent 39da2c4efc
commit 868c0b7cf4
3 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,10 @@
Package triangulation: provides triangulations Delaunay triangulations,
constrained and regular triangulations with tests and examples.
Ver 7.53
- fixed a long line in Trivial_iterator.h
- fixed is_valid() and mirror_vertex in Triangulation_ds_face_2.h
Ver 7.52 (12/11/02)
- fixes is_valid() de Triangulation_ds_face_2.h
to deal with data structure when two faces can share 3 vertices

View File

@ -20,6 +20,7 @@ int main()
Delaunay dt;
dt.insert(begin, end);
std::cout << dt.number_of_vertices() << std::endl;
return 0;
}

View File

@ -127,7 +127,7 @@ typename Triangulation_ds_face_2<Tds>::Vertex_handle
Triangulation_ds_face_2<Tds>::
mirror_vertex(int i) const
{
CGAL_triangulation_precondition ( neighbor(i) != NULL);
CGAL_triangulation_precondition ( neighbor(i) != NULL && dimension() >= 1);
//return neighbor(i)->vertex(neighbor(i)->index(this->handle()));
return neighbor(i)->vertex(mirror_index(i));
}
@ -138,8 +138,8 @@ Triangulation_ds_face_2<Tds>::
mirror_index(int i) const
{
// return the index of opposite vertex in neighbor(i);
CGAL_triangulation_precondition (neighbor(i) != NULL);
//return neighbor(i)->index(this->handle());
CGAL_triangulation_precondition (neighbor(i) != NULL && dimension() >= 1);
if (dimension() == 1) return neighbor(i)->index(this->handle());
return ccw( neighbor(i)->index(vertex(ccw(i))));
}
@ -210,10 +210,12 @@ is_valid(bool verbose, int level) const
bool result = Fb::is_valid(verbose, level);
for(int i = 0; i <= dimension(); i++) {
Face_handle n = neighbor(i);
// MK: this needs to be changed so that we get the correct index
// when we have two faces with two common edges
// int in = n->index(this->handle());
int in = n->index(mirror_vertex(i));
// the strange formulation in case dimension()==2
// is used to handle the cases of TDS allowing
// two faces with two common edges
int in;
if (dimension() == 0) in = n->index(this->handle());
else in = n->index(mirror_vertex(i));
result = result && ( this->handle() == n->neighbor(in) );
switch(dimension()) {
case 0 :