HEX_GRID_DATASET is a C++ program which creates a dataset of points on a hexagonal grid.
The user specifies just a few quantities:
This is all it takes to define the grid. Note that the points (X1,Y1) and (X2,Y1) will be grid points, but generally the grid will not quite reach (X1,Y2) and (X2,Y2).
Once the dataset is defined and computed, it is written to a file. The user may then construct another dataset, or terminate the program.
Here is some more information on the construction of the grid:
The hexagonal grid is defined on a coordinate box whose lower left corner is (X1,Y1) and whose upper right corner is (X2,Y2).
All nodes of the grid lie on one of LAYERS horizontal lines. The first of these lines is the line from (X1,Y1) to (X2,Y1). Each successive line is a distance HY units higher.
On all the odd numbered lines, there are NODES_PER_LAYER points, equally spaced from X1 to X2, with a spacing of HX.
On the even numbered lines, there are NODES_PER_LAYER-1 points, whose values are the midpoints of successive intervals on an odd numbered line. (The grid is staggered).
In order to maintain the hexagonal structure, the following relationship is required between HX and HY:
HY = HX * sqrt ( 3 ) / 2.
Here is an image of a hexagonal grid with NODES_PER_ROW = 21 and LAYERS = 24, and a total of N = 492 nodes.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
HEX_GRID_DATASET is available in a C++ version and a FORTRAN90 version and a MATLAB version.
FAURE_DATASET, a C++ program which creates a Faure quasirandom dataset;
GRID_DATASET, a C++ program which creates a grid sequence and writes it to a file.
HEX_GRID, a C++ library which supplies the computational routines used by HEX_GRID_DATASET.
HEX_GRID, a dataset directory which contains examples of hexagonal grids created by HEX_GRID_DATASET.
HEX_GRID_ANGLE, a FORTRAN90 library which computes elements of an angled hexagonal grid dataset.
LATIN_CENTER_DATASET, a C++ program which creates a Latin Center Hypercube dataset;
LATIN_EDGE_DATASET, a C++ program which creates a Latin Edge Hypercube dataset;
LATIN_RANDOM_DATASET, a C++ program which creates a Latin Random Hypercube dataset;
NIEDERREITER2_DATASET, a C++ program which creates a Niederreiter quasirandom dataset with base 2;
NORMAL_DATASET, a C++ program which generates a dataset of multivariate normal pseudorandom values and writes them to a file.
SOBOL_DATASET, a C++ program which computes a Sobol quasirandom sequence and writes it to a file.
UNIFORM_DATASET, a C++ program which generates a dataset of uniform pseudorandom values and writes them to a file.
VAN_DER_CORPUT_DATASET, a C++ program which creates a van der Corput quasirandom sequence and writes it to a file.
You can go up one level to the C++ source codes.