OutputIterator adjacent_vertices_V2(const Polyhedron& g, vertex_descriptor vd, OutputIterator out) { halfedge_around_target_iterator hi, he; for(boost::tie(hi, he) = halfedges_around_target(halfedge(vd,g),g); hi != he; ++hi) { *out++ = source(*hi,g); } return out; }
int main(int, char** argv) { LCC lcc; CGAL::read_off(argv[1], lcc); GraphTraits::vertex_descriptor vd = *(vertices(lcc).first); typedef boost::transform_iterator<Source<LCC>,halfedge_around_target_iterator> adjacent_vertex_iterator; halfedge_around_target_iterator hb,he; boost::tie(hb,he) = halfedges_around_target(halfedge(vd,lcc),lcc); adjacent_vertex_iterator avib, avie; avib = boost::make_transform_iterator(hb, Source<LCC>(lcc)); avie = boost::make_transform_iterator(he, Source<LCC>(lcc)); std::list<vertex_descriptor> V; std::copy(avib,avie, std::back_inserter(V)); return 0; }
int main(int argc, char** argv) { std::ifstream in((argc>1)?argv[1]:"cube.off"); Polyhedron P; in >> P; GraphTraits::vertex_descriptor vd = *(vertices(P).first); typedef boost::transform_iterator<Source<Polyhedron>,halfedge_around_target_iterator> adjacent_vertex_iterator; halfedge_around_target_iterator hb,he; boost::tie(hb,he) = halfedges_around_target(halfedge(vd,P),P); adjacent_vertex_iterator avib, avie; avib = boost::make_transform_iterator(hb, Source<Polyhedron>(P)); avie = boost::make_transform_iterator(he, Source<Polyhedron>(P)); std::list<vertex_descriptor> V; std::copy(avib,avie, std::back_inserter(V)); return 0; }