mirror of https://github.com/CGAL/cgal
remove useless code and add assertions
This commit is contained in:
parent
b4343e730b
commit
93cf5f4845
|
|
@ -35,16 +35,17 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
std::ifstream in((argc>1)?argv[1]:"cube.off");
|
std::ifstream in((argc>1)?argv[1]:"cube.off");
|
||||||
in >> S;
|
in >> S;
|
||||||
|
assert( CGAL::is_valid_polygon_mesh(S) );
|
||||||
|
|
||||||
// Note that the vertex_point property of the Source and Target1
|
// Note that the vertex_point property of the Source and Target1
|
||||||
// come from different kernels.
|
// come from different kernels.
|
||||||
typedef CGAL::Surface_mesh<Point> Target1;
|
typedef CGAL::Surface_mesh<Point> Target1;
|
||||||
Target1 T1;
|
Target1 T1;
|
||||||
{
|
CGAL::copy_face_graph(S, T1);
|
||||||
CGAL::copy_face_graph(S, T1);
|
assert( CGAL::is_valid_polygon_mesh(T1) );
|
||||||
std::ofstream out("sm.off");
|
assert( vertices(S).size()==vertices(T1).size() );
|
||||||
out << T1;
|
assert( halfedges(S).size()==halfedges(T1).size() );
|
||||||
}
|
assert( faces(S).size()==faces(T1).size() );
|
||||||
|
|
||||||
#if defined(CGAL_USE_OPENMESH)
|
#if defined(CGAL_USE_OPENMESH)
|
||||||
typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Target2;
|
typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Target2;
|
||||||
|
|
@ -62,7 +63,13 @@ int main(int argc, char* argv[])
|
||||||
CGAL::copy_face_graph(S, T2, CGAL::parameters::vertex_to_vertex_output_iterator(std::inserter(v2v, v2v.end()))
|
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()))
|
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))
|
||||||
.face_to_face_output_iterator(std::inserter(f2f, f2f.end())));
|
.face_to_face_output_iterator(std::inserter(f2f, f2f.end())));
|
||||||
OpenMesh::IO::write_mesh(T2, "om.off");
|
assert( CGAL::is_valid_polygon_mesh(T2) );
|
||||||
|
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
|
#endif
|
||||||
S.clear();
|
S.clear();
|
||||||
|
|
@ -79,11 +86,14 @@ int main(int argc, char* argv[])
|
||||||
boost::unordered_map<source_vertex_descriptor, tm_vertex_descriptor> v2v;
|
boost::unordered_map<source_vertex_descriptor, tm_vertex_descriptor> v2v;
|
||||||
boost::unordered_map<source_halfedge_descriptor, tm_halfedge_descriptor> h2h;
|
boost::unordered_map<source_halfedge_descriptor, tm_halfedge_descriptor> h2h;
|
||||||
boost::unordered_map<source_face_descriptor, tm_face_descriptor> f2f;
|
boost::unordered_map<source_face_descriptor, tm_face_descriptor> f2f;
|
||||||
std::ofstream out("reverse.off");
|
|
||||||
out << S;
|
|
||||||
CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_map(boost::make_assoc_property_map(v2v))
|
CGAL::copy_face_graph(T1, S, CGAL::parameters::vertex_to_vertex_map(boost::make_assoc_property_map(v2v))
|
||||||
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))
|
.halfedge_to_halfedge_output_iterator(std::inserter(h2h, h2h.end()))
|
||||||
.face_to_face_map(boost::make_assoc_property_map(f2f)));
|
.face_to_face_map(boost::make_assoc_property_map(f2f)));
|
||||||
|
|
||||||
|
assert( CGAL::is_valid_polygon_mesh(S) );
|
||||||
|
assert( vertices(S).size()==vertices(T1).size() );
|
||||||
|
assert( halfedges(S).size()==halfedges(T1).size() );
|
||||||
|
assert( faces(S).size()==faces(T1).size() );
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue