diff --git a/Surface_mesher/changes.txt b/Surface_mesher/changes.txt index 673f665e77f..f03fba0f4db 100644 --- a/Surface_mesher/changes.txt +++ b/Surface_mesher/changes.txt @@ -1,10 +1,11 @@ -changes in Complex_2_in_triangulatio_3 : +8 March 2006 Mariette +changes in Complex_2_in_triangulation_3 : remove set_in_complex and remove_from_complex for vertices change set_in_complex and remove_from_complex for facets - + add iterators on complex faces 8 March 2006 Mariette -changes in Complex_2_in_triangulatio_3 : +changes in Complex_2_in_triangulation_3 : fixed operator Not_in_complex changed face_type into face_status changed is_in_complex diff --git a/Surface_mesher/doc_tex/Surface_mesher_ref/SurfaceMeshComplex_2InTriangulation_3.tex b/Surface_mesher/doc_tex/Surface_mesher_ref/SurfaceMeshComplex_2InTriangulation_3.tex index 10e41864f69..7ecb5423ed0 100644 --- a/Surface_mesher/doc_tex/Surface_mesher_ref/SurfaceMeshComplex_2InTriangulation_3.tex +++ b/Surface_mesher/doc_tex/Surface_mesher_ref/SurfaceMeshComplex_2InTriangulation_3.tex @@ -113,9 +113,9 @@ vertices of the 2D complex.} \ccNestedType{Boundary_edges_iterator}{An iterator type to visit the boundary edges of the 2D complex.} -\ccGlue -\ccNestedType{Boundary_vertices_iterator}{An iterator type to visit the -boundary vertices of the 2D complex.} +%\ccGlue +%\ccNestedType{Boundary_vertices_iterator}{An iterator type to visit the +%boundary vertices of the 2D complex.} %\ccNestedType{Facet_circulator}{An iterator type to visit the facets %of the 2D complex around a boundary or regular vertex.} %\ccGlue @@ -327,41 +327,41 @@ vertices of the 2D complex.} \ccGlue \ccMethod{Vertex_iterator vertices_end();} {Returns the past the end iterator for the above iterator.} -\ccGlue -\ccMethod{Boundary_vertices_iterator - boundary_vertices_begin();} -{Returns an iterator with value type \ccc{Vertex_handle} to visit the -vertices of the 2D complex that are boundary vertices.} -\ccGlue -\ccMethod{Boundary_vertices_iterator - boundary_vertices_end();} -{Returns the past the end iterator for the above iterator.} +%\ccGlue +%\ccMethod{Boundary_vertices_iterator +% boundary_vertices_begin();} +%{Returns an iterator with value type \ccc{Vertex_handle} to visit the +%vertices of the 2D complex that are boundary vertices.} +%\ccGlue +%\ccMethod{Boundary_vertices_iterator +% boundary_vertices_end();} +%{Returns the past the end iterator for the above iterator.} -\ccHeading{Traversal of incident facets} -The data structure also provides member functions to retrieve -the facets of the complex incident to a given face (vertex or edge). +%\ccHeading{Traversal of incident facets} +%The data structure also provides member functions to retrieve +%the facets of the complex incident to a given face (vertex or edge). -\ccMethod{template - OutputIterator - incident_facets(Vertex_handle v, OutputIterator facets);} - {To retrieve the facets of the complex incident to \ccc{v}.} -\ccGlue -\ccMethod{template - OutputIterator - incident_facets(Vertex_handle va, Vertex_handle vb);} - {To retrieve the facets of the complex incident to edge \ccc{v_i, v_j}.} -\ccGlue -\ccMethod{template - OutputIterator - incident_facets(Cell_handle c, int i, int j);} - {To retrieve the facets of the complex incident to edge \ccc{ -(c,i,i)}.} -\ccGlue -\ccMethod{template - OutputIterator - incident_facets(Edge e);} - {To retrieve the facets of the complex incident to edge \ccc{e}.} +%\ccMethod{template +% OutputIterator +% incident_facets(Vertex_handle v, OutputIterator facets);} +% {To retrieve the facets of the complex incident to \ccc{v}.} +%\ccGlue +%\ccMethod{template +% OutputIterator +% incident_facets(Vertex_handle va, Vertex_handle vb);} +% {To retrieve the facets of the complex incident to edge \ccc{v_i, v_j}.} +%\ccGlue +%\ccMethod{template +% OutputIterator +% incident_facets(Cell_handle c, int i, int j);} +% {To retrieve the facets of the complex incident to edge \ccc{ +%(c,i,i)}.} +%\ccGlue +%\ccMethod{template +% OutputIterator +% incident_facets(Edge e);} +% {To retrieve the facets of the complex incident to edge \ccc{e}.} %\ccMethod{Facet_circulator diff --git a/Surface_mesher/include/CGAL/Complex_2_in_triangulation_3.h b/Surface_mesher/include/CGAL/Complex_2_in_triangulation_3.h index 5308848a1cd..a17933ec596 100644 --- a/Surface_mesher/include/CGAL/Complex_2_in_triangulation_3.h +++ b/Surface_mesher/include/CGAL/Complex_2_in_triangulation_3.h @@ -41,23 +41,16 @@ class Complex_2_in_triangulation_3 { typedef Tr Triangulation_3; typedef typename Triangulation_3::Vertex_handle Vertex_handle; - typedef typename Triangulation_3::Cell_handle Cell_handle; - typedef typename Triangulation_3::Facet Facet; - typedef typename Triangulation_3::Edge Edge; typedef std::list Facets; + typedef std::list Cells; + typedef typename Facets::iterator Facet_list_iterator; typedef std::size_t size_type; - typedef std::list Cells; - - typedef typename Facets::iterator Facets_iterator; - - typedef typename Cells::iterator Cells_iterator; - typedef Const_circulator_from_container Facet_circulator; typedef std::map , @@ -69,23 +62,38 @@ class Complex_2_in_triangulation_3 { struct Not_in_complex { - bool operator()(const Facet& f) const - { - //assert(f.first < f.first->neighbor(f.second)); - return ! f.first->is_facet_on_surface(f.second) ; + bool operator()(const Facet& f) const { + return ! f.first->is_facet_on_surface(f.second) ; + } + + bool operator()(const Edge& e) const { + return face_status(e)== NOT_IN_COMPLEX; } - bool operator()(Vertex_handle v) const - { - //return ! v->is_visited(); + bool operator()(Vertex_handle v) const { return ! v->is_in_complex(); } }; + struct Not_on_boundary_tester { + bool operator()(const Edge& e) const { + return face_status(e)!= BOUNDARY; + } + }; + + typedef typename Filter_iterator Facet_iterator; + typedef typename Filter_iterator Edge_iterator; + typedef typename Filter_iterator Vertex_iterator; + + typedef typename Filter_iterator Boundary_edges_iterator; protected: Triangulation_3& tr; @@ -319,13 +327,13 @@ size_type number_of_facets() const Facets lof = typename Facets::list(); - for (Facets_iterator it = lof1.begin(); + for (Facet_list_iterator it = lof1.begin(); it != lof1.end(); it++) { lof.push_back(*it); } - for (Facets_iterator it = lof2.begin(); + for (Facet_list_iterator it = lof2.begin(); it != lof2.end(); it++) { lof.push_back(*it); @@ -502,6 +510,49 @@ size_type number_of_facets() const } } } + + Facet_iterator facets_begin(){ + return filter_iterator(triangulation().finite_facets_begin(), + Not_in_complex()); + } + + Facet_iterator facets_end(){ + return filter_iterator(triangulation().finite_facets_end(), + Not_in_complex()); + } + + + Edge_iterator edges_begin(){ + return filter_iterator(triangulation().finite_edges_begin(), + Not_in_complex()); + } + + Edge_iterator edges_end(){ + return filter_iterator(triangulation().finite_edges_end(), + Not_in_complex()); + } + + Vertex_iterator vertices_begin(){ + return filter_iterator(triangulation().finite_vertices_begin(), + Not_in_complex()); + } + + Vertex_iterator vertices_end(){ + return filter_iterator(triangulation().finite_vertices_end(), + Not_in_complex()); + } + + Boundary_edges_iterator boundary_edges_begin() { + return filter_iterator(triangulation().finite_edges_begin(), + Not_on_boundary_tester); + } + + Boundary_edges_iterator boundary_edges_end() { + return filter_iterator(triangulation().finite_edges_end(), + Not_on_boundary_tester); + } + + }; // end Complex_2_in_triangulation_3 } // end namespace CGAL