The classes CGAL::HalfedgeDS_items_decorator<HDS>, CGAL::HalfedgeDS_decorator<HDS>, and CGAL::HalfedgeDS_const_decorator<HDS> provide additional functions to examine and to modify a halfedge data structure HDS. The class CGAL::HalfedgeDS_items_decorator<HDS> provides additional functions for vertices, halfedges, and faces of a halfedge data structure without knowing the containing halfedge data structure. The class CGAL::HalfedgeDS_decorator<HDS> stores a reference to the halfedge data structure and provides functions that modify the halfedge data structure, for example Euler-operators. The class CGAL::HalfedgeDS_const_decorator<HDS> stores a const reference to the halfedge data structure. It contains non-modifying functions, for example the test for validness of the data structure.
All these additional functions take care of the different capabilities a halfedge data structure may have or may not have. The functions evaluate the type tags of the halfedge data structure to decide on the actions. If a particular feature is not supported nothing is done. Note that for example the creation of new halfedges is mandatory for all halfedge data structures and will not appear here again.
#include <CGAL/HalfedgeDS_items_decorator.h>
| |
halfedge data structure.
| |
| |
traits class.
| |
| |
vertex type of HalfedgeDS.
| |
| |
halfedge type of HalfedgeDS.
| |
| |
face type of HalfedgeDS.
| |
| |
| |
| |
| |
| |
|
The respective const_handle's and const_iterator's are available as well.
| |
default constructor.
|
Corresponding member functions for const_handle's are provided as well.
|
| makes h->opposite() the successor of h. | ||
|
| |||
makes h->opposite() the successor of h and sets the incident vertex of h to v. | ||||
|
| |||
inserts the tip of the edge h into the halfedges around the vertex pointed to by v. Halfedge h->opposite() is the new successor of v and h->next() will be set to v->next(). The vertex of h will be set to the vertex v refers to if vertices are supported. | ||||
|
| removes the edge h->next()->opposite() from the halfedge circle around the vertex referred to by h. The new successor halfedge of h will be h->next()->opposite()->next(). | ||
|
| |||
inserts the halfedge h between f and f->next(). The face of h will be the one f refers to if faces are supported. | ||||
|
| |||
removes edge h->next() from the halfedge circle around the face referred to by h. The new successor of h will be h->next()->next(). | ||||
|
| |||
loops around the vertex incident to h and sets all vertex
pointers to v.
| ||||
|
| |||
loops around the face incident to h and sets all face
pointers to f.
| ||||
|
|
performs an edge flip. It returns h after rotating the edge h one
vertex in the direction of the face orientation.
|
CGAL::HalfedgeDS_decorator<HDS>
CGAL::HalfedgeDS_const_decorator<HDS>
The following program fragment illustrates how a refined halfedge class for a polyhedron can make use of the find_prev() member function to implement a prev() member function that works regardless of whether the halfedge data structure HDS provides a prev() member function for its halfedges or not. In the case that not, the implementation given here runs in time proportional to the size of the incident face. For const-correctness a second implementation with signature Halfedge_const_handle prev() const; is needed.
Note also the use of the static member function halfedge_handle() of the halfedge data structure. It converts a pointer to the halfedge into a halfedge handle. This conversion encapsulates possible adjustments for hidden data members in the true halfedge type, such as linked-list pointers.
struct Polyhedron_halfedge { // ... Halfedge_handle prev() { CGAL::HalfedgeDS_items_decorator<HDS> decorator; return decorator.find_prev( HDS::halfedge_handle(this)); } };