@bockit/hex-round

Hexagon grid rounding

Usage no npm install needed!

<script type="module">
  import bockitHexRound from 'https://cdn.skypack.dev/@bockit/hex-round';
</script>

README

Hex Round

Round hex coordinates to their nearest hex. Support cube and axial grid systems.

Logic courtesy of redblobgames hex grid reference

Usage

import { hexRoundAxial, hexRoundCube } from '@bockit/hex-round'

hexRoundAxial(1.1, 1) // [ 1, 1 ]
hexRoundCube(1.1, 1, -2) // [ 1, 1, -2 ]