Ejemplo n.º 1
0
int main(int argc, char **argv)
{
   std::cout << "Starting\n";

   std::ifstream in (argc == 1 ? "data/moebius.cin" : argv[1]);
   std::istream_iterator<Gt::Point_2> start (in);
   std::istream_iterator<Gt::Point_2> stop;

   std::cout << "File opened\n";

   M dia;

   std::cout << "Created\n";

   int n = dia.init (start, stop);

   std::cout << "Initialized " << n << std::endl;

   Rt rt (dia.rt ());

   std::cout << "Copied\n";

   rt.is_valid ();

   std::cout << "Validated\n";

   dia.build ();

   std::cout << "Built\n";

   return 0;
}
Ejemplo n.º 2
0
int main()
{
  // generate points on a 3D grid
  std::vector<Weighted_point> P;

  int number_of_points = 0;

  for (int z=0 ; z<5 ; z++)
    for (int y=0 ; y<5 ; y++)
      for (int x=0 ; x<5 ; x++) {
	  Point p(x, y, z);
          Weight w = (x+y-z*y*x)*2.0; // let's say this is the weight.
	  P.push_back(Weighted_point(p, w));
          ++number_of_points;
      }

  Rt T;

  // insert all points in a row (this is faster than one insert() at a time).
  T.insert (P.begin(), P.end());

  assert( T.is_valid() );
  assert( T.dimension() == 3 );

  std::cout << "Number of vertices : " << T.number_of_vertices() << std::endl;

  // removal of all vertices
  int count = 0;
  while (T.number_of_vertices() > 0) {
      T.remove (T.finite_vertices_begin());
      ++count;
  }

  assert( count == number_of_points );

  return 0;
}