Forked from Mike Bostock's example.
For each hex, its hexagonal coordinates are drawn.
This kind of coordinate system makes it possible to interpret the position vectors of the six hexes around the origin as direction vectors. Therefore, it is possible to sum one of them to the position vector of an hex to "move" to an adjacent one. These are the values for the six directions:
E (+1,-1,0)
SE (+1,0,-1)
SW (0,+1,-1)
W (-1,+1,0)
NW (-1,0,+1)
NE (0,-1,+1)
Possible use cases are: computing the shortest path on a connectivity graph based on the hexagonal tiling (Stojmenovic 2007), walking on the hexagonal cells by following a space-filling curve.
Two example hexagons are also highlighted, to show the possibility of addressing an hexagon by using its coordinates.
Modified http://d3js.org/d3.v3.min.js to a secure url
Modified http://d3js.org/topojson.v1.min.js to a secure url
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v1.min.js