|
1 | | - |
2 | 1 | /*! |
3 | 2 | \ingroup PkgBGLConcepts |
4 | 3 | \cgalConcept |
5 | 4 |
|
6 | | -The concept `HalfedgeGraph` describes the requirements for a graph that is |
7 | | -structurally equivalent to a polyhedral surface represented by a |
8 | | -halfedge data structure, and it provides an interface for efficient |
9 | | -access to the opposite edge of an edge, and to the successor and |
10 | | -predecessor of an edge in the iterator range of the incoming edges of |
11 | | -a vertex. Each vertex has a geometric position in space. As in a |
12 | | -halfedge data structure we define the face adjacent to a halfedge to be |
13 | | -to the <I>left</I> of the halfedge. |
14 | | -
|
15 | | -\cgalHeading{Requirements} |
| 5 | +The concept `HalfedgeGraph` is a refinement of the \sc{Bgl} concept |
| 6 | +<A HREF="http://www.boost.org/libs/graph/doc/Graph.html">`Graph`</A> and adds the notion of a *halfedge*: Each edge is |
| 7 | +associated with two *opposite* halfedges with source and target vertices swapped. |
| 8 | +Furthermore, halfedges have a *successor* and *predecessor*, |
| 9 | +and form cycles we call *faces*. However, this concept |
| 10 | +does not introduce a face type. |
| 11 | +A `HalfedgeGraph` is undirected and does not allow parallel edges. |
16 | 12 |
|
17 | | -For each <I>directed edge</I> `e=(v,w)` its opposite edge `e2=(w,v)` |
18 | | -must be part of the graph. |
| 13 | +Using the composition of the *successor* and *opposite* functions results |
| 14 | +in another cycle, namely the cycle of halfedges which are incident to |
| 15 | +the same vertex. We refer to \ref PkgBGLIterators for a description of |
| 16 | +iterators and circulators for these halfedge cycles. |
19 | 17 |
|
20 | | -The incoming edges of a vertex `v` have a fixed order, that is all |
21 | | -calls of `in_edges(v,g)` must return the same iterator range, |
22 | | -modulo a cyclic permutation. The order must be <I>clockwise</I>. |
23 | 18 |
|
24 | | -As the `HalfedgeGraph` is equivalent to a polyhedral surface there must exist an embedding |
25 | | -for the vertices and edges such that the ordered edges do not intersect. |
| 19 | +\cgalRefines <A HREF="http://www.boost.org/libs/graph/doc/Graph.html">`Graph`</A> |
| 20 | +\cgalRefines <A HREF="http://www.boost.org/libs/graph/doc/PropertyGraph.html">`PropertyGraph`</A> |
26 | 21 |
|
27 | | -\cgalRefines <A HREF="http://www.boost.org/libs/graph/doc/BidirectionalGraph.html">BidirectionalGraph</A> |
28 | | -\cgalRefines <A HREF="http://www.boost.org/libs/graph/doc/PropertyGraph.html">PropertyGraph</A> |
| 22 | +A model of `HalfedgeGraph` must have the interior property `vertex_point` attached to its vertices. |
29 | 23 |
|
30 | | -A model of `HalfedgeGraph` must have the <I>interior properties</I> |
31 | | -`edge_is_border` attached to its edges, and it must have |
32 | | -`vertex_is_border` and `vertex_point` attached to its vertices. |
33 | | -
|
34 | | -\cgalHeading{Associated Types} |
| 24 | +\cgalHasModel `CGAL::Polyhedron_3` |
35 | 25 |
|
36 | | -Because (directed) edges must come in pairs, there is the |
37 | | -additional notion of an <I>undirected edge</I> |
38 | | -\cgalFootnote{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.} |
39 | | -for a pair of opposite directed edges. The number of undirected |
40 | | -edges is exactly half the number of directed edges. Note that the |
41 | | -notion of directed and undirected edges does not imply the |
42 | | -existence of two different types. The type `%edge_descriptor` is |
43 | | -used for both. An undirected edge must be implicitly handled, and |
44 | | -there is no requirement on which of the directed edges of the |
45 | | -undirected edge must be used to represent it. |
| 26 | +\cgalHeading{Notations} |
46 | 27 |
|
| 28 | +<dl> |
| 29 | +<dt>`G`</dt> <dd>A type that is a model of `HalfedgeGraph`.</dd> |
| 30 | +<dt>`g`</dt> <dd>An object of type `G`.</dd> |
| 31 | +<dt>`u`, `v`</dt> <dd>Vertex descriptors.</dd> |
| 32 | +<dt>`e`</dt> <dd>An edge descriptor.</dd> |
| 33 | +<dt>`h`</dt> <dd>A halfedge descriptor.</dd> |
| 34 | +</dl> |
47 | 35 |
|
48 | | -Associated Type | Explanation |
49 | | -----------------|------------- |
50 | | -halfedge_graph_traits<HalfedgeGraph>::Point; | The type of the geometric location of a vertex. |
51 | | -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`. |
| 36 | +\cgalHeading{Associated Types} |
52 | 37 |
|
| 38 | +Type | Description |
| 39 | +--------------------------------------------------------- | ------------ |
| 40 | +`boost::graph_traits<G>::%halfedge_descriptor` | A `halfedge_descriptor` corresponds to a halfedge in a graph. Must be `DefaultConstructible`, `Assignable`, `EqualityComparable` and `LessThanComparable`. |
53 | 41 |
|
54 | 42 |
|
55 | 43 | \cgalHeading{Valid Expressions} |
56 | 44 |
|
57 | | -Following the \sc{Bgl} design, the following graph operations are defined as free |
58 | | -rather than member functions. |
59 | | -
|
60 | | -\cgalHasModel `CGAL::Polyhedron_3<Traits>` |
| 45 | +Expression | Returns | Description |
| 46 | +--------------------------------------- | ---------------------------------------------------------------------------- | ----------- |
| 47 | +`edge(h, g)` | `edge_descriptor` | The edge corresponding to `h` and `opposite(h)`. |
| 48 | +`halfedge(e, g)` | `halfedge_descriptor` | One of the halfedges corresponding to `e`. |
| 49 | +`halfedge(v, g)` | `halfedge_descriptor` | A halfedge with target `v`. |
| 50 | +`halfedge(u, v, g)` | `std::pair<halfedge_descriptor,bool>` | The halfedge with source `u` and target `v`. The Boolean is `true`, iff this halfedge exists. |
| 51 | +`opposite(h, g)` | `halfedge_descriptor` | The halfedge with source and target swapped. |
| 52 | +`source(h,g)` | `vertex_descriptor` | The source vertex of `h`. |
| 53 | +`target(h,g)` | `vertex_descriptor` | The target vertex of `h`. |
| 54 | +`next(h, g)` | `halfedge_descriptor` | The next halfedge around its face. |
| 55 | +`prev(h, g)` | `halfedge_descriptor` | The previous halfedge around its face. |
61 | 56 | */ |
62 | | -class HalfedgeGraph { |
63 | | - |
64 | | -}; |
65 | | - |
66 | | -/*! |
67 | | -Returns the undirected edges of `g`. |
68 | | -
|
69 | | -\relates HalfedgeGraph |
70 | | -*/ |
71 | | -template<class Graph> |
72 | | -std::pair<typename halfedge_graph_traits<HalfedgeGraph>::undirected_edge_iterator, |
73 | | - typename halfedge_graph_traits<HalfedgeGraph>::undirected_edge_iterator> |
74 | | -undirected_edges(const Graph& g); |
75 | | - |
76 | | -/*! |
77 | | -Returns the opposite edge of `e`. |
78 | | -
|
79 | | -An edge `e=(v,w)` is said to be the <I>opposite edge</I> of edge |
80 | | -`e2=(w,v)`. |
81 | | -
|
82 | | -\relates HalfedgeGraph |
83 | | -*/ |
84 | | -template<class Graph> |
85 | | -typename boost::graph_traits<Graph const>::edge_descriptor |
86 | | -opposite_edge(typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g ); |
87 | | - |
88 | | -/*! |
89 | | -Returns the clockwise neighbor of `e`. |
90 | | -
|
91 | | -An edge `e2=(v,w)` is called the <I>clockwise neighbor</I> of |
92 | | -edge `e=(u,w)`, and `e` the <I>counterclockwise neighbor</I> |
93 | | -of `e2`, iff there exist two iterators `it` and `it2` |
94 | | -in the iterator range `in_edges(w,g)` such that `**it == e` and `**it2 |
95 | | -== e2`, and `it2 == it++` or `it` is the last and `it2` the first |
96 | | -iterator of the iterator range. |
97 | | -
|
98 | | -\relates HalfedgeGraph |
99 | | -*/ |
100 | | -template<class Graph> |
101 | | -typename boost::graph_traits<Graph const>::edge_descriptor |
102 | | -next_edge_cw(typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g ); |
103 | | - |
104 | | -/*! |
105 | | -Returns the counterclockwise neighbor of `e`. |
106 | | -\relates HalfedgeGraph |
107 | | -*/ |
108 | | -template<class Graph> |
109 | | -typename boost::graph_traits<Graph const>::edge_descriptor |
110 | | -next_edge_ccw(typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g ); |
111 | | - |
112 | | -/*! |
113 | | -Returns the successor of `e`. |
114 | | -
|
115 | | -An edge `e2=(v,w)` is called the <I>successor</I> of edge ` |
116 | | -e=(u,v)`, and `e` the <I>predecessor</I> of `e2`, iff ` |
117 | | -e2` is the clockwise neighbor of the opposite edge of `e`. |
118 | | -
|
119 | | -\relates HalfedgeGraph |
120 | | -*/ |
121 | | -template<class Graph> |
122 | | -typename boost::graph_traits<Graph const>::edge_descriptor |
123 | | -next_edge(typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g ); |
124 | | - |
125 | | -/*! |
126 | | -Returns the predecessor of `e`. |
127 | | -
|
128 | | -An edge `e2=(v,w)` is called the <I>successor</I> of edge ` |
129 | | -e=(u,v)`, and `e` the <I>predecessor</I> of `e2`, iff ` |
130 | | -e2` is the clockwise neighbor of the opposite edge of `e`. |
131 | | -
|
132 | | -\relates HalfedgeGraph |
133 | | -*/ |
134 | | -template<class Graph> |
135 | | -typename boost::graph_traits<Graph const>::edge_descriptor |
136 | | -prev_edge(typename boost::graph_traits<Graph const>::edge_descriptor e, Graph const& g ); |
| 57 | +class HalfedgeGraph {}; |
0 commit comments