RBOX
Pointsets for Computational Geometry Tests


RBOX is a C program which generates a set of points in a region, selected at random according to a given distribution.

These pointsets can be used as test input to computational geometry programs that determine convex hulls, Delaunay triangulations, Voronoi Diagrams, nearest neighbors, or other such tasks. In fact, RBOX is was written to generate test data for the QHULL program.

By default, the points are generated in a cube each of whose coordinates ranges from -0.5 to 0.5.

RBOX is invoked as a one line command, with an extensive list of arguments, separated by spaces. These arguments include

3000
the number of points to generate (3000 is just an example);
Bn
Bounding box coordinates. The default is 0.5.
c
add a unit cube to the output;
c Gm
add a cube of "radius" m to the output;
D3
the dimension of the space (D3 requests 3 dimensions);
d
add a unit diamond to the output;
d Gm
add a diamond of "radius" m to the output;
h
Output as homogeneous coordinates for cdd.
Ln
lens distribution of radius n. May be used with 's', 'r', 'G', 'W'.
l
generate a regular spiral (available only in 3D);
Mn,m
lattice rigidly rotated by [n,-m,0],[m,n,0],[0,0,sqrt(m^2+n^2)].
Mn,m,r
lattice rotated by [n,-m,0],[m,n,0],[0,0,r]. "27 M1,0,1" is {0,1,2} x {0,1,2} x {0,1,2}.
n
Do not include the command line in the first line of the output file.
On
Offset the data, by adding n to each coordinate.
Pn,m,r
add point [n,m,r] to the output first; pad coordinates with 0 ;
r
generate a regular polygon;
r s D2
generate a regular polygon;
r s Z1 G0.1
generates a regular cone;
s
generate cospherical points (generate randomly in a cube, then project onto a sphere);
t
Use the current time in seconds as the random number seed.
tn
Use n as the random number seed
W0.1
random distribution within 0.1 of the cube or sphere's surface.
x
generate random points in a simplex. (r or W commands may be used);
y
same as 'x', but include the simplex vertices as well;
Zn s
restrict points to a disk around the Z axis, and the sphere of radius n.
Zn s Gm
restrict points to a disk around the Z axis, and the sphere of radius n, within a gap of m.
Zn Gm s
restrict points to a disk around the Z axis, and the sphere of radius n, with an empty center(?).
z
Generate points with integer coordinates. Use the Bn command to change the default range of 1,000,000.

Examples:

rbox 10
10 points in the unit cube centered at the origin;
rbox 10 s D2
10 points on the unit circle;
rbox 100 W0
100 points on the surface of the unit cube;
rbox 1000 s D4
1000 points on a 4D sphere;
rbox c D5 O0.5
a 5D hypercube with one corner at the origin;
rbox d D10
a diamond in 10D;
rbox x 1000 r W0
1000 points on the surface of a simplex;
rbox y D12
a 12D simplex;
rbox l 10
10 points along a spiral;
rbox l 10 r
10 regular points along a spiral, plus the two end points.
rbox 1000 L10000 D4 s
1000 random points on the surface of a narrow lens;
rbox 1000 L100000 s G0.000001
1000 points near the edge of a narrow lens;
rbox c G2 d G3
a cube of radius 2, and a diamond of radius 3;
rbox 64 M3,4 z
a rotated {0,1,2,3} x {0,1,2,3} x {0,1,2,3} lattice of integer points;
rbox P0 P0 P0 P0 P0
5 copies of the origin in 3D;
rbox 100 s Z1 G0.1
two cospherical 100-gons, plus another cospherical point;
rbox 100 s Z1
a cone of points;
rbox 100 s Z0.0000001
a narrow cone of points, with many precision errors;

The format of the output file is as follows:

Each following line gives the coordinates for the next point.

Languages:

RBOX is available in a C version.

Related Data and Programs:

DISCRETE_PDF_SAMPLE_2D, a C program which demonstrates how to construct a Probability Density Function (PDF) from a table of sample data, and then to use that PDF to create new samples.

NORMAL, a C library which computes elements of a sequence of pseudorandom normally distributed values.

QVORONOI, a C program which computes the Voronoi diagram of a set of points; RBOX can be used to generate test input data for this program.

RANDOM_DATA, a C program which produces random data from a number of regions.

RSITES, a C++ program which produces random data in an M-dimensional box.

UNIFORM, a C library which samples the uniform random distribution.

ZIGGURAT, a C library which computes elements of uniform, normal or exponential pseudorandom sequence using the ziggurat method.

References:

  1. Bradford Barber, David Dobkin, Hannu Huhdanpaa,
    The Quickhull algorithm for convex hulls,
    ACM Transactions on Mathematical Software,
    December 1996.

Source Code:

You can go up one level to the C source codes.


Last revised on 27 February 2014.