SQUARE_HEX_GRID
Routines for a Hexagonal Grid


SQUARE_HEX_GRID is a C++ library which computes a hexagonal grid of points over the interior of a square in 2D.

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.
      

Licensing:

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

Languages:

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

Related Data and Programs:

BALL_GRID, a C++ library which computes a grid of points over the interior of a ball in 3D.

CIRCLE_ARC_GRID, a C++ program which computes points equally spaced along a circular arc;

CUBE_GRID, a C++ library which computes a grid of points over the interior of a cube in 3D.

DISK_GRID, a C++ library which computes a grid of points over the interior of a disk in 2D.

ELLIPSE_GRID, a C++ library which computes a grid of points over the interior of an ellipse in 2D.

ELLIPSOID_GRID, a C++ library which computes a grid of points over the interior of an ellipsoid in 3D.

HYPERCUBE_GRID, a C++ library which computes a grid of points over the interior of a hypercube in M dimensions.

LINE_GRID, a C++ library which computes a grid of points over the interior of a line segment in 1D.

POLYGON_GRID, a C++ library which generates a grid of points over the interior of a polygon in 2D.

PYRAMID_GRID, a C++ library which computes a grid of points over the interior of the unit pyramid in 3D;

SIMPLEX_GRID, a C++ library which generates a regular grid of points over the interior of an arbitrary simplex in M dimensions.

SPHERE_FIBONACCI_GRID, a C++ library which uses a Fibonacci spiral to create a grid of points on the surface of the unit sphere in 3D.

SPHERE_GRID, a C++ library which provides a number of ways of generating grids of points, or of points and lines, or of points and lines and faces, on the surface of the unit sphere in 3D.

SPHERE_LLQ_GRID, a C++ library which uses longitudes and latitudes to create grids of points, lines, and quadrilaterals on the surface of the unit sphere in 3D.

SPHERE_LLT_GRID, a C++ library which uses longitudes and latitudes to create grids of points, lines, and triangles on the surface of the unit sphere in 3D.

SQUARE_GRID, a C++ library which computes a grid of points over the interior of a square in 2D.

TETRAHEDRON_GRID, a C++ library which computes a grid of points over the interior of a tetrahedron in 3D.

TRIANGLE_GRID, a C++ library which computes a grid of points over the interior of a triangle in 2D.

WEDGE_GRID, a C++ library which computes a grid of points over the interior of the unit wedge in 3D.

Source Code:

Examples and Tests:

Note that many text and graphics files are created by the calling program, but these are stored in the SQUARE_HEX_GRID datasets directory.

List of Routines:

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


Last revised on 30 August 2014.