int main( int argc, char *argv[] ) { if ( ! (( argc == 1 ) || (argc == 2)) ) { std::cout <<"usage: "<< argv[0] <<" [filename]\n"; } ifstream ifs( (argc == 1) ? "data/sitesx.cin" : argv[1] ); assert( ifs ); SDG2 sdg; SDG2::Site_2 site; while ( ifs >> site ) { sdg.insert( site ); } ifs.close(); assert( sdg.is_valid(true, 1) ); cout << endl << endl; // print the number of input and output sites cout << "# of input sites : " << sdg.number_of_input_sites() << endl; cout << "# of output sites: " << sdg.number_of_output_sites() << endl; unsigned int n_ipt(0), n_iseg(0), n_opt(0), n_oseg(0), n_ptx(0); // count the number of input points and input segments SDG2::Input_sites_iterator iit; for (iit = sdg.input_sites_begin(); iit != sdg.input_sites_end(); ++iit) { if ( iit->is_point() ) { n_ipt++; } else { n_iseg++; } } // count the number of output points and output segments, as well // as the number of points that are points of intersection of pairs // of strongly intersecting sites SDG2::Output_sites_iterator oit; for (oit = sdg.output_sites_begin(); oit != sdg.output_sites_end(); ++oit) { if ( oit->is_segment() ) { n_oseg++; } else { n_opt++; if ( !oit->is_input() ) { n_ptx++; } } } cout << endl << "# of input segments: " << n_iseg << endl; cout << "# of input points: " << n_ipt << endl << endl; cout << "# of output segments: " << n_oseg << endl; cout << "# of output points: " << n_opt << endl << endl; cout << "# of intersection points: " << n_ptx << endl; return 0; }
int main( int argc, char *argv[] ) { if ( ! (( argc == 1 ) || (argc == 2)) ) { std::cout <<"usage: "<< argv[0] <<" [filename]\n"; } std::ifstream ifs( (argc == 1) ? "data/sitesxx.cin" : argv[1] ); assert( ifs ); SDG2 sdg; Site_2 site; Generate_info generate; // read the sites and their info and insert them in the // segment Delaunay graph; print them as you read them std::cout << std::endl; std::cout << "Input sites:" << std::endl; std::cout << "------------" << std::endl; while ( ifs >> site ) { Info info = generate(site); std::cout << site << std::flush; std::cout << "\r\t\t\t" << info << std::endl; sdg.insert(site, info); } std::cout << std::endl; // validate the segment Delaunay graph assert( sdg.is_valid(true) ); // print the sites of the segment Delaunay graph and their info std::cout << std::endl; std::cout << "Output sites:" << std::endl; std::cout << "-------------" << std::endl; for (FVIT it = sdg.finite_vertices_begin(); it != sdg.finite_vertices_end(); ++it) { if ( it->site().is_point() ) { std::cout << it->site() << std::flush; std::cout << "\r\t\t\t" << it->storage_site().info() << std::endl; } } for (FVIT it = sdg.finite_vertices_begin(); it != sdg.finite_vertices_end(); ++it) { if ( it->site().is_segment() ) { std::cout << it->site() << std::flush; std::cout << "\r\t\t\t" << it->storage_site().info() << std::endl; } } std::cout << std::endl; return 0; }
int main( int argc, char *argv[] ) { if ( ! (( argc == 1 ) || (argc == 2)) ) { std::cout <<"usage: "<< argv[0] <<" [filename]\n"; } ifstream ifs( (argc == 1) ? "data/sites2.cin" : argv[1] ); assert( ifs ); SDG2 sdg; SDG2::Site_2 site; // read the sites from the stream and insert them in the diagram while ( ifs >> site ) { sdg.insert( site ); CGAL_SDG_DEBUG( sdg.file_output_verbose(std::cout); ); CGAL_assertion( sdg.is_valid(false, 1) ); }
int main() { std::ifstream ifs("data/sites.cin"); assert( ifs ); SDG2 sdg; SDG2::Site_2 site; // read the sites and insert them in the segment Delaunay graph while ( ifs >> site ) { sdg.insert(site); } // validate the segment Delaunay graph assert( sdg.is_valid(true, 1) ); return 0; }
int main() { std::ifstream ifs("data/sitesxx.rb.cin"); assert( ifs ); SDG2 sdg; Site_2 site; // read the sites and their info and insert them in the // segment Delaunay graph; print them as you read them std::cout << std::endl; std::cout << "Input sites:" << std::endl; std::cout << "------------" << std::endl; while ( ifs >> site ) { char c; ifs >> c; Red_blue info = (c == 'r') ? RED : BLUE; std::cout << site << std::flush; std::cout << "\r\t\t\t" << info << std::endl; sdg.insert(site, info); } std::cout << std::endl; // validate the segment Delaunay graph assert( sdg.is_valid(true, 1) ); // print the sites of the segment Delaunay graph and their info std::cout << std::endl << std::endl; std::cout << "Output sites:" << std::endl; std::cout << "-------------" << std::endl; for (FVIT it = sdg.finite_vertices_begin(); it != sdg.finite_vertices_end(); ++it) { std::cout << it->site() << std::flush; std::cout << "\r\t\t\t" << it->storage_site().info() << std::endl; } std::cout << std::endl; return 0; }
int main( int argc, char *argv[] ) { if ( ! (( argc == 1 ) || (argc == 2)) ) { std::cout <<"usage: "<< argv[0] <<" [filename]\n"; } std::ifstream ifs( (argc == 1) ? "data/sites.cin" : argv[1] ); assert( ifs ); SDG2 sdg; SDG2::Site_2 site; // read the sites and insert them in the segment Delaunay graph while ( ifs >> site ) { sdg.insert(site); } // validate the segment Delaunay graph assert( sdg.is_valid(true, 1) ); return 0; }
int main() { std::ifstream ifs("data/sites.cin"); assert( ifs ); SDG2 sdg; SDG2::Site_2 site; std::vector<SDG2::Site_2> sites; // read the sites while ( ifs >> site ) { sites.push_back(site); } //insert the sites all at once using spatial sorting to speed the insertion sdg.insert( sites.begin(), sites.end(),CGAL::Tag_true() ); // validate the segment Delaunay graph assert( sdg.is_valid(true, 1) ); return 0; }