The class Apollonius_graph_2<Gt,Agds> represents the Apollonius graph. It supports insertions and deletions of sites. It is templated by two template arguments Gt, which must be a model of ApolloniusGraphTraits_2, and Agds, which must be a model of ApolloniusGraphDataStructure_2. The second template argument defaults to CGAL::Triangulation_data_structure_2< CGAL::Apollonius_graph_vertex_base_2<Gt,true>, CGAL::Triangulation_face_base_2<Gt> >.
#include <CGAL/Apollonius_graph_2.h>
|
| A type for the underlying data structure. |
|
| A type for the geometric traits. |
| ||
| A type for the point defined in the geometric traits. | |
|
| A type for the Apollonius site, defined in the geometric traits. |
The vertices and faces of the Apollonius graph are accessed through handles, iterators and circulators. The iterators and circulators are all bidirectional and non-mutable. The circulators and iterators are assignable to the corresponding handle types, and they are also convertible to the corresponding handles. The edges of the Apollonius graph can also be visited through iterators and circulators, the edge circulators and iterators are also bidirectional and non-mutable. In the following, we call infinite any face or edge incident to the infinite vertex and the infinite vertex itself. Any other feature (face, edge or vertex) of the Apollonius graph is said to be finite. Some iterators (the All iterators ) allow to visit finite or infinite features while the others (the Finite iterators) visit only finite features. Circulators visit both infinite and finite features.
In addition to iterators and circulators for vertices and faces, iterators for sites are provided. In particular there are iterators for the entire set of sites, the hidden sites and the visible sites of the Apollonius graph.
| |
A type for an iterator over all sites.
| |
| |
A type for an iterator over all visible sites.
| |
| |
A type for an iterator over all hidden sites.
|
| |||
Creates an
Apollonius graph using gt as geometric traits.
| |||
| |||
| |||
Creates an Apollonius graph using gt as
geometric traits and inserts all sites in the range
[first, beyond). Precondition: Input_iterator must be a model of InputIterator. The value type of Input_iterator must be Site_2.
| |||
| |||
Copy constructor. All faces and vertices are duplicated. After the
construction,
ag and other refer to two different Apollonius graphs : if
other is modified, ag is not.
|
| ||
| Assignment. If ag and other are the same object nothing is done. Otherwise, all the vertices and faces are duplicated. After the assignment, ag and other refer to different Apollonius graphs : if other is modified, ag is not. |
An Apollonius graph can be seen as a container of faces and vertices. Therefore the Apollonius graph provides several iterators and circulators that allow to traverse it (completely or partially).
The following iterators allow respectively to visit finite faces, finite edges and finite vertices of the Apollonius graph. These iterators are non-mutable, bidirectional and their value types are respectively Face, Edge and Vertex. They are all invalidated by any change in the Apollonius graph.
The following iterators allow respectively to visit all (both finite and infinite) faces, edges and vertices of the Apollonius graph. These iterators are non-mutable, bidirectional and their value types are respectively Face, Edge and Vertex. They are all invalidated by any change in the Apollonius graph.
The following iterators allow respectively to visit all sites, the visible sites and the hidden sites. These iterators are non-mutable, bidirectional and their value type is Site_2. They are all invalidated by any change in the Apollonius graph.
The Apollonius graph also provides circulators that allow to visit respectively all faces or edges incident to a given vertex or all vertices adjacent to a given vertex. These circulators are non-mutable and bidirectional. The operator operator++ moves the circulator counterclockwise around the vertex while the operator-- moves clockwise. A face circulator is invalidated by any modification of the face pointed to. An edge circulator is invalidated by any modification in one of the two faces incident to the edge pointed to. A vertex circulator is invalidated by any modification in any of the faces adjacent to the vertex pointed to.
Applied on the infinite_vertex the above functions allow to visit the vertices on the convex hull and the infinite edges and faces. Note that a counterclockwise traversal of the vertices adjacent to the infinite_vertex is a clockwise traversal of the convex hull.
|
| |
true, iff v is the infinite_vertex. | ||
|
| |
true, iff face f is infinite. | ||
|
| |
true, iff edge (f,i) is infinite. | ||
|
| |
true, iff edge e is infinite. | ||
|
| |
true, iff edge *ec is infinite. |
| ||||
|
| |||
Inserts the sites in the range
[first,beyond). The number of sites in the range
[first, beyond) is returned. Precondition: Input_iterator must be a model of InputIterator and its value type must be Site_2. | ||||
|
| |||
Inserts the site s in the Apollonius graph. If s is visible then the vertex handle of s is returned, otherwise Vertex_handle(NULL) is returned. | ||||
|
| |||
Inserts s in the Apollonius graph using the site associated with vnear as an estimate for the nearest neighbor of the center of s. If s is visible then the vertex handle of s is returned, otherwise Vertex_handle(NULL) is returned. |
|
| |
Removes the site
associated to the vertex handle v from the Apollonius
graph. Precondition: v must correspond to a valid finite vertex of the Apollonius graph. |
|
| |
Finds the nearest neighbor of the point p. In other words it finds the site whose Apollonius cell contains p. Ties are broken arbitrarily and one of the nearest neighbors of p is returned. If there are no visible sites in the Apollonius diagram Vertex_handle(NULL) is returned. | ||
|
| |
Finds the nearest neighbor of the point p using the site associated with vnear as an estimate for the nearest neighbor of p. Ties are broken arbitrarily and one of the nearest neighbors of p is returned. If there are no visible sites in the Apollonius diagram Vertex_handle(NULL) is returned. |
The Apollonius_graph_2 class provides access to the duals of the faces of the graph. The dual of a face of the Apollonius graph is a site. If the originating face is infinite, its dual is a site with center at infinity (or equivalently with infinite weight), which means that it can be represented geometrically as a line. If the originating face is finite, its dual is a site with finite center and weight. In the following three methods the returned object is assignable to either Site_2 or Gt::Line_2, depending on whether the corresponding face of the Apollonius graph is finite or infinite, respectively.
|
| |
Returns the dual corresponding to the face handle f. The returned object can be assignable to one of the following: Site_2, Gt::Line_2. | ||
|
| |
Returns the dual of the face to which it points to. The returned object can be assignable to one of the following: Site_2, Gt::Line_2. | ||
|
| |
Returns the dual of the face to which it points to. The returned object can be assignable to one of the following: Site_2, Gt::Line_2. |
| ||
|
| |
Draws the Apollonius graph to
the stream str. Precondition: The following operators must be defined: Stream& operator<<(Stream&, Gt::Segment_2), Stream& operator<<(Stream&, Gt::Ray_2). | ||
| ||
|
| |
Draws the dual of the
Apollonius graph, i.e., the Apollonius diagram, to the stream
str. Precondition: The following operators must be defined: Stream& operator<<(Stream&, Gt::Segment_2), Stream& operator<<(Stream&, Gt::Ray_2), Stream& operator<<(Stream&, Gt::Line_2). | ||
| ||
|
| |
Draws the edge
e of the Apollonius graph to the stream str. Precondition: The following operators must be defined: Stream& operator<<(Stream&, Gt::Segment_2), Stream& operator<<(Stream&, Gt::Ray_2). | ||
| ||
|
| |
Draws the dual of the
edge e to the stream str. The dual of e is an edge
of the Apollonius diagram. Precondition: The following operators must be defined: Stream& operator<<(Stream&, Gt::Segment_2), Stream& operator<<(Stream&, Gt::Ray_2), Stream& operator<<(Stream&, Gt::Line_2). |
|
| |
Checks the validity of the Apollonius graph. If verbose is true a short message is sent to std::cerr. If level is 0, only the data structure is validated. If level is 1, then both the data structure and the Apollonius graph are validated. Negative values of level always return true, and values greater then 1 are equivalent to level being 1. |
|
| Clears all contents of the Apollonius graph. |
|
| The Apollonius graphs other and ag are swapped. ag.swap(other) should be preferred to ag = other or to ag(other) if other is deleted afterwards. |