#include "cmdopt.hpp" #include "geom/sample.hpp" #include "geom/aabb.hpp" #include #include #include template class util::geom::surface::sampler> { public: sampler (util::extent _target): target (_target) { ; } template util::point operator() (GeneratorT &&gen) const noexcept { util::point p; for (size_t i = 0; i < S; ++i) p[i] = std::uniform_real_distribution (0, target[i]) (gen); return p; } private: util::extent target; }; /////////////////////////////////////////////////////////////////////////////// int main (int argc, char **argv) { util::extent2f area {256, 256}; float distance = 5.f; int samples = 15; util::cmdopt::parser opts; opts.add> ('w', "width", "width of the space to fill", area.w); opts.add> ('h', "height", "height of the space to fill", area.h); opts.add> ('d', "distance", "minimum distance between samples", distance); opts.add> ('s', "samples", "number of samples per iteration", samples); opts.scan (argc, argv); std::cout << ""; for (auto p: util::geom::surface::poisson (util::geom::surface::sampler (area), std::default_random_engine (), distance, samples)) { std::cout << ""; } std::cout << "\n"; return EXIT_SUCCESS; }