CGAL 6.1.2 - Halfedge Data Structures: CGAL::HalfedgeDS_items_2 Class Reference

CGAL 6.1.2 - Halfedge Data Structures

Loading...
Searching...
No Matches
CGAL::HalfedgeDS_items_2 Class Reference
Reference Manual » Item Classes

`#include <CGAL/HalfedgeDS_items_2.h>`

## Definition

The class `HalfedgeDS_items_2` is a model of the `HalfedgeDSItems` concept.

It uses the default types for vertices, halfedges, and faces that declare all incidences supported by a `HalfedgeDS`. The vertex also contains a point of type `Traits::Point_2`, where `Traits` is the template argument of the corresponding `HalfedgeDS`.

Is model of
  `HalfedgeDSItems`

See also
  `CGAL::HalfedgeDS_min_items`
  `CGAL::Polyhedron_items_3`
  `HalfedgeDS<Traits,Items,Alloc>`
  `PolyhedronItems_3`
  `CGAL::HalfedgeDS_vertex_base<Refs>`
  `CGAL::HalfedgeDS_halfedge_base<Refs>`
  `CGAL::HalfedgeDS_face_base<Refs>`

Example

The following example shows the canonical implementation of the `HalfedgeDS_items_2` class. It uses the base classes for the item types that are provided in the library.

struct HalfedgeDS_items_2 {
template < class Refs, class Traits>
struct Vertex_wrapper {
typedef typename Traits::Point_2 Point;
typedef CGAL::HalfedgeDS_vertex_base< Refs, Tag_true, Point> Vertex;
};
template < class Refs, class Traits>
struct Halfedge_wrapper {
typedef CGAL::HalfedgeDS_halfedge_base< Refs> Halfedge;
};
template < class Refs, class Traits>
struct Face_wrapper {
typedef CGAL::HalfedgeDS_face_base< Refs> Face;
};
};
CGAL::HalfedgeDS_face_base
The class HalfedgeDS_face_base is a model of the HalfedgeDSFace concept.
Definition: HalfedgeDS_face_base.h:50
CGAL::HalfedgeDS_halfedge_base
The class HalfedgeDS_halfedge_base is a model of the HalfedgeDSHalfedge concept.
Definition: HalfedgeDS_halfedge_base.h:72
CGAL::HalfedgeDS_items_2
The class HalfedgeDS_items_2 is a model of the HalfedgeDSItems concept.
Definition: HalfedgeDS_items_2.h:76
CGAL::HalfedgeDS_vertex_base
The class HalfedgeDS_vertex_base is a model of the HalfedgeDSVertex concept.
Definition: HalfedgeDS_vertex_base.h:48

The following example shows a class definition for a new items class derived from the `HalfedgeDS_items_2` class. It replaces the `Face_wrapper` with a new definition of a face that contains a member variable for color. The new face makes use of the face base class provided in the library.

// A face type with a color member variable.
template <class Refs>
struct My_face : public CGAL::HalfedgeDS_face_base<Refs> {
CGAL::IO::Color color;
My_face() {}
My_face( CGAL::IO::Color c) : color(c) {}
};
// An items type using my face.
struct My_items : public CGAL::HalfedgeDS_items_2 {
template <class Refs, class Traits>
struct Face_wrapper {
typedef My_face<Refs> Face;
};
};
CGAL::IO::Color

Examples
  HalfedgeDS/hds_prog_color.cpp, HalfedgeDS/hds_prog_compact.cpp, and HalfedgeDS/hds_prog_compact2.cpp.