# [MUD-Dev] Re: Hex-grid mapping

Par Winzell zell at alyx.com
Tue Dec 1 21:46:57 New Zealand Daylight Time 1998

```> >Would you have been happier if I'd drawn my hexes like this?
> >
> >        / \   / \   / \   / \
> >       /   \ /   \ /   \ /   \
> >      | 0,2 | 1,2 | 2,2 | 3,2 |
> >      |     |     |     |     |
> >     / \   / \   / \   / \   /
> >    /   \ /   \ /   \ /   \ /
> >   | 0,1 | 1,1 | 2,1 | 3,1 |
> >   |     |     |     |     |
> >  / \   / \   / \   / \   /
> > /   \ /   \ /   \ /   \ /
> >| 0,0 | 1,0 | 2,0 | 3,0 |
> >|     |     |     |     |
> > \   / \   / \   / \   /
> >  \ /   \ /   \ /   \ /
> >
> >Those are really hexagons...  And the six neighbors have the coordinate
> >deltas I specified.  The fact that they don't look pretty in ASCII graphics
> >says little about the math.
> >
> >That they're best stored in memory as a two dimensional array doesn't change
> >how the geometry works.  Two of the "corner" diagonals are as adjacent as the
> >"sides", and the other two diagonals are farther away than with a square
> >geometry.
> >
> >The underlying mathematics are that if you try to do coordinate geometry with
> >axes 60 degrees apart, the distance function changes to d=sqrt(x*x-x*y+y*y),
> >and the lattice points wind up being the centers of packed hexagons.
>
> nevertheless there are eight neighbors of each node, not six. perhaps he doesn't

It seems to me that the idea of a hexagonal grid is primarily geometrical, and
any topological observations drawn from it are secondary. How do you conclude
that there are eight neighbours of each node in what was outlined above?

Draw the hex grid with each node sharing six borders with its neighbours. Next,
turn each node into a square shape and yank every other row a to the side a bit
while you maintain a hexagonal notion of topological proximity. This leaves you
with a simple matrix, easily addressable in cartesians, where each node has six
neighbours... just as Jon has drawn it.

Only if you suddenly discard the topology implied in the hex grid and start
thinking again about -geometric- proximity in the cartesian system do you end up
with four, or eight neighbours... unless I am misunderstanding something?

Par

PS. This is my first post on MUD-Dev after lurking for a very long time. Hi
folks!
My apologies for not making a more flashy, or constructive, appearance.

```