Any maths boffs? Hexagon grid help request

Soldato
Joined
20 Jun 2010
Posts
3,251
I am working on a hexagon array grid system and am stuck wrapping my head around this little problem, see diagram bellow:



Essentially, given a point (p, q) i want to transform in to an addressable array space, (a, b, c), determined by the magnitude and direction of the perpendicular lines that bisect the axis

Any help much appreciated
 
I think OP just wants the floating point values of a, b, c. So the mapping is from
x, y => a, b, c (for any x, y)

Or I may be wrong. OP - are you there??

Yes, floating point values are fine. There may be a fixing function to snap the values to the centre of the containing hexagon.

I am not sure I understand the diagram,why do you need to use three coordinates for a 2d hex grid?

In short, because its fun :p

I was assuming that the OP wants to store the hexagons in a data array.
In which case there would be impossible combinations like [1,1,6] which would have to store a null value surely?

I accept that I might be on completely the wrong track :p

Its a fair point, so i will probably use a hash map of viable values instead of a cubic array.

edit: I fully accept i may be barking up a tree here. Its good sport.
 
Last edited:
Back
Top Bottom