Concept

HalfedgeGraph

Definition

The concept HalfedgeGraph describes the requirements for a graph that is structurally equivalent to a polyhedral surface represented by a halfedge data structure, and it provides an interface for efficient access to the opposite edge of an edge, and to the successor and predecessor of an edge in the iterator range of the incoming edges of a vertex. Each vertex has a geometric position in space. As in a halfedge data structure we define the face adjacent to a halfedge to be to the left of the halfedge.

Requirements

For each directed edge e=(v,w) its opposite edge e'=(w,v) must be part of the graph.

The incoming edges of a vertex v have a fixed order, that is all calls of in_edges(v,g) must return the same iterator range, modulo a cyclic permutation. The order must be clockwise.

As the HalfedgeGraph is equivalent to a polyhedral surface there must exist an embedding for the vertices and edges such that the ordered edges do not intersect.

Refines

BidirectionalGraph
PropertyGraph

A model of HalfedgeGraph must have the interior properties edge_is_border attached to its edges, and it must have vertex_is_border and vertex_point attached to its vertices.

Associated Types

HalfedgeGraph::halfedge_graph_traits<HalfedgeGraph>::Point
The type of the geometric location of a vertex.

Because (directed) edges must come in pairs, there is the additional notion of an undirected edge1 for a pair of opposite directed edges. The number of undirected edges is exactly half the number of directed edges.

Note that the notion of directed and undirected edges does not imply the existence of two different types. The type edge_descriptor is used for both. An undirected edge must be implicitly handled, and there is no requirement on which of the directed edges of the undirected edge must be used to represent it.

HalfedgeGraph::halfedge_graph_traits<HalfedgeGraph>::undirected_edge_iterator
An iterator that iterates over one and only one of the directed edges in each pair of opposite directed edges. The value type of the iterator is boost::graph_traits<HalfedgeGraph>::edge_descriptor.

Valid Expressions

Following the Bgl design, the following graph operations are defined as free rather than member functions.

template<class Graph>
std::pair<typename halfedge_graph_traits<HalfedgeGraph>::undirected_edge_iterator, typename halfedge_graph_traits<HalfedgeGraph>::undirected_edge_iterator>
undirected_edges ( Graph const& g)
Returns the undirected edges of g.

An edge e=(v,w) is said to be the opposite edge of edge e'=(w,v).

template<class Graph>
typename boost::graph_traits<Graph const>::edge_descriptor
opposite_edge ( typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g)
Returns the opposite edge of e.

An edge e'=(v,w) is called the clockwise neighbor of edge e=(u,w), and e the counterclockwise neighbor of e', iff there exist two iterators it and it' in the iterator range in_edges(w,g) such that **it == e and **it' == e', and it' == it++ or it is the last and it' the first iterator of the iterator range.

template<class Graph>
typename boost::graph_traits<Graph const>::edge_descriptor
next_edge_cw ( typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g)
Returns the clockwise neighbor of e.

template<class Graph>
typename boost::graph_traits<Graph const>::edge_descriptor
next_edge_ccw ( typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g)
Returns the counterclockwise neighbor of e.

A composition of these access functions yields an access function for the edge cycle adjacent to the same face. An edge e'=(v,w) is called the successor of edge e=(u,v), and e the predecessor of e', iff e' is the clockwise neighbor of the opposite edge of e.

template<class Graph>
typename boost::graph_traits<Graph const>::edge_descriptor
next_edge ( typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g)
Returns the successor of e.

template<class Graph>
typename boost::graph_traits<Graph const>::edge_descriptor
prev_edge ( typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g)
Returns the predecessor of e.

Has Models

CGAL::Polyhedron_3<Traits>


Footnotes

 1  The directed edges are not called halfedges (as in a HalfedgeDS) because from the point of view of this graph, being a refinement of a Bgl graph, each directed edge is an edge in itself. In other words, the unqualified term edge refers to one and only one directed edge and not to a pair.