#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_polygon_2.h>
#include <CGAL/Random.h>
#include <CGAL/algorithm.h>
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz RT;
#else
#include <CGAL/double.h>
typedef double RT;
#endif
#include <fstream>
#include <list>
typedef K::Point_2 Point_2;
typedef CGAL::Polygon_2<K, Container> Polygon_2;
const double RADIUS = 100;
const int MAX_POLY_SIZE = 100;
int main()
{
Polygon_2 polygon;
std::list<Point_2> point_set;
std::cerr <<
"Seed = " << rand.
get_seed() << std::endl;
int size = rand.
get_int(4, MAX_POLY_SIZE);
CGAL::copy_n_unique(Point_generator(RADIUS), size,
std::back_inserter(point_set));
std::ostream_iterator< Point_2 > out( std::cout, " " );
std::cout << "From the following " << point_set.size() << " points "
<< std::endl;
std::copy(point_set.begin(), point_set.end(), out);
std::cout << std::endl;
point_set.begin());
std::cout << "The following simple polygon was made: " << std::endl;
std::cout << polygon << std::endl;
return 0;
}
The class Random_points_in_square_2 is an input iterator creating points uniformly distributed in a h...
Definition: point_generators_2.h:218
The class Random is a random numbers generator.
Definition: Random.h:33
unsigned int get_seed() const
returns the seed used for initialization.
int get_int(int lower, int upper)
returns a random int from the interval [lower,upper).
OutputIterator random_polygon_2(std::size_t n, OutputIterator result, const PointGenerator &pg, Traits t=Default_traits)
computes a random simple polygon by writing its vertices (oriented counterclockwise) to result.