Skip to content

Main content

Hex Axial Direction Step Record

Advance axial hex coordinates by an explicit signed count along one of six documented direction vectors; no board-boundary or path legality model.

Loading tool…

Description

Advance axial hex coordinates by an explicit signed count along one of six documented direction vectors; no board-boundary or path legality model.

Hexagonal grids can store cells as axial [q,r], parity-based offset or doubled coordinates. Those integer layouts describe the same lattice with different row/column conventions. Drawing cell centers also needs an orientation, origin and center-to-corner radius; those drawing units are separate from lattice coordinates.

Advance axial hex coordinates by an explicit signed count along one of six documented direction vectors; no board-boundary or path legality model.

When to use this tool

Use this tool to advance axial hex coordinates by an explicit signed count along one of six documented direction vectors; no board-boundary or path legality model.

How to use the tool and how it works

  1. Enter q, r, direction, steps using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.q, result.r. Interpret signs, units, ordering and null values using the rules below.

Select direction 0–5 from [1,0], [1,−1], [0,−1], [−1,0], [−1,1], [0,1]. Add steps times that vector to [q,r]; a negative step count moves in the opposite direction.1

Input fieldMeaning and unitsAccepted input
qAxial q coordinate, integer except for pixel-center mapping.Finite safe integer satisfying the stated bounds.
rAxial r coordinate, integer except for pixel-center mapping.Finite safe integer satisfying the stated bounds.
directionDirection index 0–5 into the six vectors listed above.Finite safe integer satisfying the stated bounds.
stepsSigned integer number of lattice steps, within ±1,000,000,000.Finite safe integer satisfying the stated bounds.
Output fieldInterpretation
resultObject containing the fields below.
result.qResulting axial q coordinate.
result.rResulting axial r coordinate.
json
{
  "input": {
    "q": 0,
    "r": 0,
    "direction": 1,
    "steps": 2
  },
  "output": {
    "result": {
      "q": 2,
      "r": -2
    }
  }
}

Limitations and assumptions

  • Direction and step count are explicit; obstacles, board limits and path legality are not checked.
  • Integer lattice inputs are bounded to ±1,000,000,000; the pixel-center operation accepts fractional axial values. Ring/disk radius bounds are stated above. No geographic projection, physical scale or board boundary is inferred.
  • Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.

Alternative or Complementary methods

Keep grid layout, parity convention and drawing orientation consistent. Use coordinate conversion for an existing cell and a separate pathfinding model for obstacles or routes.

References

  1. Tool behavior and example: Hex Axial Direction Step Record — tool.io

Similar or alternative tools

  • Hex Axial Center to Pixel Record

    Map supplied fractional axial hex coordinates to Cartesian pixel centers for explicit pointy/flat orientation, circumradius and origin; no geographic units.

  • Hex Axial Disk Coordinate List

    Enumerate axial hex disk cells center-first then increasing fixed-order rings; radius 0–6 yields at most 127 distinct cells.