// Copyright (c) 2006 Geometry Factory (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under // the terms of the Q Public License version 1.0. // See the file LICENSE.QPL distributed with CGAL. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL: svn+ssh://fcacciola@scm.gforge.inria.fr/svn/cgal/trunk/Surface_mesh_simplification/include/CGAL/Polyhedron_BGL.h $ // $Id: Polyhedron_BGL.h 32048 2006-06-23 13:59:36Z lsaboret $ // // // Author(s): Andreas Fabri , Fernando Cacciola #ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYHEDRON_3_H #define CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYHEDRON_3_H #include #include #ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM # define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS #else # define CGAL_HDS_PARAM_ class HDS #endif namespace boost { // // Const versions // template struct graph_traits< CGAL::Polyhedron_3 const > : CGAL::HDS_graph_traits< CGAL::Polyhedron_3 const> {}; template typename graph_traits< CGAL::Polyhedron_3 >::vertices_size_type num_vertices(const CGAL::Polyhedron_3& p) { return p.size_of_vertices(); } template typename graph_traits< CGAL::Polyhedron_3 const>::edges_size_type num_edges(const CGAL::Polyhedron_3& p) { return p.size_of_halfedges() ; } template typename graph_traits< CGAL::Polyhedron_3 const>::degree_size_type degree(typename graph_traits< CGAL::Polyhedron_3 const >::vertex_descriptor v, const CGAL::Polyhedron_3&) { return v->vertex_degree(); } template typename graph_traits< CGAL::Polyhedron_3 const>::degree_size_type out_degree(typename graph_traits< CGAL::Polyhedron_3 const>::vertex_descriptor v, const CGAL::Polyhedron_3&) { return v->vertex_degree(); } template typename graph_traits< CGAL::Polyhedron_3 const>::degree_size_type in_degree(typename graph_traits< CGAL::Polyhedron_3 const>::vertex_descriptor v, const CGAL::Polyhedron_3&) { return v->vertex_degree(); } template typename graph_traits< CGAL::Polyhedron_3 const>::vertex_descriptor source(typename graph_traits< CGAL::Polyhedron_3 const>::edge_descriptor e, CGAL::Polyhedron_3 const& p) { return e->opposite()->vertex(); } template typename graph_traits< CGAL::Polyhedron_3 const>::vertex_descriptor target(typename graph_traits< CGAL::Polyhedron_3 const>::edge_descriptor e, CGAL::Polyhedron_3 const& p) { return e->vertex(); } template inline std::pair const>::vertex_iterator ,typename graph_traits< CGAL::Polyhedron_3 const>::vertex_iterator > vertices( CGAL::Polyhedron_3 const& p) { typedef typename graph_traits< CGAL::Polyhedron_3 const>::vertex_iterator Iter; return std::make_pair( Iter(p.vertices_begin()), Iter(p.vertices_end()) ); } template inline std::pair const>::edge_iterator ,typename graph_traits< CGAL::Polyhedron_3 const>::edge_iterator > edges( CGAL::Polyhedron_3 const& p) { typedef typename graph_traits< CGAL::Polyhedron_3 const>::edge_iterator Iter; return std::make_pair( Iter(p.halfedges_begin()), Iter(p.halfedges_end()) ); } template inline std::pair const>::in_edge_iterator ,typename graph_traits< CGAL::Polyhedron_3 const>::in_edge_iterator > in_edges( typename graph_traits< CGAL::Polyhedron_3 const>::vertex_descriptor u, CGAL::Polyhedron_3 const& g) { typename CGAL::Polyhedron_3::Halfedge_around_vertex_const_circulator ec = u->vertex_begin(); int in_deg = in_degree(u,g); typedef typename graph_traits< CGAL::Polyhedron_3 const>::in_edge_iterator Iter; return std::make_pair( Iter(ec), Iter(ec,in_deg) ); } template inline std::pair const>::out_edge_iterator, typename graph_traits< CGAL::Polyhedron_3 const>::out_edge_iterator > out_edges( typename graph_traits< CGAL::Polyhedron_3 const>::vertex_descriptor u, CGAL::Polyhedron_3 const& g) { typename CGAL::Polyhedron_3::Halfedge_around_vertex_const_circulator ec = u->vertex_begin(); int out_deg = out_degree(u,g); typedef typename graph_traits< CGAL::Polyhedron_3 const>::out_edge_iterator Iter; return std::make_pair( Iter(ec), Iter(ec,out_deg) ); } // // Non-Const versions // template struct graph_traits< CGAL::Polyhedron_3 > : CGAL::HDS_graph_traits< CGAL::Polyhedron_3 > {}; template typename graph_traits< CGAL::Polyhedron_3 >::vertex_descriptor source(typename graph_traits< CGAL::Polyhedron_3 >::edge_descriptor e, CGAL::Polyhedron_3 & p) { return e->opposite()->vertex(); } template typename graph_traits< CGAL::Polyhedron_3 >::vertex_descriptor target(typename graph_traits< CGAL::Polyhedron_3 >::edge_descriptor e, CGAL::Polyhedron_3 & p) { return e->vertex(); } template inline std::pair >::vertex_iterator ,typename graph_traits< CGAL::Polyhedron_3 >::vertex_iterator > vertices( CGAL::Polyhedron_3& p) { typedef typename graph_traits< CGAL::Polyhedron_3 >::vertex_iterator Iter; return std::make_pair( Iter(p.vertices_begin()), Iter(p.vertices_end()) ); } template inline std::pair >::edge_iterator ,typename graph_traits< CGAL::Polyhedron_3 >::edge_iterator > edges( CGAL::Polyhedron_3& p) { typedef typename graph_traits< CGAL::Polyhedron_3 >::edge_iterator Iter; return std::make_pair( Iter(p.halfedges_begin()), Iter(p.halfedges_end()) ); } template inline std::pair >::in_edge_iterator ,typename graph_traits< CGAL::Polyhedron_3 >::in_edge_iterator > in_edges( typename graph_traits< CGAL::Polyhedron_3 >::vertex_descriptor u, CGAL::Polyhedron_3& g) { typename CGAL::Polyhedron_3::Halfedge_around_vertex_circulator ec = u->vertex_begin(); typename graph_traits< CGAL::Polyhedron_3 >::edges_size_type in_deg = in_degree(u,g); typedef typename graph_traits< CGAL::Polyhedron_3 >::in_edge_iterator Iter; return std::make_pair( Iter(ec), Iter(ec,in_deg) ); } template inline std::pair >::out_edge_iterator ,typename graph_traits< CGAL::Polyhedron_3 >::out_edge_iterator > out_edges( typename graph_traits< CGAL::Polyhedron_3 >::vertex_descriptor u, CGAL::Polyhedron_3& g) { typename CGAL::Polyhedron_3::Halfedge_around_vertex_circulator ec = u->vertex_begin(); typename graph_traits< CGAL::Polyhedron_3 >::edges_size_type out_deg = out_degree(u,g); typedef typename graph_traits< CGAL::Polyhedron_3 >::out_edge_iterator Iter; return std::make_pair( Iter(ec), Iter(ec,out_deg) ); } } // namespace boost #undef CGAL_HDS_ #endif // CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYHEDRON_3_H