BGL: Add Face_around_face_circulator (#9022)

## Summary of Changes

Add missing implementation.  Thank's for pointing out @efifogel 

## Release Management

* Affected package(s): BGL
* Issue(s) solved (if any): fix #9021
* License and copyright ownership:  unchanged
This commit is contained in:
Sebastien Loriot 2025-08-13 18:03:34 +02:00 committed by GitHub
commit 7b906084dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 1 deletions

View File

@ -871,7 +871,54 @@ private:
*/ */
template <typename Graph> template <typename Graph>
class Face_around_face_circulator class Face_around_face_circulator
{}; #ifndef DOXYGEN_RUNNING
: public boost::iterator_adaptor<
Face_around_face_circulator<Graph> // Derived
, Halfedge_around_face_circulator<Graph> // Base
, typename boost::graph_traits<Graph>::face_descriptor // Value
, Bidirectional_circulator_tag // CategoryOrTraversal
, typename boost::graph_traits<Graph>::face_descriptor // Reference
>
#endif
{
internal::Opposite_face<Graph> fct;
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
public:
#ifndef DOXYGEN_RUNNING
typedef std::size_t size_type;
#endif
Face_around_face_circulator()
{}
Face_around_face_circulator(halfedge_descriptor h, const Graph& g)
: Face_around_face_circulator::iterator_adaptor_(Halfedge_around_face_circulator<Graph>(h,g)), fct(g)
{}
#ifndef DOXYGEN_RUNNING
explicit operator bool() const
{
return (! (this->base_reference() == nullptr));
}
bool operator== (void*) const
{
return this->base_reference()== nullptr;
}
bool operator!= (void*) const
{
return this->base_reference()!= nullptr;
}
private:
friend class boost::iterator_core_access;
typename boost::graph_traits<Graph>::face_descriptor dereference() const { return fct(*this->base_reference()); }
#endif
};
/** /**
* \ingroup PkgBGLIterators * \ingroup PkgBGLIterators

View File

@ -18,6 +18,7 @@ typedef GraphTraits::edge_descriptor edge_descriptor;
typedef GraphTraits::out_edge_iterator out_edge_iterator; typedef GraphTraits::out_edge_iterator out_edge_iterator;
typedef GraphTraits::in_edge_iterator in_edge_iterator; typedef GraphTraits::in_edge_iterator in_edge_iterator;
typedef CGAL::Face_around_face_circulator<Polyhedron> face_around_face_circulator;
typedef CGAL::Halfedge_around_face_circulator<Polyhedron> halfedge_around_face_circulator; typedef CGAL::Halfedge_around_face_circulator<Polyhedron> halfedge_around_face_circulator;
typedef CGAL::Halfedge_around_target_circulator<Polyhedron> halfedge_around_target_circulator; typedef CGAL::Halfedge_around_target_circulator<Polyhedron> halfedge_around_target_circulator;
typedef CGAL::Vertex_around_target_circulator<Polyhedron> vertex_around_target_circulator; typedef CGAL::Vertex_around_target_circulator<Polyhedron> vertex_around_target_circulator;
@ -32,6 +33,7 @@ typedef CGAL::Vertex_around_target_iterator<Polyhedron> vertex_around_target_ite
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<face_around_face_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_face_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_target_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<halfedge_around_target_circulator>));
BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<vertex_around_target_circulator>)); BOOST_CONCEPT_ASSERT((CGAL::Concepts::BidirectionalCirculator<vertex_around_target_circulator>));
@ -62,6 +64,14 @@ int main(int argc, char* argv[])
}while(hafc != done); }while(hafc != done);
} }
{
face_around_face_circulator fafc(hd,P), done(fafc);
do {
++fafc;
}while(fafc != done);
}
{ {
halfedge_around_target_circulator havc(hd,P), done(havc); halfedge_around_target_circulator havc(hd,P), done(havc);
vertex_descriptor vd = target(hd,P); vertex_descriptor vd = target(hd,P);