From ed97df642a6d9a725e90f623d9ecf23e95868f8f Mon Sep 17 00:00:00 2001 From: Monique Teillaud Date: Thu, 13 Jul 2000 22:00:44 +0000 Subject: [PATCH] added : are_equal and has_vertex for facets test_dim_down --- .../include/CGAL/Triangulation_3.h | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/Packages/Triangulation_3/include/CGAL/Triangulation_3.h b/Packages/Triangulation_3/include/CGAL/Triangulation_3.h index aedfc0085fb..d0ea66d2cf0 100644 --- a/Packages/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Packages/Triangulation_3/include/CGAL/Triangulation_3.h @@ -164,6 +164,8 @@ protected: insert_increase_dimension(p3); } + bool test_dim_down(Vertex_handle v); + public: // CONSTRUCTORS @@ -349,6 +351,15 @@ public: bool is_vertex(const Point & p, Vertex_handle & v) const; + bool has_vertex(const Facet & f, Vertex_handle v, int & j) const; + bool has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const; + bool has_vertex(const Facet & f, Vertex_handle v) const; + bool has_vertex(Cell_handle c, int i, Vertex_handle v) const; + + bool are_equal(Cell_handle c, int i, Cell_handle n, int j) const; + bool are_equal(const Facet & f, const Facet & g) const; + bool are_equal(const Facet & f, Cell_handle n, int j) const; + Cell_handle locate(const Point & p) const; inline Cell_handle @@ -580,6 +591,7 @@ private: // c belongs to the hat of v and has a facet on its boundary // traverses the boundary of the hat and finds adjacencies // traversal is done counterclockwise as seen from v + public: Vertex_handle @@ -1124,6 +1136,42 @@ operator<< (std::ostream& os, const Triangulation_3 &tr) return os ; } +template < class GT, class Tds > +bool +Triangulation_3:: +test_dim_down(Vertex_handle v) +{ + // tests whether removing v decreases the dimension of the triangulation + // true iff + // v is incident to all finite cells + // and all the other vertices are coplanar + CGAL_triangulation_precondition(dimension() == 3); + CGAL_triangulation_precondition(! is_infinite(v) ); + + Cell_iterator cit = finite_cells_begin(); + Cell_iterator cdone = cells_end(); + + int i, iv; + if ( ! cit->has_vertex(v,iv) ) return false; + Point p1=cit->vertex((iv+1)&3)->point(); + Point p2=cit->vertex((iv+2)&3)->point(); + Point p3=cit->vertex((iv+3)&3)->point(); + ++cit; + + while ( cit != cdone ) { + if ( ! cit->has_vertex(v,iv) ) + return false; + for ( i=1; i<4; i++ ) { + if ( geom_traits().orientation + (p1,p2,p3,cit->vertex((iv+i)&3)->point()) != COPLANAR ) + return false; + } + ++cit; + } + + return true; +}// test_dim_down + template < class GT, class Tds > int Triangulation_3:: @@ -1402,6 +1450,57 @@ is_vertex(const Point & p, Vertex_handle & v) const return false; } +template < class GT, class Tds > +bool +Triangulation_3:: +has_vertex(const Facet & f, Vertex_handle v, int & j) const +{ + return( _tds.has_vertex(&*(f.first), f.second, &*v, j) ); +} +template < class GT, class Tds > +bool +Triangulation_3:: +has_vertex(Cell_handle c, int i, Vertex_handle v, int & j) const +{ + return( _tds.has_vertex(&*c, i, &*v, j) ); +} +template < class GT, class Tds > +bool +Triangulation_3:: +has_vertex(const Facet & f, Vertex_handle v) const +{ + return( _tds.has_vertex(&*(f.first), f.second, &*v) ); +} +template < class GT, class Tds > +bool +Triangulation_3:: +has_vertex(Cell_handle c, int i, Vertex_handle v) const +{ + return( _tds.has_vertex(&*c, i, &*v) ); +} + +template < class GT, class Tds > +bool +Triangulation_3:: +are_equal(Cell_handle c, int i, Cell_handle n, int j) const +{ + return( _tds.are_equal(&*c, i, &*n, j) ); +} +template < class GT, class Tds > +bool +Triangulation_3:: +are_equal(const Facet & f, const Facet & g) const +{ + return( _tds.are_equal(&*(f.first), f.second, &*(g.first), g.second) ); +} +template < class GT, class Tds > +bool +Triangulation_3:: +are_equal(const Facet & f, Cell_handle n, int j) const +{ + return( _tds.are_equal(&*(f.first), f.second, &*n, j) ); +} + template < class GT, class Tds > Triangulation_3::Cell_handle Triangulation_3::