mirror of https://github.com/CGAL/cgal
Add generic functions read_off() and write_off()
This commit is contained in:
parent
f5d9742557
commit
3e3c33bcf0
|
|
@ -215,6 +215,9 @@ for conversion between models of different `FaceGraph` concepts, etc.
|
||||||
Most functions are in the header file `<CGAL/boost/graph/helpers.h>`
|
Most functions are in the header file `<CGAL/boost/graph/helpers.h>`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/// \defgroup PkgBGLIOFct I/O Functions
|
||||||
|
/// \ingroup PkgBGL
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\addtogroup PkgBGLIterators
|
\addtogroup PkgBGLIterators
|
||||||
|
|
||||||
|
|
@ -401,12 +404,18 @@ user might encounter.
|
||||||
- `CGAL::convert_nef_polyhedron_to_polygon_mesh()`
|
- `CGAL::convert_nef_polyhedron_to_polygon_mesh()`
|
||||||
- `CGAL::split_graph_into_polylines()`
|
- `CGAL::split_graph_into_polylines()`
|
||||||
|
|
||||||
|
|
||||||
## Graph Adaptors ##
|
## Graph Adaptors ##
|
||||||
- `CGAL::Dual`
|
- `CGAL::Dual`
|
||||||
- `CGAL::Face_filtered_graph`
|
- `CGAL::Face_filtered_graph`
|
||||||
- `CGAL::Graph_with_descriptor_with_graph`
|
- `CGAL::Graph_with_descriptor_with_graph`
|
||||||
- `CGAL::Graph_with_descriptor_with_graph_property_map`
|
- `CGAL::Graph_with_descriptor_with_graph_property_map`
|
||||||
- `CGAL::Seam_mesh`
|
- `CGAL::Seam_mesh`
|
||||||
|
|
||||||
|
## I/O Functions ##
|
||||||
|
- `CGAL::read_off()`
|
||||||
|
- `CGAL::write_off()`
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,15 @@ degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::vertex
|
||||||
return sm.valence(v);
|
return sm.valence(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename K>
|
||||||
|
typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
|
||||||
|
degree(typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::face_descriptor f,
|
||||||
|
const OpenMesh::PolyMesh_ArrayKernelT<K>& sm)
|
||||||
|
{
|
||||||
|
return sm.valence(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename K>
|
template <typename K>
|
||||||
typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
|
typename boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >::degree_size_type
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,15 @@ degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::vertex_
|
||||||
return sm.valence(v);
|
return sm.valence(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename K>
|
||||||
|
typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
|
||||||
|
degree(typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::face_descriptor f,
|
||||||
|
const OpenMesh::TriMesh_ArrayKernelT<K>& sm)
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename K>
|
template <typename K>
|
||||||
typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
|
typename boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >::degree_size_type
|
||||||
|
|
|
||||||
|
|
@ -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_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( "graph_concept_Face_filtered_graph.cpp" )
|
||||||
|
|
||||||
create_single_source_cgal_program( "test_Face_filtered_graph.cpp" )
|
create_single_source_cgal_program( "test_Face_filtered_graph.cpp" )
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
#include <CGAL/Simple_cartesian.h>
|
||||||
|
#include <CGAL/Surface_mesh.h>
|
||||||
|
#include <CGAL/boost/graph/io.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||||
|
typedef Kernel::Point_3 Point;
|
||||||
|
typedef CGAL::Surface_mesh<Point> 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;
|
||||||
|
}
|
||||||
|
|
@ -100,6 +100,14 @@ in_degree(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::v
|
||||||
return v->vertex_degree();
|
return v->vertex_degree();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
|
||||||
|
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::degree_size_type
|
||||||
|
degree(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::face_descriptor f
|
||||||
|
, const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
|
||||||
|
{
|
||||||
|
return f->facet_degree();
|
||||||
|
}
|
||||||
|
|
||||||
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
|
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
|
||||||
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor
|
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor
|
||||||
source(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_descriptor e
|
source(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_descriptor e
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,15 @@ degree(typename boost::graph_traits<CGAL::Surface_mesh<P> >::vertex_descriptor v
|
||||||
return sm.degree(v);
|
return sm.degree(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename P>
|
||||||
|
typename boost::graph_traits<CGAL::Surface_mesh<P> >::degree_size_type
|
||||||
|
degree(typename boost::graph_traits<CGAL::Surface_mesh<P> >::face_descriptor f,
|
||||||
|
const CGAL::Surface_mesh<P>& sm)
|
||||||
|
{
|
||||||
|
return sm.degree(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename P>
|
template <typename P>
|
||||||
typename boost::graph_traits<CGAL::Surface_mesh<P> >::degree_size_type
|
typename boost::graph_traits<CGAL::Surface_mesh<P> >::degree_size_type
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue