#include #include #include #include #include #include #include typedef CGAL::Simple_cartesian Kernel; typedef Kernel::Point_3 Point; typedef CGAL::Surface_mesh Mesh; typedef CGAL::Dual Dual; typedef boost::graph_traits::vertex_descriptor vertex_descriptor; typedef boost::graph_traits::face_descriptor face_descriptor; typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; int main(int, char* argv[]) { Mesh sm; std::ifstream in(argv[1]); in >> sm; Dual dsm(sm); std::cout << num_vertices(dsm) << std::endl; typedef boost::graph_traits::vertex_descriptor Dvertex_descriptor; // is a face BOOST_FOREACH(Dvertex_descriptor dvd , vertices(dsm)){ std::cout << dvd << std::endl; } BOOST_FOREACH(halfedge_descriptor h , halfedges(dsm)){ std::cout << h << " " << source(h,sm) << " " << source(h,dsm) << std::endl; } Mesh::Property_map ccmap; ccmap = sm.add_property_map("f:CC").first; int num = connected_components(dsm, ccmap); BOOST_FOREACH(face_descriptor f , faces(sm)){ std::cout << f << "in connected component " << ccmap[f] << std::endl; } #if 0 Mesh::Property_map predecessor; predecessor = P.add_property_map("v:predecessor").first; boost::prim_minimum_spanning_tree(P, predecessor, boost::root_vertex(*vertices(P).first)); std::cout << "#VRML V2.0 utf8\n" "DirectionalLight {\n" "direction 0 -1 0\n" "}\n" "Shape {\n" " appearance Appearance {\n" " material Material { emissiveColor 1 0 0}}\n" " geometry\n" " IndexedLineSet {\n" " coord Coordinate {\n" " point [ \n"; BOOST_FOREACH(vertex_descriptor vd, vertices(P)){ std::cout << " " << P.point(vd) << "\n"; } std::cout << " ]\n" " }\n" " coordIndex [\n"; BOOST_FOREACH(vertex_descriptor vd, vertices(P)){ if(predecessor[vd]!=vd){ std::cout << " " << std::size_t(vd) << ", " << std::size_t(predecessor[vd]) << ", -1\n"; } } std::cout << "]\n" " }#IndexedLineSet\n" "}# Shape\n"; P.remove_property_map(predecessor); #endif return 0; }