hex_grid_angle


hex_grid_angle a Fortran90 code which produces a hexagonal grid of points in the unit square or an arbitrary box, allowing the user to specify an arbitrary center, angle, and grid density.

Specifically, the grid begins with a single point called CENTER, whose location in the unit square or box is specified by the user. The next "layer" of points is produced by stepping out H units in a user-specified direction ANGLE, and marking off points on the hexagon. Further layers of points are added until a layer is reached that lies entirely outside the region.

The code was developed to allow more flexibility than the HEX_GRID code provided. In particular, that code always starts the grid at the origin, always runs the first grid line along the X-axis, and always requires that the first grid line terminate exactly with at point at X = 1. By contrast, this code allows the user total freedom to specify the center, angle, and spacing of the hexagonal grid.

One reason for developing this code was to try to see whether you could always force 100 points of the hexagonal grid to fall into the unit square simply by choosing a spacing H that guaranteed that the Voronoi region around each point (also a hexagon) had an area of 1/100. We finally realized that this cannot be guaranteed, since the hexagonal and Cartesian coordinate systems are "incommensurable". They only match up asymptotically. So, even though we carefully chose the spacing H, it is only on average that we found 100 points in a unit square, but also found squares with 98, 99, or 104 points as well.

Moreover, it will not be possible to choose a hexagonal grid with the property that it is equivalent to the tessellation generated by the the intersection of the hexagonal grid with a single unit square.

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

hex_grid_angle is available in a Fortran90 version and a MATLAB version.

Related Data and Programs:

hex_grid_angle_test

cvt, a Fortran90 code which computes elements of a Centroidal Voronoi Tessellation.

faure, a Fortran90 code which computes elements of a Faure quasirandom sequence.

grid, a Fortran90 code which computes elements of a grid dataset.

halton, a Fortran90 code which computes elements of a Halton quasirandom sequence.

hammersley, a Fortran90 code which computes elements of a Hammersley quasirandom sequence.

hex_grid, a Fortran90 code which computes elements of a hexagonal grid dataset.

ihs, a Fortran90 code which computes elements of an improved distributed Latin hypercube dataset.

latin_center, a Fortran90 code which computes elements of a Latin Hypercube dataset, choosing center points.

latin_edge, a Fortran90 code which computes elements of a Latin Hypercube dataset, choosing edge points.

latin_random, a Fortran90 code which computes elements of a Latin Hypercube dataset, choosing points at random.

lattice_rule, a Fortran90 code which approximates multidimensional integrals using lattice rules.

lcvt, a Fortran90 code which computes a latinized Centroidal Voronoi Tessellation.

niederreiter2, a Fortran90 code which computes elements of a Niederreiter quasirandom sequence with base 2.

normal, a Fortran90 code which computes elements of a sequence of pseudorandom normally distributed values.

sobol, a Fortran90 code which computes elements of a Sobol quasirandom sequence.

triangle_grid, a Fortran90 code which computes a triangular grid of points.

uniform, a Fortran90 code which computes elements of a uniform pseudorandom sequence.

van_der_corput, a Fortran90 code which computes elements of a van der Corput quasirandom sequence.

Source Code:


Last revised on 14 November 2024.