#include #include #include // A modifier creating a triangle with the incremental builder. template class Build_triangle : public CGAL::Modifier_base { public: Build_triangle() {} void operator()( HDS& hds) { // Postcondition: hds is a valid polyhedral surface. CGAL::Polyhedron_incremental_builder_3 B( hds, true); B.begin_surface( 3, 1, 6); typedef typename HDS::Vertex Vertex; typedef typename Vertex::Point Point; B.add_vertex( Point( 0, 0, 0)); B.add_vertex( Point( 1, 0, 0)); B.add_vertex( Point( 0, 1, 0)); B.begin_facet(); B.add_vertex_to_facet( 0); B.add_vertex_to_facet( 1); B.add_vertex_to_facet( 2); B.end_facet(); B.end_surface(); } }; typedef CGAL::Simple_cartesian Kernel; typedef CGAL::Polyhedron_3 Polyhedron; typedef Polyhedron::HalfedgeDS HalfedgeDS; int main() { Polyhedron P; Build_triangle triangle; P.delegate( triangle); CGAL_assertion( P.is_triangle( P.halfedges_begin())); return 0; }