The polyhedron can be parameterized by a \italic{traits} class in order to extend the vertex, halfedge and facet primitives. In this tutorial all primitives (facets, halfedges and vertices) are extended. The facet is extended with a normal and with a general-purpose integer tag: { \scriptsize \begin{verbatim} template class Enriched_facet : public CGAL::HalfedgeDS_face_base { // tag int m_tag; // normal Norm m_normal; public: // no constructors to repeat, since only // default constructor mandatory Enriched_facet() { } // tag const int& tag() { return m_tag; } void tag(const int& t) { m_tag = t; } // normal typedef Norm Normal_3; Normal_3& normal() { return m_normal; } const Normal_3& normal() const { return m_normal; } }; \end{verbatim}} The halfedge is extended with a general-purpose tag and a binary tag to indicate wether it belongs to the control mesh or not. The latter tag is used to superimpose the control mesh as shown in Fig.\ref{fig:teaser}. { \scriptsize \begin{verbatim} template class Enriched_halfedge : public CGAL::HalfedgeDS_halfedge_base { private: // tag int m_tag; // option for control edge superimposing bool m_control_edge; public: // life cycle Enriched_halfedge() { m_control_edge = true; } // tag const int& tag() const { return m_tag; } int& tag() { return m_tag; } void tag(const int& t) { m_tag = t; } // control edge bool& control_edge() { return m_control_edge; } const bool& control_edge() const { return m_control_edge; } void control_edge(const bool& flag) { m_control_edge = flag; } }; \end{verbatim}} The vertex is extended with a normal and a general-purpose integer tag: { \scriptsize \begin{verbatim} template class Enriched_vertex : public CGAL::HalfedgeDS_vertex_base { // tag int m_tag; // normal Norm m_normal; public: // life cycle Enriched_vertex() {} // repeat mandatory constructors Enriched_vertex(const P& pt) : CGAL::HalfedgeDS_vertex_base(pt) { } // normal typedef Norm Normal_3; Normal_3& normal() { return m_normal; } const Normal_3& normal() const { return m_normal; } // tag int& tag() { return m_tag; } const int& tag() const { return m_tag; } void tag(const int& t) { m_tag = t; } }; \end{verbatim}} A redefined items class for the polyhedron uses the class wrapper mechanism to embedd all three extended primitives within one unique class. { \scriptsize \begin{verbatim} struct Enriched_items : public CGAL::Polyhedron_items_3 { // wrap vertex template struct Vertex_wrapper { typedef typename Traits::Point_3 Point; typedef typename Traits::Vector_3 Normal; typedef Enriched_vertex Vertex; }; // wrap face template struct Face_wrapper { typedef typename Traits::Point_3 Point; typedef typename Traits::Vector_3 Normal; typedef Enriched_facet Face; }; // wrap halfedge template struct Halfedge_wrapper { typedef typename Traits::Vector_3 Normal; typedef Enriched_halfedge Halfedge; }; }; \end{verbatim}} The trait class is then used for templating a polyhedron \italic{Enriched\_polyhedron}: { \scriptsize \begin{verbatim} template class Enriched_polyhedron : public CGAL::Polyhedron_3 { //... }; \end{verbatim}} The corresponding instanciation of an enriched polyhedron follows: { \scriptsize \begin{verbatim} #include #include "enriched_polyhedron.h" typedef double number_type; typedef CGAL::Simple_cartesian kernel; Enriched_polyhedron polyhedron; \end{verbatim}}