CGAL::Polyhedron_items_3

Definition

The class Polyhedron_items_3 is a model of the PolyhedronItems_3 concept. It provides definitions for vertices with points, halfedges, and faces with plane equations. The polyhedron traits class must provide the respective types for the point and the plane equation. Vertices and facets both contain a halfedge handle to an incident halfedge.

#include <CGAL/Polyhedron_items_3.h>

Is Model for the Concept

PolyhedronItems_3

Types in Polyhedron_items_3::Vertex_wrapper<Refs,Traits>::Vertex

typedef Traits::Point_3
Point;
typedef CGAL::Tag_true
Supports_vertex_point;

Types in Polyhedron_items_3::Face_wrapper<Refs,Traits>::Face

typedef Traits::Plane_3
Plane;
typedef CGAL::Tag_true
Supports_face_plane;

Creation

Polyhedron_items_3 items;
default constructor.

Operations

Supported as required by the PolyhedronItems_3 concept.

See Also

CGAL::Polyhedron_3<Traits>
CGAL::Polyhedron_min_items_3
CGAL::HalfedgeDS_min_items
CGAL::HalfedgeDS_items_2

Example

The following example program defines a new face class based on the CGAL::HalfedgeDS_face_base and adds a new color member variable. The new face class is used to replace the face definition in the CGAL::Polyhedron_items_3 class. The main function illustrates the access to the new member variable. See also the PolyhedronItems_3 concept for another illustrative example.

// file: examples/Polyhedron/polyhedron_prog_color.C

#include <CGAL/Simple_cartesian.h>
#include <CGAL/IO/Color.h>
#include <CGAL/Polyhedron_3.h>

// A face type with a color member variable.
template <class Refs>
struct My_face : public CGAL::HalfedgeDS_face_base<Refs> {
    CGAL::Color color;
};

// An items type using my face.
struct My_items : public CGAL::Polyhedron_items_3 {
    template <class Refs, class Traits>
    struct Face_wrapper {
        typedef My_face<Refs> Face;
    };
};

typedef CGAL::Simple_cartesian<double>        Kernel;
typedef CGAL::Polyhedron_3<Kernel, My_items>  Polyhedron;
typedef Polyhedron::Halfedge_handle           Halfedge_handle;

int main() {
    Polyhedron P;
    Halfedge_handle h = P.make_tetrahedron();
    h->facet()->color = CGAL::RED;
    return 0;
}