Name
poisson - random 2d poisson point generator
Synopsis
poisson [options]
Description
poisson generates random points on a 2d plane with a Pois-
son law distribution. The idea is to generate random
points with an homogeneous distribution within the rectan-
gle. The algorithm is simple: points are generated ran-
domly within the given limits, points are rejected if they
are too close to any previously generated point. Once the
requested number of points has been generated, output the
point coordinates to stdout.
The minimum distance between points is computed by the
following formula:
If the requested rectangle has a width of L and a height
of h, and n points are requested, we have:
dmin = sqrt(L*h / 2*n)
Options
-d Use the default settings for point generation. The
default rectangle is located between -50 and +50 in
x and y, points are generated with integer coordi-
nate values, and 20 points will be generated.
-r xmin xmax ymin ymax
Defines the rectangle in which points will be gen-
erated. Ranges may be given as integer or floating-
point values.
-f Generate floating-point valued coordinates (default
is integer).
-n Change the number of points to generate. Default is
20.
Bugs
This is the simplest possible implementation of a Poisson
generator. As a result, trying to generate a high number
of points (>500) will require a very intensive random
point generation before having all the requested points.
Another approach would be to generate random points only
within an allowed surface, but this is far from trivial.