mirror of https://github.com/CGAL/cgal
fix in_edges() and out_edges()
This commit is contained in:
parent
16d369dbd0
commit
58b4b81ccd
|
|
@ -103,8 +103,8 @@ public:
|
||||||
typedef typename GTP::halfedge_iterator halfedge_iterator;
|
typedef typename GTP::halfedge_iterator halfedge_iterator;
|
||||||
typedef typename GTP::edge_iterator edge_iterator;
|
typedef typename GTP::edge_iterator edge_iterator;
|
||||||
|
|
||||||
typedef CGAL::Halfedge_around_face_iterator<Primal> in_edge_iterator;
|
typedef CGAL::Edge_around_face_iterator<Primal> out_edge_iterator;
|
||||||
typedef CGAL::Opposite_edge_around_face_iterator<Primal> out_edge_iterator;
|
typedef CGAL::Opposite_edge_around_face_iterator<Primal> in_edge_iterator;
|
||||||
|
|
||||||
static vertex_descriptor null_vertex() { return vertex_descriptor(); }
|
static vertex_descriptor null_vertex() { return vertex_descriptor(); }
|
||||||
static face_descriptor null_face() { return face_descriptor(); }
|
static face_descriptor null_face() { return face_descriptor(); }
|
||||||
|
|
@ -446,16 +446,16 @@ out_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
|
||||||
const Dual<P>& dual)
|
const Dual<P>& dual)
|
||||||
{
|
{
|
||||||
const typename Dual<P>::Primal& primal = dual.primal();
|
const typename Dual<P>::Primal& primal = dual.primal();
|
||||||
return opposite_edges_around_face(halfedge(v,primal),primal);
|
return edges_around_face(halfedge(v,primal),primal);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename P>
|
template <typename P>
|
||||||
Iterator_range<typename boost::graph_traits<Dual<P> >::out_edge_iterator>
|
Iterator_range<typename boost::graph_traits<Dual<P> >::in_edge_iterator>
|
||||||
in_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
|
in_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
|
||||||
const Dual<P>& dual)
|
const Dual<P>& dual)
|
||||||
{
|
{
|
||||||
const typename Dual<P>::Primal& primal = dual.primal();
|
const typename Dual<P>::Primal& primal = dual.primal();
|
||||||
return halfedges_around_face(halfedge(v,primal),primal);
|
return opposite_edges_around_face(halfedge(v,primal),primal);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename P>
|
template <typename P>
|
||||||
|
|
|
||||||
|
|
@ -1122,6 +1122,40 @@ opposite_edges_around_face(typename boost::graph_traits<Graph>::halfedge_descrip
|
||||||
return make_range(I(h,g), I(h,g,1));
|
return make_range(I(h,g), I(h,g,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Graph>
|
||||||
|
class Edge_around_face_iterator
|
||||||
|
#ifndef DOXYGEN_RUNNING
|
||||||
|
: public boost::iterator_adaptor<
|
||||||
|
Edge_around_face_iterator<Graph> // Derived
|
||||||
|
, Halfedge_around_face_iterator<Graph> // Base
|
||||||
|
, typename boost::graph_traits<Graph>::edge_descriptor // Value
|
||||||
|
, std::bidirectional_iterator_tag // CategoryOrTraversal
|
||||||
|
, typename boost::graph_traits<Graph>::edge_descriptor // Reference
|
||||||
|
>
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
|
||||||
|
internal::Edge<Graph> fct;
|
||||||
|
public:
|
||||||
|
|
||||||
|
Edge_around_face_iterator()
|
||||||
|
{}
|
||||||
|
|
||||||
|
Edge_around_face_iterator(halfedge_descriptor h, const Graph& g, int n = 0)
|
||||||
|
: Edge_around_face_iterator::iterator_adaptor_(Halfedge_around_face_iterator<Graph>(h,g,(h==halfedge_descriptor())?1:n)), fct(g)
|
||||||
|
{}
|
||||||
|
private:
|
||||||
|
friend class boost::iterator_core_access;
|
||||||
|
typename boost::graph_traits<Graph>::edge_descriptor dereference() const { return fct(*this->base_reference()); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Graph>
|
||||||
|
Iterator_range<Edge_around_face_iterator<Graph> >
|
||||||
|
edges_around_face(typename boost::graph_traits<Graph>::halfedge_descriptor h, const Graph& g)
|
||||||
|
{
|
||||||
|
typedef Edge_around_face_iterator<Graph> I;
|
||||||
|
return make_range(I(h,g), I(h,g,1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ typedef CGAL::Dual<Mesh> Dual;
|
||||||
typedef boost::graph_traits<Dual>::face_descriptor face_descriptor;
|
typedef boost::graph_traits<Dual>::face_descriptor face_descriptor;
|
||||||
typedef boost::graph_traits<Dual>::vertex_descriptor vertex_descriptor;
|
typedef boost::graph_traits<Dual>::vertex_descriptor vertex_descriptor;
|
||||||
typedef boost::graph_traits<Dual>::halfedge_descriptor halfedge_descriptor;
|
typedef boost::graph_traits<Dual>::halfedge_descriptor halfedge_descriptor;
|
||||||
|
typedef boost::graph_traits<Dual>::out_edge_iterator out_edge_iterator;
|
||||||
|
typedef boost::graph_traits<Dual>::in_edge_iterator in_edge_iterator;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
@ -39,6 +41,17 @@ int main()
|
||||||
assert(target(lhd,dual) == vd);
|
assert(target(lhd,dual) == vd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
out_edge_iterator b,e;
|
||||||
|
boost::tie(b,e) = out_edges(vd,dual);
|
||||||
|
std::cerr << vd << " " << source(*b,dual) << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
in_edge_iterator b,e;
|
||||||
|
boost::tie(b,e) = in_edges(vd,dual);
|
||||||
|
std::cerr << vd << " " << source(*b,dual) << std::endl;
|
||||||
|
}
|
||||||
std::cerr << "done"<< std::endl;
|
std::cerr << "done"<< std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue