diff --git a/BGL/doc/BGL/PackageDescription.txt b/BGL/doc/BGL/PackageDescription.txt index c91bfc073ce..0e294531172 100644 --- a/BGL/doc/BGL/PackageDescription.txt +++ b/BGL/doc/BGL/PackageDescription.txt @@ -215,6 +215,9 @@ for conversion between models of different `FaceGraph` concepts, etc. Most functions are in the header file `` */ +/// \defgroup PkgBGLIOFct I/O Functions +/// \ingroup PkgBGL + /*! \addtogroup PkgBGLIterators @@ -401,12 +404,18 @@ user might encounter. - `CGAL::convert_nef_polyhedron_to_polygon_mesh()` - `CGAL::split_graph_into_polylines()` + ## Graph Adaptors ## - `CGAL::Dual` - `CGAL::Face_filtered_graph` - `CGAL::Graph_with_descriptor_with_graph` - `CGAL::Graph_with_descriptor_with_graph_property_map` - `CGAL::Seam_mesh` + +## I/O Functions ## +- `CGAL::read_off()` +- `CGAL::write_off()` + */ /*! diff --git a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h index cee9d776171..a5d8517940d 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h @@ -208,6 +208,15 @@ degree(typename boost::graph_traits >::vertex return sm.valence(v); } + +template +typename boost::graph_traits >::degree_size_type +degree(typename boost::graph_traits >::face_descriptor f, + const OpenMesh::PolyMesh_ArrayKernelT& sm) +{ + return sm.valence(f); +} + template typename boost::graph_traits >::degree_size_type diff --git a/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h b/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h index 657a93ea1ba..7f0c3dab3b0 100644 --- a/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h +++ b/BGL/include/CGAL/boost/graph/graph_traits_TriMesh_ArrayKernelT.h @@ -136,6 +136,15 @@ degree(typename boost::graph_traits >::vertex_ return sm.valence(v); } + +template +typename boost::graph_traits >::degree_size_type +degree(typename boost::graph_traits >::face_descriptor f, + const OpenMesh::TriMesh_ArrayKernelT& sm) +{ + return 3; +} + template typename boost::graph_traits >::degree_size_type diff --git a/BGL/test/BGL/CMakeLists.txt b/BGL/test/BGL/CMakeLists.txt index f3cb7f17e65..3ab0bb843f4 100644 --- a/BGL/test/BGL/CMakeLists.txt +++ b/BGL/test/BGL/CMakeLists.txt @@ -89,6 +89,8 @@ create_single_source_cgal_program( "test_Has_member_id.cpp" ) create_single_source_cgal_program( "test_cgal_bgl_named_params.cpp" ) +create_single_source_cgal_program( "test_bgl_read_write.cpp" ) + create_single_source_cgal_program( "graph_concept_Face_filtered_graph.cpp" ) create_single_source_cgal_program( "test_Face_filtered_graph.cpp" ) diff --git a/BGL/test/BGL/data/prim.off b/BGL/test/BGL/data/prim.off new file mode 100644 index 00000000000..da9ee71038c --- /dev/null +++ b/BGL/test/BGL/data/prim.off @@ -0,0 +1,24 @@ +OFF +11 7 0 +# vertices + -1 -1 1 + -1 1 1 + 1 1 1 + 1 -1 1 + -1 -1 -1 + -1 1 -1 + 1 1 -1 + 1 -1 -1 + 2 2 2 + 3 2 2 + 3 3 3 + +# facets + 3 3 2 1 + 3 3 1 0 + 4 0 1 5 4 + 4 6 5 1 2 + 4 3 7 6 2 + 4 4 7 3 0 + 4 4 5 6 7 + 3 8 9 10 diff --git a/BGL/test/BGL/test_bgl_read_write.cpp b/BGL/test/BGL/test_bgl_read_write.cpp new file mode 100644 index 00000000000..dcf1c257e4b --- /dev/null +++ b/BGL/test/BGL/test_bgl_read_write.cpp @@ -0,0 +1,23 @@ +#include +#include +#include + +#include +#include + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point; +typedef CGAL::Surface_mesh Mesh; + + +int main(int argc, char* argv[]) +{ + Mesh sm; + std::ifstream in((argc>1)?argv[1]:"data/prim.off"); + + CGAL::read_off(in,sm); + + CGAL::write_off(std::cout, sm); + + return 0; +} diff --git a/Polyhedron/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h b/Polyhedron/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h index 661ceada703..ea5b4fe8c1b 100644 --- a/Polyhedron/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h +++ b/Polyhedron/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h @@ -100,6 +100,14 @@ in_degree(typename boost::graph_traits< CGAL::Polyhedron_3 const>::v return v->vertex_degree(); } +template +typename boost::graph_traits< CGAL::Polyhedron_3 const>::degree_size_type +degree(typename boost::graph_traits< CGAL::Polyhedron_3 const>::face_descriptor f + , const CGAL::Polyhedron_3&) +{ + return f->facet_degree(); +} + template typename boost::graph_traits< CGAL::Polyhedron_3 const>::vertex_descriptor source(typename boost::graph_traits< CGAL::Polyhedron_3 const>::edge_descriptor e diff --git a/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h b/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h index df181424ec7..974a29dd34e 100644 --- a/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h +++ b/Surface_mesh/include/CGAL/boost/graph/graph_traits_Surface_mesh.h @@ -127,6 +127,15 @@ degree(typename boost::graph_traits >::vertex_descriptor v return sm.degree(v); } + +template +typename boost::graph_traits >::degree_size_type +degree(typename boost::graph_traits >::face_descriptor f, + const CGAL::Surface_mesh

& sm) +{ + return sm.degree(f); +} + template typename boost::graph_traits >::degree_size_type