HEX_GRID_DATASET is a FORTRAN90 program, using double precision arithmetic, which allows the user to interactively create 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.
HEX_GRID is a FORTRAN90 library which computes elements of a hexagonal grid dataset.
HEX_GRID_ANGLE is a FORTRAN90 library which computes elements of an angled hexagonal grid dataset.
HEX_GRID_DATASET is also available in a C++ version and a MATLAB version.
TABLE is a file format which can be used to store real or integer arrays.
TABLE_DISCREPANCY is a C++ program which reads a TABLE file of points (presumed to lie in the unit hypercube) and computes bounds on the star discrepancy, a measure of dispersion.
You can go up one level to the FORTRAN90 source codes.