int main()
{
  std::vector<Point> points;
  points.push_back(Point(0,0));
  points.push_back(Point(1,0));
  points.push_back(Point(0,1));
  points.push_back(Point(4,10));
  points.push_back(Point(2,2));
  points.push_back(Point(-1,0));

  
  Delaunay T;
  T.insert( boost::make_transform_iterator(points.begin(),Auto_count()),
            boost::make_transform_iterator(points.end(),  Auto_count() )  );

  CGAL_assertion( T.number_of_vertices() == 6 );
  
  // check that the info was correctly set.
  Delaunay::Finite_vertices_iterator vit;
  for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)
    if( points[ vit->info() ] != vit->point() ){
      std::cerr << "Error different info" << std::endl;
      exit(EXIT_FAILURE);
    }
  std::cout << "OK" << std::endl;
  
  return 0;
}
예제 #2
0
파일: B2.cpp 프로젝트: piotrmwojcik/AA
void addNearest(Delaunay &T)
{
      Delaunay::Finite_vertices_iterator vit;

    for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end();++vit)
    {
    
        Delaunay::Vertex_circulator vit2, done;
        std::vector <Vertex_handle> L;
        vit2 = vit->incident_vertices();
        done = vit2;
        do {
            if (T.is_infinite(vit2)) continue;
            std::stringstream ss1, ss2;
            int a, b;

            ss1 << vit->info();
            ss2 << vit2->info();


            ss1 >> a; ss2 >> b;

            if (b == a) continue;

           G[a].push_back(b);

        } while (++vit2 != done);


    }

}