Re: [Freeciv-Dev] Hex map implementation
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Artur Biesiadowski wrote:
> I've started playing with hex map. For now just class in java, generic
> enough it could be used for some wargame if freeciv will not choose
> hexes after all.
>
> I've decided to use vertically flattened hexes. They fit into square - a
> lot simplier to make calculations/repaint etc. Normal hex should have
> proportions of 2 x sqrt(3) and they have just 2 x 2.
>
> If somebody thinks that hexes are very simple, here are two routines
> that given the point on screen (actually on map, but it's not important)
> return Point with tile coordinates.
> For simplicity I'll ignore negative/too large tile coordinates (as they
> depend on wrapping etc)
...
> Now imagine that hexes would not have been flattened ... floats
> everywhere I'm afraid.
I've done this in Java too, a while back, I might dig it out. Sure it's
complicated at first but once it's done, it's done. You won't have to look
at this stuff again.
Regards,
Steve Hodge
|
|