#include namespace po = boost::program_options; #include #include #include #include #include #include using namespace CGAL; typedef Simple_cartesian K; typedef K::Point_2 Point; typedef Creator_uniform_2 Creator; void grid(int N, double eps) { CGAL::Random rng; std::cout << N*N << std::endl; for(double i = 0; i < N; i++){ for(double j = 0; j < N; j++){ std::cout << i + rng.get_double(-eps,eps) << " " << j + rng.get_double(-eps,eps) << "\n"; } } } int main(int argc, char* argv[]) { int N= 10; double eps = 0; try { po::options_description desc("Allowed options"); desc.add_options() ("help", "Generator of perturbed points on a grid") ("N", po::value(), "generate a grid with N x N points") ("eps", po::value(), "perturb x and y of points by eps") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if (vm.count("help")) { std::cout << desc << "\n"; return 1; } if (vm.count("N")) { N = vm["N"].as(); } if (vm.count("eps")) { eps = vm["eps"].as(); } } catch(std::exception& e) { std::cerr << "error: " << e.what() << "\n"; return 1; } grid(N,eps); return 0; }