#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#if defined(CGAL_USE_OPENMESH)
#include <OpenMesh/Core/IO/MeshIO.hh>
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
#endif
#include <CGAL/boost/graph/copy_face_graph.h>
#include <iostream>
#include <fstream>
#include <iterator>
#include <unordered_map>
typedef boost::graph_traits<Source>::vertex_descriptor sm_vertex_descriptor;
typedef boost::graph_traits<Source>::halfedge_descriptor sm_halfedge_descriptor;
typedef boost::graph_traits<Source>::face_descriptor sm_face_descriptor;
typedef Other_kernel::Point_3 Point;
int main(int argc, char* argv[])
{
Source S;
in >> S;
Target1 T1;
assert( vertices(S).size()==vertices(T1).size() );
assert( halfedges(S).size()==halfedges(T1).size() );
assert( faces(S).size()==faces(T1).size() );
#if defined(CGAL_USE_OPENMESH)
typedef OpenMesh::PolyMesh_ArrayKernelT<> Target2;
Target2 T2;
{
typedef boost::graph_traits<Target2>::vertex_descriptor tm_vertex_descriptor;
typedef boost::graph_traits<Target2>::halfedge_descriptor tm_halfedge_descriptor;
typedef boost::graph_traits<Target2>::face_descriptor tm_face_descriptor;
std::unordered_map<sm_vertex_descriptor, tm_vertex_descriptor> v2v;
std::unordered_map<sm_halfedge_descriptor, tm_halfedge_descriptor> h2h;
std::unordered_map<sm_face_descriptor, tm_face_descriptor> f2f;
CGAL::copy_face_graph(S, T2, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end()))
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))
.face_to_face_output_iterator(std::inserter(f2f, f2f.end())));
assert( v2v.size()==vertices(T2).size() );
assert( h2h.size()==halfedges(T2).size() );
assert( f2f.size()==faces(T2).size() );
assert( vertices(S).size()==vertices(T2).size() );
assert( halfedges(S).size()==halfedges(T2).size() );
assert( faces(S).size()==faces(T2).size() );
}
#endif
S.clear();
{
typedef boost::graph_traits<Target1>::vertex_descriptor source_vertex_descriptor;
typedef boost::graph_traits<Target1>::halfedge_descriptor source_halfedge_descriptor;
typedef boost::graph_traits<Target1>::face_descriptor source_face_descriptor;
typedef boost::graph_traits<Source>::vertex_descriptor tm_vertex_descriptor;
typedef boost::graph_traits<Source>::halfedge_descriptor tm_halfedge_descriptor;
typedef boost::graph_traits<Source>::face_descriptor tm_face_descriptor;
std::unordered_map<source_vertex_descriptor, tm_vertex_descriptor> v2v;
std::unordered_map<source_halfedge_descriptor, tm_halfedge_descriptor> h2h;
std::unordered_map<source_face_descriptor, tm_face_descriptor> f2f;
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))
.face_to_face_map(boost::make_assoc_property_map(f2f)));
assert( vertices(S).size()==vertices(T1).size() );
assert( halfedges(S).size()==halfedges(T1).size() );
assert( faces(S).size()==faces(T1).size() );
}
return 0;
}
void copy_face_graph(const SourceMesh &sm, TargetMesh &tm, const NamedParameters1 &np1=parameters::default_values(), const NamedParameters2 &np2=parameters::default_values())
copies a source model of FaceListGraph into a target model of a FaceListGraph.
Definition: copy_face_graph.h:326
bool is_valid_polygon_mesh(const Mesh &g, bool verb=false)
checks the integrity of the mesh g.
Definition: helpers.h:530
std::string data_file_path(const std::string &filename)