HEX_GRID
Routines for a Hexagonal Grid


HEX_GRID is a MATLAB library which computes points on a hexagonal grid.

For one set of routines, the hexagonal grid is defined in the unit square [0,1] x [0,1]. For a matching set of routines, the hexagonal grid is defined on a coordinate box [A,B] x [C,D].

All nodes of the grid lie on one of LAYERS horizontal lines. The first of these lines is the X axis (for grids in the unit square) or the line from (A,C) to (B,C), for grids in a coordinate box. Each successive line is HY units higher.

On all the odd numbered lines, there are NODES_PER_LAYER points, equally spaced from 0 to 1 or A to B, 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.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

HEX_GRID is available in a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

BALL_GRID, a MATLAB library which computes grid points that lie inside a ball.

CIRCLE_GRID, a MATLAB library which computes grid points that lie inside a circle.

ELLIPSE_GRID, a MATLAB library which computes grid points that lie inside an ellipse.

ELLIPSOID_GRID, a MATLAB library which computes grid points that lie inside a 3D ellipsoid.

GRID, a MATLAB program which computes elements of a grid dataset.

HALTON, a MATLAB program which computes elements of a Halton quasirandom sequence.

HAMMERSLEY, a MATLAB program which computes elements of a Hammersley quasirandom sequence.

HEX_GRID, a dataset collection which contains examples of hexagonal grids.

HEX_GRID_ANGLE, a FORTRAN90 library which computes elements of an angled hexagonal grid dataset.

HEX_GRID_DATASET, a MATLAB program which can create a hex grid dataset and write it to a file.

HEX_GRID_TRIANGULATE, a FORTRAN90 program which uses the HEX_GRID library and finds points on a hex grid that lie within a given arbitrary region.

IHS, a MATLAB program which computes elements of an improved distributed Latin hypercube dataset.

LATIN_CENTER, a MATLAB program which computes elements of a Latin Hypercube dataset, choosing center points.

LATIN_EDGE, a MATLAB program which computes elements of a Latin Hypercube dataset, choosing edge points.

LATIN_RANDOM, a MATLAB program which computes elements of a Latin Hypercube dataset, choosing points at random.

LATTICE_RULE, a MATLAB library which approximates multidimensional integrals using lattice rules.

LCVT, a MATLAB program which computes a latinized Centroidal Voronoi Tessellation.

NIEDERREITER2, a MATLAB program which computes elements of a Niederreiter quasirandom sequence with base 2.

SOBOL, a MATLAB program which computes elements of a Sobol quasirandom sequence.

TETRAHEDRON_GRID, a MATLAB library which computes a tetrahedral grid of points.

UNIFORM, a MATLAB program which computes elements of a uniform pseudorandom sequence.

VAN_DER_CORPUT, a MATLAB program which computes elements of a van der Corput quasirandom sequence.

Source Code:

Examples and Tests:

You may copy grid files defined for the unit square [0,1] x [0,1]:

You may copy grid files defined for the coordinate box [1,4] x [2,7]:

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


Last revised on 19 October 2005.