Description
Convert signed integer hex coordinates between axial and even-row offset convention; floor-compatible parity handles negative coordinates, no geographic projection.
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.
Convert signed integer hex coordinates between axial and even-row offset convention; floor-compatible parity handles negative coordinates, no geographic projection.
When to use this tool
Use this tool to convert signed integer hex coordinates between axial and even-row offset convention; floor-compatible parity handles negative coordinates, no geographic projection.
How to use the tool and how it works
- Enter q, r using the field definitions below.
- Run the operation. Correct input errors before interpreting an output.
- Read result.column, result.row. Use the ordering, boundary rules and absence conditions described below.
Convert axial q/r to even-row offset using column = q + (r + parity(r))/2 and row = r.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| q | Integer axial q coordinate. | A finite safe integer within the operation’s stated bounds. |
| r | Integer axial r coordinate. | A finite safe integer within the operation’s stated bounds. |
| Output field | Interpretation |
|---|---|
| result | Object containing the named fields below. |
| result.column | Integer offset column under the named parity convention. |
| result.row | Integer offset row under the named parity convention. |
{
"input": {
"q": 2,
"r": 1
},
"output": {
"result": {
"column": 3,
"row": 1
}
}
} Limitations and assumptions
- The result differs from odd-row layout on odd rows; no pixel origin or cell size is involved.
- 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
Similar or alternative tools
- Hex Even Row Offset to Axial
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 Row Offset
Convert signed integer hex coordinates between axial and odd-row offset convention; floor-compatible parity handles negative coordinates, no geographic projection.