From e31456f5630e2d737b2e31e3e920d0b1dd2100c2 Mon Sep 17 00:00:00 2001 From: Mariette Yvinec Date: Thu, 2 Jul 1998 15:17:34 +0000 Subject: [PATCH] compiles and run on papillon --- .../Constrained_triangulation_face_base_2.h | 16 +++-- .../CGAL/Constrained_triangulation_sweep_2.h | 67 +++++++++++-------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h b/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h index 23c1007b3d3..d7f767159eb 100644 --- a/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h +++ b/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_face_base_2.h @@ -7,7 +7,7 @@ template class CGAL_Constrained_triangulation_face_base_2 - : public CGAL_triangulation_face_base_2 + : public CGAL_Triangulation_face_base_2 { protected: bool C[3]; @@ -29,7 +29,7 @@ public: set_constrained(false,false,false); } - CGAL_Constrained_triangulation_face_base_2(void* v0, void* v1, void* v2 + CGAL_Constrained_triangulation_face_base_2(void* v0, void* v1, void* v2, void* n0, void* n1, void* n2) : Fb(v0,v1,v2,n0,n1,n2) { @@ -37,8 +37,8 @@ public: } - CGAL_Constrained_triangulation_face_base_2(void* v0, void* v1, void* v2 - void* n0, void* n1, void* n2 + CGAL_Constrained_triangulation_face_base_2(void* v0, void* v1, void* v2, + void* n0, void* n1, void* n2, bool c0, bool c1, bool c2 ) : Fb(v0,v1,v2,n0,n1,n2) { @@ -68,9 +68,13 @@ public: bool result = Fb::is_valid(); CGAL_triangulation_assertion(result); for(int i = 0; i < 3; i++) { - Face_handle n = neighbor(i); + Constrained_face_base* n = (Constrained_face_base*)neighbor(i); if(n != NULL){ - int ni = n->index(handle()); + // The following seems natural, but it may fail if the faces + // this and n are neighbors on two edges (1-dim triangulation, + // with infinite faces + // int ni = n->index(this);// + int ni = cw(n->vertex_index(vertex(cw(i)))); result = result && ( is_constrained(i) == n->is_constrained(ni)); } } diff --git a/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_sweep_2.h b/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_sweep_2.h index 6de5989b133..9daf585c95f 100644 --- a/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_sweep_2.h +++ b/Packages/Triangulation_2/include/CGAL/Constrained_triangulation_sweep_2.h @@ -8,23 +8,34 @@ #include #include -#include +#include + + +//template +//class CGAL_Constrained_triangulation_2.h>; template < class Gt, class Tds> -class CGAL_Constrained_triangulation_sweep +class CGAL_Constrained_triangulation_sweep_2 { public: typedef Gt Geom_traits; typedef typename Gt::Point Point; typedef typename Gt::Segment Segment; - typedef CGAL_Triangulation_2 Triangulation; - typedef CGAL_Constrained_Triangulation_2 Constrained_triangulation; - typedef Triangulation::Vertex Vertex; - typedef Triangulation::Face Face; - typedef Triangulation::Vertex_handle Vertex_handle; - typedef Triangulation::Face_handle Face_handle; +// typedef CGAL_Constrained_triangulation_2 Constrained_triangulation; +// typedef Constrained_triangulation::Vertex Vertex; +// typedef typename Constrained_triangulation::Face Face; +// typedef typename Constrained_triangulation::Vertex_handle Vertex_handle; +// typedef typename Constrained_triangulation::Face_handle Face_handle; + + typedef CGAL_Triangulation_face_2 Face; + typedef CGAL_Triangulation_vertex_2 Vertex; + typedef CGAL_Triangulation_face_handle_2 Face_handle; + typedef CGAL_Triangulation_vertex_handle_2 Vertex_handle; + typedef pair Edge; + + typedef pair Constraint; class Neighbor_list; @@ -124,19 +135,19 @@ public: public: bool is_removable(Face_handle fh) { - return ( fh->vertex(1) == fh->vertex(2) && - fh->neighbor(1)!= NULL && neighbor(2)!= NULL); + return ( (*fh).vertex(1) == (*fh).vertex(2) && + (*fh).neighbor(1)!= NULL && (*fh).neighbor(2)!= NULL); } void remove_flat(Face_handle fh) // must be followed by a Delete() in calling code { - assert(fh->vertex(1) == fh->vertex(2)); - Face_handle f2= fh->neighbor(2); - Face_handle f1= fh->neighbor(1); - if ( f2 != NULL) { f2->set_neighbor( f2->index(fh), f1);} - if ( f1 != NULL) { f1->set_neighbor( f1->index(fh), f2);} - (vertex(0))->set_face( f2 != NULL ? f2 : f1 ); + assert((*fh).vertex(1) == (*fh).vertex(2)); + Face_handle f2= (*fh).neighbor(2); + Face_handle f1= (*fh).neighbor(1); + if ( f2 != NULL) { (*f2).set_neighbor( (*f2).index(fh), f1);} + if ( f1 != NULL) { (*f1).set_neighbor( (*f1).index(fh), f2);} + ( (*fh). vertex(0))->set_face( f2 != NULL ? f2 : f1 ); fh.Delete(); return; } @@ -236,13 +247,13 @@ public: void set_right_most(Vertex_handle v) { rm=v;} }; - CGAL_Constrained_triangulation_sweep( Gt& t = Gt()) + CGAL_Constrained_triangulation_sweep_2( const Gt& t = Gt()) : _t(t), _lc(NULL) { } - CGAL_Constrained_triangulation_sweep( list& lc, - Gt& t = Gt()) + CGAL_Constrained_triangulation_sweep_2( list& lc, + const Gt& t = Gt()) : _t(t), _lc(&lc) { event_less= Event_less(_t); @@ -289,7 +300,7 @@ public: template void -CGAL_Constrained_triangulation_sweep:: +CGAL_Constrained_triangulation_sweep_2:: make_event_queue() { if ( ! queue.empty()) {return;} // queue already done @@ -335,7 +346,7 @@ make_event_queue() template void -CGAL_Constrained_triangulation_sweep:: +CGAL_Constrained_triangulation_sweep_2:: build_triangulation() { Point p; @@ -370,8 +381,8 @@ build_triangulation() } template -CGAL_Constrained_triangulation_sweep::Vertex_handle -CGAL_Constrained_triangulation_sweep:: +CGAL_Constrained_triangulation_sweep_2::Vertex_handle +CGAL_Constrained_triangulation_sweep_2:: treat_in_edges(const Event_queue::iterator & event, Sweep_status::iterator & loc) { @@ -464,7 +475,7 @@ treat_in_edges(const Event_queue::iterator & event, template void -CGAL_Constrained_triangulation_sweep:: +CGAL_Constrained_triangulation_sweep_2:: treat_out_edges(const Event_queue::iterator & event, Sweep_status::iterator & loc) { @@ -522,8 +533,8 @@ treat_out_edges(const Event_queue::iterator & event, } template -CGAL_Constrained_triangulation_sweep::Vertex_handle -CGAL_Constrained_triangulation_sweep:: +CGAL_Constrained_triangulation_sweep_2::Vertex_handle +CGAL_Constrained_triangulation_sweep_2:: set_infinite_faces() { Vertex_handle infinite= (new Vertex)->handle(); @@ -561,7 +572,7 @@ set_infinite_faces() fn->set_neighbor(in,newf); newf->set_neighbor(0,fn); last->set_neighbor(2,newf);newf->set_neighbor(1,last); newf->set_constrained(0, fn->is_constrained(in)); - if (lower_list->is_removable(fn)) { lower_list->remove_flat(fn) } + if (lower_list->is_removable(fn)) { lower_list->remove_flat(fn); } (newf->vertex(2))->set_face(newf->neighbor(0)); last=newf; } @@ -574,7 +585,7 @@ set_infinite_faces() template bool -CGAL_Constrained_triangulation_sweep:: +CGAL_Constrained_triangulation_sweep_2:: do_intersect(const Constraint& c1, const Constraint& c2 ) { // The constraints are known to be non degenerate