From dfddeb8b157e0d09ab0830d24c5d9cd7a5c210f8 Mon Sep 17 00:00:00 2001 From: Mariette Yvinec Date: Mon, 6 Sep 1999 14:17:03 +0000 Subject: [PATCH] Change f->opposite_index(int i ), f->opposite_vertexint (int i) to f->mirror_index(int i), f->mirror_vertex(int i) add new functionalities to Tds and Triangulation : Face_handle add_face(Face_handle f1, int i1, Face_handle f2, int i2, Face_handle f3, int i3); Face_handle add_face(Face_handle f1, int i1, Face_handle f2, int i2); Face_handle add_face(Face_handle f, int i, Vertex_handle v); And change the code of remove_2D() in Triangulation_2.h and Delaunay_triangulation_2.h Incoporate some of the changes made in Dagsthul to compile with VC++ --- .../include/CGAL/Delaunay_triangulation_2.h | 136 +++----- .../include/CGAL/Triangulation_2.h | 292 +++++++----------- .../Triangulation_default_data_structure_2.h | 48 ++- .../CGAL/Triangulation_ds_circulators_2.h | 2 +- .../include/CGAL/Triangulation_ds_face_2.h | 8 +- .../CGAL/Triangulation_euclidean_traits_2.h | 2 +- .../include/CGAL/Triangulation_face_2.h | 12 +- .../test/Triangulation_2/Makefile | 15 +- .../include/CGAL/_test_cls_tds_2.C | 34 -- .../include/CGAL/_test_cls_tds_face.C | 26 +- .../include/CGAL/_test_cls_triangulation_2.C | 14 +- .../test_delaunay_triangulation_2.C | 38 +-- .../Triangulation_2/test_triangulation_2.C | 2 +- 13 files changed, 254 insertions(+), 375 deletions(-) diff --git a/Packages/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Packages/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index f52d52ec8f4..d7ddb0265ab 100644 --- a/Packages/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Packages/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -98,89 +98,33 @@ private: Distance& closer) const; public: -#ifndef CGAL_CFG_NO_MEMBER_TEMPLATES -template < class Stream> -Stream& draw_dual(Stream & ps) -{ - Finite_edges_iterator eit= finite_edges_begin(); - for (; eit != finite_edges_end(), eend; ++eit) { - Object o = t.dual(eit); - Ray r; - Segment s; - Line l; - if (CGAL::assign(s,o)) ps << s; - if (CGAL::assign(r,o)) ps << r; - if (CGAL::assign(l,o)) ps << l; - } - return ps; -} -#endif //CGAL_CFG_NO_MEMBER_TEMPLATES + template < class Stream> + Stream& draw_dual(Stream & ps) + { + Finite_edges_iterator eit= finite_edges_begin(); + for (; eit != finite_edges_end(), eend; ++eit) { + Object o = t.dual(eit); + Ray r; + Segment s; + Line l; + if (CGAL::assign(s,o)) ps << s; + if (CGAL::assign(r,o)) ps << r; + if (CGAL::assign(l,o)) ps << l; + } + return ps; + } -#ifndef CGAL_CFG_NO_MEMBER_TEMPLATES template < class InputIterator > int insert(InputIterator first, InputIterator last) - { + { int n = number_of_vertices(); while(first != last){ - insert(*first); - ++first; + insert(*first); + ++first; } return number_of_vertices() - n; - } - #else - #if defined(LIST_H) || defined(__SGI_STL_LIST_H) - int - insert(std::list::const_iterator first, - std::list::const_iterator last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } - #endif // LIST_H - #if defined(VECTOR_H) || defined(__SGI_STL_VECTOR_H) - int - insert(std::vector::const_iterator first, - std::vector::const_iterator last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } - #endif // VECTOR_H - #ifdef ITERATOR_H - int - insert(std::istream_iterator first, - std::istream_iterator last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } - #endif // ITERATOR_H - - int - insert(Point* first, - Point* last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } - #endif //CGAL_CFG_NO_MEMBER_TEMPLATES + } }; @@ -195,9 +139,9 @@ is_valid(bool verbose = false, int level = 0) const for( Finite_faces_iterator it = finite_faces_begin(); it != finite_faces_end() ; it++) { for(int i=0; i<3; i++) { - if ( ! is_infinite( it->opposite_vertex(i))) { + if ( ! is_infinite( it->mirror_vertex(i))) { result = result && ON_POSITIVE_SIDE != - side_of_oriented_circle( it, it->opposite_vertex(i)->point()); + side_of_oriented_circle( it, it->mirror_vertex(i)->point()); } CGAL_triangulation_assertion( result ); } @@ -301,7 +245,7 @@ nearest_vertex_1D(const Point& p) const nn = vit->handle(); do { closer.set_point( 3-min, (++vit)->point()); - if ( ( (min==1)? LARGER : SMALLER ) + if ( ( (min==1)? LARGER : SMALLER ) == closer.compare() ) { min = 3-min; nn=vit->handle(); @@ -510,7 +454,7 @@ fill_hole(Vertex_handle v, std::list & first_hole) typedef std::list Hole; typedef std::list Hole_list; - Face_handle ff, fn; + Face_handle f, ff, fn; int i =0,ii =0, in =0; Hole_list hole_list; Hole hole; @@ -525,16 +469,11 @@ fill_hole(Vertex_handle v, std::list & first_hole) // if the hole has only three edges, create the triangle if (hole.size() == 3) { - Face_handle newf = new Face(); hit = hole.begin(); - for(int j = 0;j<3;j++) { - ff = (*hit).first; - ii = (*hit).second; - hit++; - ff->set_neighbor(ii,newf); - newf->set_neighbor(j,ff); - newf->set_vertex(newf->ccw(j),ff->vertex(ff->cw(ii))); - } + f = (*hit).first; i = (*hit).second; + ff = (* ++hit).first; ii = (*hit).second; + fn = (* ++hit).first; in = (*hit).second; + add_face(f,i,ff,ii,fn,in); continue; } @@ -600,9 +539,10 @@ fill_hole(Vertex_handle v, std::list & first_hole) // create new triangle and update adjacency relations - Face_handle newf = new Face(v0,v1,v2); - newf->set_neighbor(2,ff); - ff->set_neighbor(ii, newf); + // Face_handle newf = new Face(v0,v1,v2); +// newf->set_neighbor(2,ff); +// ff->set_neighbor(ii, newf); + Face_handle newf; //update the hole and push back in the Hole_List stack @@ -613,8 +553,9 @@ fill_hole(Vertex_handle v, std::list & first_hole) fn = (hole.front()).first; in = (hole.front()).second; if (fn->has_vertex(v2, i) && i == fn->ccw(in)) { - newf->set_neighbor(0,fn); - fn->set_neighbor(in,newf); + //newf->set_neighbor(0,fn); + //fn->set_neighbor(in,newf); + newf = add_face(ff,ii,fn,in); hole.pop_front(); hole.push_front(Edge( &(*newf),1)); hole_list.push_front(hole); @@ -623,14 +564,17 @@ fill_hole(Vertex_handle v, std::list & first_hole) fn = (hole.back()).first; in = (hole.back()).second; if (fn->has_vertex(v2, i) && i== fn->cw(in)) { - newf->set_neighbor(1,fn); - fn->set_neighbor(in,newf); + //newf->set_neighbor(1,fn); + //fn->set_neighbor(in,newf); + newf = add_face(fn,in,ff,ii); hole.pop_back(); - hole.push_back(Edge(&(*newf),0)); + //hole.push_back(Edge(&(*newf),0)); + hole.push_back(Edge(&(*newf),1)); hole_list.push_front(hole); } else{ // split the hole in two holes + newf = add_face(ff,ii,v2); Hole new_hole; ++cut_after; while( hole.begin() != cut_after ) diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_2.h index 85b2f0aa59d..c3ae519aebf 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_2.h @@ -261,6 +261,12 @@ protected: void remove_2D(Vertex_handle v); bool test_dim_down(Vertex_handle v); void make_hole ( Vertex_handle v, std::list & hole); + Face_handle add_face(Face_handle f1, int i1, + Face_handle f2, int i2, + Face_handle f3, int i3); + Face_handle add_face(Face_handle f1, int i1, + Face_handle f2, int i2); + Face_handle add_face(Face_handle f, int i, Vertex_handle v); Vertex_handle file_input(std::istream& is); void file_output(std::ostream& os) const; @@ -270,7 +276,6 @@ private: void fill_hole ( Vertex_handle v, std::list & hole); public: -#ifndef CGAL_CFG_NO_MEMBER_TEMPLATES template < class Stream > Stream& draw_triangulation(Stream& os) const { @@ -280,69 +285,17 @@ Stream& draw_triangulation(Stream& os) const } return os; } -#endif - -#ifndef CGAL_CFG_NO_MEMBER_TEMPLATES - template < class InputIterator > - int insert(InputIterator first, InputIterator last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } -#else -#if defined(LIST_H) || defined(__SGI_STL_LIST_H) - int insert(std::list::const_iterator first, - std::list::const_iterator last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } -#endif // LIST_H -#if defined(VECTOR_H) || defined(__SGI_STL_VECTOR_H) - int insert(std::vector::const_iterator first, - std::vector::const_iterator last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } -#endif // VECTOR_H - //#ifdef ITERATOR_H - int insert(std::istream_iterator first, - std::istream_iterator last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } - //#endif // ITERATOR_H - int insert(Point* first, - Point* last) - { - int n = number_of_vertices(); - while(first != last){ - insert(*first); - ++first; - } - return number_of_vertices() - n; - } -#endif // TEMPLATE_MEMBER_FUNCTIONS - +template < class InputIterator > +int insert(InputIterator first, InputIterator last) +{ + int n = number_of_vertices(); + while(first != last){ + insert(*first); + ++first; + } + return number_of_vertices() - n; +} }; @@ -630,10 +583,10 @@ flip(Face_handle& f, int i) CGAL_triangulation_precondition( geom_traits().orientation(f->vertex(i)->point(), f->vertex(cw(i))->point(), - f->opposite_vertex(i)->point()) == RIGHTTURN && + f->mirror_vertex(i)->point()) == RIGHTTURN && geom_traits().orientation(f->vertex(i)->point(), f->vertex(ccw(i))->point(), - f->opposite_vertex(i)->point()) == LEFTTURN); + f->mirror_vertex(i)->point()) == LEFTTURN); _tds.flip( &(*f), i); return; } @@ -710,11 +663,11 @@ insert_outside_convex_hull_1(const Point& p, Face_handle f) CGAL_triangulation_precondition( is_infinite(f) && dimension()==1); CGAL_triangulation_precondition( geom_traits().orientation( - f->opposite_vertex(f->index(infinite_vertex()))->point(), + f->mirror_vertex(f->index(infinite_vertex()))->point(), f->vertex(1- f->index(infinite_vertex()))->point(), p) == COLLINEAR && collinear_between( - f->opposite_vertex(f->index(infinite_vertex()))->point(), + f->mirror_vertex(f->index(infinite_vertex()))->point(), f->vertex(1- f->index(infinite_vertex()))->point(), p) ); Vertex_handle v=static_cast(_tds.insert_in_edge( &(*f), 2)); @@ -1012,74 +965,56 @@ Triangulation_2:: fill_hole ( Vertex_handle v, std::list< Edge > & hole ) { typedef std::list Hole; - - Point p = v->point(); + Face_handle ff, fn; int ii =0, in =0; Vertex_handle v0, v1, v2; - Point p0, p1, p2; Bounded_side side; - Orientation or; - int nhole; + + //stack algorithm to create faces + // create face v0,v1,v2 + //if v0,v1,v2 are finite vertices + // and form a leftturn + // and triangle v0v1v2 does not contain v->point() if( hole.size() != 3) { - // find the first edge v0v1 on the hole boundary - // such that - // v0, v1 and the next vertex v2 are all finite - // v0v1v2 is a left turn and - // triangle v0v1v2 does not contain the removed point - - // if found create face v0v1v2 - // stop when no more faces can be created that way - - nhole= hole.size(); - // nhole decount the number of hole edges passed - // from the last created edges - while (hole.size()>3 && nhole>0) { - //ff = (Face *) ( (hole.front()).first); - ff = hole.front().first; - ii = (hole.front()).second; - hole.pop_front(); - + Hole::iterator hit = hole.begin(); + Hole::iterator next= hit; + while( hit != hole.end() && hole.size() != 3) { + ff = (*hit).first; + ii = (*hit).second; v0 = ff->vertex(cw(ii)); v1 = ff->vertex(ccw(ii)); if( !is_infinite(v0) && !is_infinite(v1)) { - //fn = (Face *) ( (hole.front()).first); - fn = hole.front().first; - in = (hole.front()).second; - - v2 = fn->vertex(ccw(in)); - if( !is_infinite(v2)) { - p0 = v0->point(); - p1 = v1->point(); - p2 = v2->point(); - or = geom_traits().orientation(p0,p1,p2); - if ( or == LEFTTURN) { - side = bounded_side(p0,p1,p2, p); - if( side == ON_UNBOUNDED_SIDE || - (side == ON_BOUNDARY && collinear_between(p0, p, p2)) ) { - //create face - Face_handle newf = new Face(v0,v1,v2); - newf->set_neighbor(2,ff); - newf->set_neighbor(0,fn); - ff->set_neighbor(ii, newf); - fn->set_neighbor(in,newf); - hole.pop_front(); - //hole.push_front(Hole_neighbor(&(*newf),1)); - hole.push_front(Edge(newf,1)); - nhole = hole.size(); - continue; - } + next=hit; next++; + if(next == hole.end()) next=hole.begin(); + fn = (*next).first; + in = (*next).second; + v2 = fn->vertex(ccw(in)); + if ( !is_infinite(v2) && + geom_traits().orientation(v0->point(), v1->point(), v2->point()) + == LEFTTURN ) { + side = bounded_side(v0->point(), v1->point(), v2->point(), + v->point()); + if( side == ON_UNBOUNDED_SIDE || + (side == ON_BOUNDARY && collinear_between(v0->point(), + v->point(), + v2->point()) )) { + //create face + Face_handle newf = add_face(ff,ii,fn,in); + Hole::iterator tempo=hit; + hit = hole.insert(hit,Edge(newf,1)); //push newf + hole.erase(tempo); //erase ff + hole.erase(next); //erase fn + if (hit != hole.begin() ) --hit; + continue; } } } - - // not possible to create face v0,v1,v2; - //hole.push_back(Hole_neighbor(&(*ff),ii)); - hole.push_back( Edge (ff,ii)); - nhole--; - } + ++hit; + } } + // either the hole has only three edges // or all its finite vertices are reflex or flat // except may be one vertex whose corresponding ear @@ -1087,43 +1022,26 @@ fill_hole ( Vertex_handle v, std::list< Edge > & hole ) // deal with the last leftturn if any if(hole.size() != 3) { - nhole = hole.size(); - while ( nhole>0) { - //ff = (Face *) ((hole.front()).first); - ff = ((hole.front()).first); - ii = (hole.front()).second; - hole.push_back(hole.front()); - hole.pop_front(); - nhole--; - - v0 = ff->vertex(cw(ii)); - v1 = ff->vertex(ccw(ii)); - if(is_infinite(v0) || is_infinite(v1)) continue; - - //fn = (Face *) ((hole.front()).first); - fn = ((hole.front()).first); - in = (hole.front()).second; - v2 = fn->vertex(ccw(in)); - if( is_infinite(v2) ) continue; - p0 = v0->point(); - p1 = v1->point(); - p2 = v2->point(); - Orientation or = geom_traits().orientation(p0,p1,p2); - if ( or == LEFTTURN) { - Face_handle newf = new Face(v0,v1,v2); - newf->set_neighbor(2,ff); - newf->set_neighbor(0,fn); - ff->set_neighbor(ii, newf); - fn->set_neighbor(in,newf); - hole.pop_back(); - hole.pop_front(); - hole.push_front(Edge(newf,1)); - break; - } + Hole::iterator hit=hole.begin(); + while(hit != hole.end()) { + ff = (*hit).first; ii = (*hit).second; + hit++; + if(hit != hole.end()) { fn = (*hit).first; in = (*hit).second;} + else { fn = ((hole.front()).first); in = (hole.front()).second;} + if ( !is_infinite(ff->vertex(cw(ii))) && + !is_infinite(fn->vertex(cw(in))) && + !is_infinite(fn->vertex(ccw(in))) && + geom_traits().orientation(ff->vertex(cw(ii))->point(), + fn->vertex(cw(in))->point(), + fn->vertex(ccw(in))->point()) + == LEFTTURN) { + add_face(ff,ii,fn,in); + break; + } } } - + // deal with a reflex chain of convex hull edges if(hole.size() != 3) { // look for infinite vertex ff = (hole.front()).first; @@ -1131,49 +1049,65 @@ fill_hole ( Vertex_handle v, std::list< Edge > & hole ) while ( ! is_infinite(ff->vertex(cw(ii)))){ hole.push_back(hole.front()); hole.pop_front(); - //ff = (Face *)((hole.front()).first); ff = (hole.front()).first; ii = (hole.front()).second; } //create faces while(hole.size() != 3){ - //ff = (Face *)((hole.front()).first); ff = (hole.front()).first; - //ff = ((hole.front()).first)->handle(); ii = (hole.front()).second; hole.pop_front(); - //fn = (Face *)((hole.front()).first); fn = (hole.front()).first; - //fn = ((hole.front()).first)->handle(); in = (hole.front()).second; hole.pop_front(); - Face_handle newf = new Face(infinite_vertex(),fn->vertex(cw(in)), - fn->vertex(ccw(in))); - ff->set_neighbor(ii,newf); - fn->set_neighbor(in,newf); - newf->set_neighbor(0,fn); - newf->set_neighbor(2,ff); - //hole.push_front(Hole_neighbor(&(*newf),1)); + Face_handle newf = add_face(ff,ii,fn,in); hole.push_front(Edge(newf,1)); } } // now hole has three edges Hole::iterator hit; - Face_handle newf = new Face(); hit = hole.begin(); - for(int j = 0;j<3;j++) { - //ff = (Face *)((*hit).first); - ff = (*hit).first; - //ff = ((*hit).first)->handle(); - ii = (*hit).second; - hit++; - ff->set_neighbor(ii,newf); - newf->set_neighbor(j,ff); - newf->set_vertex(newf->ccw(j),ff->vertex(ff->cw(ii))); - } + // I don't know why the following yelds a segmentation fault + // add_face( (*hit).first, (*hit).second, + // (* ++hit).first, (*hit).second, + // (* ++hit).first, (*hit).second); + ff = (*hit).first; ii = (*hit).second; + fn = (* ++hit).first; in = (*hit).second; + Face_handle f3 = (* ++hit).first; + int i3 = (*hit).second; + add_face(ff,ii,fn,in,f3,i3); } +template +inline +Triangulation_2::Face_handle +Triangulation_2:: +add_face(Face_handle f1, int i1, + Face_handle f2, int i2, + Face_handle f3, int i3) +{ + return static_cast(_tds.add_face(&(*f1),i1, &(*f2),i2, &(*f3),i3)); +} + +template +inline +Triangulation_2::Face_handle +Triangulation_2:: +add_face(Face_handle f1, int i1, + Face_handle f2, int i2) +{ + return static_cast(_tds.add_face(&(*f1),i1, &(*f2),i2)); +} + +template +inline +Triangulation_2::Face_handle +Triangulation_2:: +add_face(Face_handle f, int i, Vertex_handle v) +{ + return static_cast(_tds.add_face(&(*f),i, &(*v))); +} // POINT LOCATION diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h index c19352194af..59d1b02b6c5 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_default_data_structure_2.h @@ -135,6 +135,10 @@ public: void remove_first(Vertex* v); void remove_dim_down(Vertex* v); + Face* add_face(Face* f1, int i1, Face* f2, int i2, Face* f3, int i3); + Face* add_face(Face* f1, int i1, Face* f2, int i2); + Face* add_face(Face* f1, int i1, Vertex* v); + // CHECKING bool is_valid(bool verbose = false, int level = 0) const; @@ -726,6 +730,46 @@ remove_first(Vertex* v) return; } +template < class Gt , class Vb, class Fb> +Triangulation_default_data_structure_2::Face* +Triangulation_default_data_structure_2:: +add_face(Face* f1, int i1, Face* f2, int i2, Face* f3, int i3) +{ + Face* newf = new Face(f1->vertex(cw(i1)), + f2->vertex(cw(i2)), + f3->vertex(cw(i3)), + f2, f3, f1); + f1->set_neighbor(i1,newf); + f2->set_neighbor(i2,newf); + f3->set_neighbor(i3,newf); + return newf; +} + +template < class Gt , class Vb, class Fb> +Triangulation_default_data_structure_2::Face* +Triangulation_default_data_structure_2:: +add_face(Face* f1, int i1, Face* f2, int i2) +{ + Face* newf = new Face(f1->vertex(cw(i1)), + f2->vertex(cw(i2)), + f2->vertex(ccw(i2)), + f2, NULL, f1); + f1->set_neighbor(i1,newf); + f2->set_neighbor(i2,newf); + return newf; +} + +template < class Gt , class Vb, class Fb> +Triangulation_default_data_structure_2::Face* +Triangulation_default_data_structure_2:: +add_face(Face* f1, int i1, Vertex* v) +{ +Face* newf = new Face(f1->vertex(cw(i1)), f1->vertex(ccw(i1)),v, + NULL, NULL, f1); + f1->set_neighbor(i1,newf); + return newf; +} + // CHECKING template < class Gt , class Vb, class Fb> bool @@ -1093,7 +1137,7 @@ file_input( std::istream& is, bool skip_first) // Creation of the faces int index; - for(int i = 0; i < m; ++i) { + for(i = 0; i < m; ++i) { F[i] = new Face() ; for(int j = 0; j < dimension()+1; ++j){ is >> index; @@ -1105,7 +1149,7 @@ file_input( std::istream& is, bool skip_first) } // Setting the neighbor pointers - for(int i = 0; i < m; ++i) { + for(i = 0; i < m; ++i) { for(int j = 0; j < dimension()+1; ++j){ is >> index; F[i]->set_neighbor(j, F[index]); diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_circulators_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_circulators_2.h index c85d09fa95b..25e4eb33b58 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_circulators_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_circulators_2.h @@ -142,7 +142,7 @@ public: bool is_empty() const; bool operator==(CGAL_NULL_TYPE n) const; bool operator!=(CGAL_NULL_TYPE n) const; -}; + }; template < class Vertex, class Face > diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h index 9f6e2d5682a..50d8360afc5 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_ds_face_2.h @@ -67,7 +67,7 @@ public: //Vertex Access Member Functions Vertex* vertex(int i) const; - Vertex* opposite_vertex(int i) const; + Vertex* mirror_vertex(int i) const; bool has_vertex(const Vertex* v) const; bool has_vertex(const Vertex* v, int& i) const; int index(const Vertex* v) const; @@ -77,7 +77,7 @@ public: bool has_neighbor(const Face* n) const; bool has_neighbor(const Face* n, int& i) const; int index(const Face* n) const; - int opposite_index(int i) const; + int mirror_index(int i) const; //Miscelleanous bool is_valid(bool verbose = false, int level = 0) const; @@ -133,7 +133,7 @@ template < class Vb, class Fb > inline Triangulation_ds_vertex_2 * Triangulation_ds_face_2:: -opposite_vertex(int i) const +mirror_vertex(int i) const { CGAL_triangulation_precondition ( neighbor(i) != NULL); return neighbor(i)->vertex(neighbor(i)->index(this)); @@ -142,7 +142,7 @@ opposite_vertex(int i) const template < class Vb, class Fb > inline int Triangulation_ds_face_2:: -opposite_index(int i) const +mirror_index(int i) const { CGAL_triangulation_precondition (neighbor(i) != NULL); return neighbor(i)->index(this); diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_2.h index a03b145ee56..1cd7779d535 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_euclidean_traits_2.h @@ -34,7 +34,7 @@ #include #include -#include +//#include #include CGAL_BEGIN_NAMESPACE diff --git a/Packages/Triangulation_2/include/CGAL/Triangulation_face_2.h b/Packages/Triangulation_2/include/CGAL/Triangulation_face_2.h index 9aae421dcb9..dd435bf1e25 100644 --- a/Packages/Triangulation_2/include/CGAL/Triangulation_face_2.h +++ b/Packages/Triangulation_2/include/CGAL/Triangulation_face_2.h @@ -80,7 +80,7 @@ public: // Vertex access functions Vertex_handle vertex(int i) const; - Vertex_handle opposite_vertex(int i) const; + Vertex_handle mirror_vertex(int i) const; bool has_vertex(const Vertex_handle& v) const; bool has_vertex(const Vertex_handle& v, int& i) const; int index(const Vertex_handle& v) const; @@ -90,7 +90,7 @@ public: int index(const Face_handle& f) const; bool has_neighbor(const Face_handle& f) const; bool has_neighbor(const Face_handle& f, int &i) const; - int opposite_index(int i) const; + int mirror_index(int i) const; Face_handle handle() const; //Setting @@ -120,9 +120,9 @@ template < class Gt, class Tds > inline Triangulation_vertex_handle_2 Triangulation_face_2:: -opposite_vertex(int i) const +mirror_vertex(int i) const { - return ((Vertex *)(Fa::opposite_vertex(i))); + return ((Vertex *)(Fa::mirror_vertex(i))); } template < class Gt, class Tds > @@ -193,9 +193,9 @@ template < class Gt, class Tds > inline int Triangulation_face_2:: -opposite_index(int i) const +mirror_index(int i) const { - return Fa::opposite_index(i); + return Fa::mirror_index(i); } template < class Gt, class Tds > diff --git a/Packages/Triangulation_2/test/Triangulation_2/Makefile b/Packages/Triangulation_2/test/Triangulation_2/Makefile index 87f75d665d9..9861345510e 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/Makefile +++ b/Packages/Triangulation_2/test/Triangulation_2/Makefile @@ -6,8 +6,8 @@ -#CGAL_MAKEFILE = /u/alcor/0/prisme_util/CGAL/CGAL-I/make/makefile_i686_Linux-2.2.7_eg++-egcs-2.91.66_LEDA -CGAL_MAKEFILE = /u/alcor/0/prisme_util/CGAL/CGAL-2.1-I-11/make/makefile_i686_Linux-2.2.7_g++-2.95._LEDA/ +#CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-I/make/makefile_i686_Linux-2.2.7_eg++-egcs-2.91.66_LEDA +CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-I/make/makefile_i686_Linux-2.2.7_g++-2.95._LEDA/ include $(CGAL_MAKEFILE) @@ -20,16 +20,7 @@ CXXFLAGS = \ -I./include \ $(TESTSUITE_CXXFLAGS) \ $(CGAL_CXXFLAGS)\ - -DCGAL_NO_PRECONDITIONS -DCGAL_NO_ASSERTIONS -DCGAL_NO_POSTCONDITIONS -# -O -# -g -# -B$(UTIL)/Binutils/SunOS/bin/ -# $(LONG_NAME_PROBLEM_CXXFLAGS) -# -g \ -# -B$(UTIL)/Binutils/SunOS/bin/ -# -DCGAL_NO_PRECONDITIONS -DCGAL_NO_ASSERTIONS -DCGAL_NO_POSTCONDITIONS -# -fhonor-std -# -I /u/rigel/0/prisme/spion/prog/Cgal/Triangulation/include \ + -g #---------------------------------------------------------------------# diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_2.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_2.C index 2dd68fc4731..d78a29e0090 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_2.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_2.C @@ -65,40 +65,6 @@ _test_cls_tds_2( const Tds &, const Gt &) tds1.is_valid(); // (), = and swap to be tested later again with non trivial tds -// // Setting functions - access functions -// std::cout << " setting functions access functions" << std::endl; -// assert(tds1.dimension() == -1); -// assert(tds1.number_of_vertices() == 0 ); - -// tds1.set_number_of_vertices(1); -// assert( tds1.number_of_vertices() == 1 ); -// tds1.set_dimension(0); -// assert(tds1.dimension() == 0); - -// Vertex* vt1 = new Vertex; -// Face* f1 = new Face(vt1,NULL,NULL); -// Vertex *vt2 = new Vertex; -// Face *f2 = new Face(vt2,NULL,NULL); -// vt2->set_face(f2); -// tds1.set_infinite_vertex(vt2); - -// // Finite and infinite vertices and faces -// std::cout << " finite/infinite faces and vertices" << std::endl; -// assert( !tds1.is_infinite(vt1) ); -// assert( tds1.is_infinite(vt2) ); -// assert( !tds1.is_infinite(f1) ); -// assert( tds1.is_infinite(f2) ); -// assert( tds1.is_infinite(f2,1) ); - -// //assert( tds1.infinite_face() == f2 ); -// assert( tds1.infinite_vertex() == vt2 ); -// //assert( tds1.finite_vertex() == vt1 ); - - // make tds1 valid in order to allow clear() to work -// tds1.set_number_of_vertices(0); -// tds1.set_dimension(-1); - // tds1.set_infinite_vertex(NULL); - // assert( tds1.is_valid() ); // misc. diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_face.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_face.C index 6b0c24b23c4..658ca714bd9 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_face.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_tds_face.C @@ -133,15 +133,15 @@ _test_cls_tds_face( const Face &, const Gt & ) assert( f4.neighbor(1) == &f2 ); assert( f4.neighbor(2) == &f3 ); - //Test opposite_vertex() opposite_index() - assert( f4.opposite_vertex(0) == &v4); - assert( f1.opposite_vertex(0) == &v1); - assert( f2.opposite_vertex(1) == &v2); - assert( f3.opposite_vertex(2) == &v3); - assert( f4.opposite_index(0) == 0); - assert( f1.opposite_index(0) == 0); - assert( f2.opposite_index(1) == 1); - assert( f3.opposite_index(2) == 2); + //Test mirror_vertex() mirror_index() + assert( f4.mirror_vertex(0) == &v4); + assert( f1.mirror_vertex(0) == &v1); + assert( f2.mirror_vertex(1) == &v2); + assert( f3.mirror_vertex(2) == &v3); + assert( f4.mirror_index(0) == 0); + assert( f1.mirror_index(0) == 0); + assert( f2.mirror_index(1) == 1); + assert( f3.mirror_index(2) == 2); // Test is_valid assert( f4.is_valid() ); @@ -173,10 +173,10 @@ _test_cls_tds_face( const Face &, const Gt & ) assert (h1.dimension() == 0); assert (h1.is_valid()); - assert(g1.opposite_vertex(0) == &v1); - assert(g1.opposite_vertex(1) == &v1); - assert(g1.opposite_index(0) == 1); - assert(g1.opposite_index(1) == 0); + assert(g1.mirror_vertex(0) == &v1); + assert(g1.mirror_vertex(1) == &v1); + assert(g1.mirror_index(0) == 1); + assert(g1.mirror_index(1) == 0); return; } diff --git a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C index 4c45ba1254a..e815c94c913 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C +++ b/Packages/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_triangulation_2.C @@ -712,13 +712,13 @@ _test_cls_triangulation_2( const Triangulation & ) assert( T2_1.number_of_vertices() == 0 ); T2_3.remove(v2_3_0); assert(T2_3.is_valid()); - T2_3.remove(v2_3_1); - T2_3.remove(v2_3_9); - T2_3.remove(v2_3_8); - T2_3.remove(v2_3_5); - T2_3.remove(v2_3_3); - T2_3.remove(v2_3_4); - T2_3.remove(v2_3_2); + T2_3.remove(v2_3_1); assert(T2_3.is_valid()); + T2_3.remove(v2_3_9); assert(T2_3.is_valid()); + T2_3.remove(v2_3_8); assert(T2_3.is_valid()); + T2_3.remove(v2_3_5); assert(T2_3.is_valid()); + T2_3.remove(v2_3_3); assert(T2_3.is_valid()); + T2_3.remove(v2_3_4); assert(T2_3.is_valid()); + T2_3.remove(v2_3_2); assert(T2_3.is_valid()); T2_3.remove(v2_3_6); assert(T2_3.is_valid()); T2_3.remove(v2_3_7); assert(T2_3.is_valid()); T2_3.remove(v2_3_10); assert(T2_3.is_valid()); diff --git a/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C b/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C index 71087d9400d..27ca5ff1de0 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C +++ b/Packages/Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2.C @@ -35,31 +35,31 @@ int main() { - std::cout << "Testing Delaunay Triangulation_2 "; - std::cout << " with Euclidean cartesian points : " << endl; +// std::cout << "Testing Delaunay Triangulation_2 "; +// std::cout << " with Euclidean cartesian points : " << endl; - // typedef double coord_type; -// typedef CGAL::Cartesian Rep; -// typedef CGAL::Triangulation_euclidean_traits_2 Gt1; - typedef CGAL::Triangulation_euclidean_traits_2 Gt1; - typedef CGAL::Triangulation_vertex_base_2 Vb1; - typedef CGAL::Triangulation_face_base_2 Fb1; - typedef CGAL::Triangulation_default_data_structure_2 Tds1; - typedef CGAL::Delaunay_triangulation_2 Cls1; +// // typedef double coord_type; +// // typedef CGAL::Cartesian Rep; +// // typedef CGAL::Triangulation_euclidean_traits_2 Gt1; +// typedef CGAL::Triangulation_euclidean_traits_2 Gt1; +// typedef CGAL::Triangulation_vertex_base_2 Vb1; +// typedef CGAL::Triangulation_face_base_2 Fb1; +// typedef CGAL::Triangulation_default_data_structure_2 Tds1; +// typedef CGAL::Delaunay_triangulation_2 Cls1; - _test_cls_delaunay_triangulation_2( Cls1() ); +// _test_cls_delaunay_triangulation_2( Cls1() ); - std::cout << "Testing Delaunay Triangulation_2 "; - std::cout << " with Euclidean homogeneous points : " << endl; +// std::cout << "Testing Delaunay Triangulation_2 "; +// std::cout << " with Euclidean homogeneous points : " << endl; - typedef CGAL::Triangulation_euclidean_traits_2 Gt2; - typedef CGAL::Triangulation_vertex_base_2 Vb2; - typedef CGAL::Triangulation_face_base_2 Fb2; - typedef CGAL::Triangulation_default_data_structure_2 Tds2; - typedef CGAL::Delaunay_triangulation_2 Cls2; +// typedef CGAL::Triangulation_euclidean_traits_2 Gt2; +// typedef CGAL::Triangulation_vertex_base_2 Vb2; +// typedef CGAL::Triangulation_face_base_2 Fb2; +// typedef CGAL::Triangulation_default_data_structure_2 Tds2; +// typedef CGAL::Delaunay_triangulation_2 Cls2; - _test_cls_delaunay_triangulation_2( Cls2() ); +// _test_cls_delaunay_triangulation_2( Cls2() ); std::cout << "Testing Delaunay Triangulation_2 "; diff --git a/Packages/Triangulation_2/test/Triangulation_2/test_triangulation_2.C b/Packages/Triangulation_2/test/Triangulation_2/test_triangulation_2.C index f650bcd23aa..e016d5d7d3f 100644 --- a/Packages/Triangulation_2/test/Triangulation_2/test_triangulation_2.C +++ b/Packages/Triangulation_2/test/Triangulation_2/test_triangulation_2.C @@ -38,7 +38,7 @@ int main() { - std::cout << "Testing Triangulation_2 " << std::endl; + // std::cout << "Testing Triangulation_2 " << std::endl; std::cout << " with Euclidean_traits_2 : " << std::endl ; typedef CGAL::Triangulation_euclidean_traits_2 Gt1; typedef CGAL::Triangulation_vertex_base_2 Vb1;