Skip to content

Main content

Hex Doubled Coordinate Axial Parser

Invert doubled hex coordinates only when column-row parity agrees; odd parity is invalid lattice evidence, not rounded silently.

Loading tool…

Description

Invert doubled hex coordinates only when column-row parity agrees; odd parity is invalid lattice evidence, not rounded silently.

Hexagonal grids can use axial, three-component cube or parity-based offset coordinates. Cube coordinates satisfy x + y + z = 0; axial coordinates use two components. Pixel layouts additionally need orientation, origin and center-to-corner size, which are separate from the integer coordinate convention.

Invert doubled hex coordinates only when column-row parity agrees; odd parity is invalid lattice evidence, not rounded silently.

When to use this tool

Use this tool to invert doubled hex coordinates only when column-row parity agrees; odd parity is invalid lattice evidence, not rounded silently.

How to use the tool and how it works

  1. Enter column, row, horizontal using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.q, result.r. Use the ordering, boundary rules and absence conditions described below.

Require column and row to have equal parity. In horizontal mode return q = (column − row)/2 and r = row; otherwise return q = column and r = (row − column)/2.1

Input fieldMeaning and unitsAccepted input
columnInteger column under the named offset/doubled convention.A finite safe integer within the operation’s stated bounds.
rowInteger row under the named offset/doubled convention.A finite safe integer within the operation’s stated bounds.
horizontalTrue selects the horizontal doubled-coordinate rule; false selects its vertical counterpart.A boolean true or false.
Output fieldInterpretation
resultObject containing the named fields below.
result.qAxial q coordinate; fractional for the pixel inverse operation.
result.rAxial r coordinate; fractional for the pixel inverse operation.
json
{
  "input": {
    "column": 5,
    "row": 1,
    "horizontal": true
  },
  "output": {
    "result": {
      "q": 2,
      "r": 1
    }
  }
}

Limitations and assumptions

  • A parity mismatch is an error rather than a fractional axial result.
  • Integer layout coordinates are bounded to ±1,000,000,000 where required. Cube components must sum to zero within 1e−8. Pixel coordinates, origin and size must use the same distance units; angular calculations use radians internally.
  • Every declared top-level input field is required and unexpected 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 no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Keep coordinate layout, parity convention and drawing orientation consistent. Use an explicit rounding operation to choose an integer cell from fractional coordinates and a separate pathfinding model for obstacles or routes.

References

  1. Tool behavior and example: Hex Doubled Coordinate Axial Parser — tool.io

Similar or alternative tools

  • Hex Axial to Even Row Offset

    Convert signed integer hex coordinates between axial and even-row offset convention; floor-compatible parity handles negative coordinates, no geographic projection.

  • Hex Axial to Odd Column Offset

    Convert signed integer hex coordinates between axial and odd-column offset convention; floor-compatible parity handles negative coordinates, no geographic projection.