Hex Dimensions

Hex size is described in various ways by various sources. To my thinking, and in this document, hexes are measured in terms of center-to-center distance; that is, the distance something travels when it moves from a hex to an adjacent hex. This is represented in the diagram as h, and its value determines the various other hex dimensions.

h h Hex size
s h/√3 Hex-side length
w 2s or 2h/√3 Hex width
r s or h/√3 Hex radius
e h/2 Distance to hex edge

Hex Area

Common hex areas by size:

Size Area
h h² × √3/2
1km .866km²
2km 3.464km²
4km 13.856km²

Oblique Coordinate System

This is the coordinate system used to map hexes in 2D space. The "x" axis is sometimes referred to as the "oblique" axis, since the geometry of the coordinate system makes this axis technically not 90° off the y axis. However, because the axes are functionally orthoganal in "hex space", I'm simply calling this the x-axis.

Distance

The distance between two hexes (x1,y1) and (x2,y2) is calculated as follows: Δx = x2−x1, and Δy = y2−y1. If Δx and Δy are either both positive or both negative, distance is max(|Δx|,|Δy|). If Δx and Δy are of opposite sign, distance is |Δx|+|Δy|.
x y distance
x2 ≥ x1 y2 ≥ y1 max(|x2−x1|,|y2−y1|)
x2 ≥ x1 y2 < y1 |x2−x1|+|y2−y1|
x2 < x1 y2 ≥ y1 |x2−x1|+|y2−y1|
x2 < x1 y2 < y1 max(|x2−x1|,|y2−y1|)

Rotation

Hex rotation around (x0, y0):

Θ x y
0 x y
60 x − y + y0 x − x0 + y0
120 −y + y0 + x0 x − x0 − y + 2y0
180 −x + 2x0 −y + 2y0
240 −x + 2x0 + y − y0 −x + x0 + y0
300 y − y0 + x0 −x + x0 + y

Fractal Lanscapes

Fractal landscapes can be generated over a hexfield in the same way as described for cartesian systems in The Science of Fractal Images by Peitgen, Saupe, Fisher, and McGuire. Each hex in the hexfield is then described by (x,y,z), where z represents the "altitude" of the landscape at hex (x,y); and the landscape is "refined" over I iterations using gaussian offsets (notated here by g()). There are additional parameters, such as k, which is used to set the rate of diminishment of offset magnitude as iterations increase (see SFI for more details).

The principal difference is that the hexes in the hexfield have a 60° adjacency instead of the 90° adjacency of standard caresian squares, so the iteration process is a bit different.

Initial Conditions

The basic unit of a hexfield fractal surface is an equilateral triangle, with a number of hexes per side N equal to 2I+1. Hexes on the three equilateral corners are given an initial gaussian "seed" value.

Alternate landscape shapes are comprised of triangular sub-regions. Large hex-shaped regions (called "superhexes" here to avoid confusion) are made up of six triangles, for instance.

Iteration

Each iteration step is performed on each mutually-adjacent set of three hexes as shown below.

Here, A, B and C represent the z values of a given triple of hexes.

The hexes then represent corresponding hexes in the next-iteration map, with hexes half the size; each (x,y) becoming (2x,2y).

Intermediary z values are equal to f(z1,z2) = (z1+z2)/2 + g()×ki, where i is the iteration step number.

Icosahedral Planetary Modeling

The working assumption is that the planet to be modeled is roughly Earth-sized; this means a planetary radius of about 6400km, and an equatorial length of about 40 000km. Using random midpoint displacement fractal landscape generation for the surface, each icosahedral face will be an equilateral triangle measuring N = 2I hexes, where I is the iteration count.

The value of I also determines the size of the hexes making up the landscape. Since the icosahedral model has five faces spanning the equator, this means that each face measures about 8000km per side, which is close enough to 8192km so that I=13 is equivalent to a hex size of h=1km. Hex size, therefore is equal to 213-I.

I 0 1 2 3 4 5 6 7 8 9 10 11 12 13
N 2I 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192
h 213-I 8192km 4096km 2048km 1024km 512km 256km 128km 64km 32km 16km 8km 4km 2km 1km