Skip to content

Main content

Hex Cube Sixty Degree Rotation

Rotate integer hex cube coordinates by signed multiples of sixty degrees via [x,y,z] -> [-z,-x,-y]; not a Cartesian pixel rotation.

Loading tool…

Description

Rotate integer hex cube coordinates by signed multiples of sixty degrees via [x,y,z] -> [-z,-x,-y]; not a Cartesian pixel rotation.

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.

Rotate integer hex cube coordinates by signed multiples of sixty degrees via [x,y,z] -> [-z,-x,-y]; not a Cartesian pixel rotation.

When to use this tool

Use this tool to rotate integer hex cube coordinates by signed multiples of sixty degrees via [x,y,z] -> [-z,-x,-y]; not a Cartesian pixel rotation.

How to use the tool and how it works

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

Require integer cube coordinates summing to zero and apply [x,y,z] → [−z,−x,−y] turns modulo six times.1

Input fieldMeaning and unitsAccepted input
cubeThree cube components [x, y, z] summing to zero; fractional values are accepted only by the rounding operation.Dense list of at most 128 finite numbers; integer/shape constraints above also apply.
turnsSigned integer count of the explicit sixty-degree cube mapping.A finite safe integer within the operation’s stated bounds.
Output fieldInterpretation
resultObject containing the named fields below.
result.cubeResulting [x, y, z] cube coordinate with zero component sum.
json
{
  "input": {
    "cube": [
      1,
      -1,
      0
    ],
    "turns": 1
  },
  "output": {
    "result": {
      "cube": [
        0,
        -1,
        1
      ]
    }
  }
}

Limitations and assumptions

  • Turns are signed counts of this explicit sixty-degree mapping; clockwise interpretation depends on the drawing convention.
  • 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 Cube Sixty Degree Rotation — tool.io

Similar or alternative tools

  • Hex Cube Axis Reflection

    Reflect integer hex cube coordinates across a named cube axis by swapping the other two components; preserves zero-sum coordinates.

  • Hex Fractional Cube Rounding

    Round zero-sum fractional hex cube coordinates and repair the largest rounding-error component to preserve zero sum; ties repair z then y under the documented strict comparisons.