CGAL::HalfedgeDS_items_decorator<HDS>

Definition

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>

Types

HalfedgeDS_items_decorator<HDS>::HalfedgeDS
halfedge data structure.

HalfedgeDS_items_decorator<HDS>::Traits
traits class.

HalfedgeDS_items_decorator<HDS>::Vertex
vertex type of HalfedgeDS.

HalfedgeDS_items_decorator<HDS>::Halfedge
halfedge type of HalfedgeDS.

HalfedgeDS_items_decorator<HDS>::Face
face type of HalfedgeDS.


HalfedgeDS_items_decorator<HDS>::Vertex_handle
HalfedgeDS_items_decorator<HDS>::Halfedge_handle
HalfedgeDS_items_decorator<HDS>::Face_handle
HalfedgeDS_items_decorator<HDS>::Vertex_iterator
HalfedgeDS_items_decorator<HDS>::Halfedge_iterator
HalfedgeDS_items_decorator<HDS>::Face_iterator

The respective const_handle's and const_iterator's are available as well.

HalfedgeDS_items_decorator<HDS>::size_type
HalfedgeDS_items_decorator<HDS>::difference_type
HalfedgeDS_items_decorator<HDS>::iterator_category

HalfedgeDS_items_decorator<HDS>::Supports_vertex_halfedge
HalfedgeDS_items_decorator<HDS>::Supports_halfedge_prev
HalfedgeDS_items_decorator<HDS>::Supports_halfedge_vertex
HalfedgeDS_items_decorator<HDS>::Supports_halfedge_face
HalfedgeDS_items_decorator<HDS>::Supports_face_halfedge
HalfedgeDS_items_decorator<HDS>::Supports_removal

Creation

HalfedgeDS_items_decorator<HDS> D;
default constructor.

Access Functions

Halfedge_handle D.get_vertex_halfedge ( Vertex_handle v)
returns the incident halfedge of v if supported, Halfedge_handle() otherwise.
Vertex_handle D.get_vertex ( Halfedge_handle h) returns the incident vertex of h if supported, Vertex_handle() otherwise.
Halfedge_handle D.get_prev ( Halfedge_handle h) returns the previous halfedge of h if supported, Halfedge_handle() otherwise.
Halfedge_handle D.find_prev ( Halfedge_handle h) returns the previous halfedge of h. Uses the prev() method if supported or performs a search around the face using next().
Halfedge_handle D.find_prev_around_vertex ( Halfedge_handle h)
returns the previous halfedge of h. Uses the prev() method if supported or performs a search around the vertex using next().
Face_handle D.get_face ( Halfedge_handle h) returns the incident face of h if supported, Face_handle() otherwise.
Halfedge_handle D.get_face_halfedge ( Face_handle f)
returns the incident halfedge of f if supported, Halfedge_handle() otherwise.

Corresponding member functions for const_handle's are provided as well.

Modifying Functions (Composed)

void D.close_tip ( Halfedge_handle h) makes h->opposite() the successor of h.

void D.close_tip ( Halfedge_handle h, Vertex_handle v)
makes h->opposite() the successor of h and sets the incident vertex of h to v.

void D.insert_tip ( Halfedge_handle h, Halfedge_handle 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.

void D.remove_tip ( Halfedge_handle h) 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().

void D.insert_halfedge ( Halfedge_handle h, Halfedge_handle f)
inserts the halfedge h between f and f->next(). The face of h will be the one f refers to if faces are supported.

void D.remove_halfedge ( Halfedge_handle h)
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().

void D.set_vertex_in_vertex_loop ( Halfedge_handle h, Vertex_handle v)
loops around the vertex incident to h and sets all vertex pointers to v.
Precondition: h != Halfedge_handle().

void D.set_face_in_face_loop ( Halfedge_handle h, Face_handle f)
loops around the face incident to h and sets all face pointers to f.
Precondition: h != Halfedge_handle().

Halfedge_handle D.flip_edge ( Halfedge_handle h) performs an edge flip. It returns h after rotating the edge h one vertex in the direction of the face orientation.
Precondition: h != Halfedge_handle() and both incident faces of h are triangles.

Modifying Functions (Primitives)

void D.set_vertex_halfedge ( Vertex_handle v, Halfedge_handle g)
sets the incident halfedge of v to g.
void D.set_vertex_halfedge ( Halfedge_handle h)
sets the incident halfedge of the vertex incident to h to h.
void D.set_vertex ( Halfedge_handle h, Vertex_handle v)
sets the incident vertex of h to v.
void D.set_prev ( Halfedge_handle h, Halfedge_handle g)
sets the previous link of h to g.
void D.set_face ( Halfedge_handle h, Face_handle f)
sets the incident face of h to f.
void D.set_face_halfedge ( Face_handle f, Halfedge_handle g)
sets the incident halfedge of f to g.
void D.set_face_halfedge ( Halfedge_handle h)
sets the incident halfedge of the face incident to h to h.

See Also

CGAL::HalfedgeDS_decorator<HDS>
CGAL::HalfedgeDS_const_decorator<HDS>

Example

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));
    }
};