Help With A Tile Map

C

crazyphill

I need help with a hex map. I'm using the following for basic help:
http://www.phobeus.de/hosting/pixelpracht/downloads/hexcoordsTut_e.htm
However, it doesn't quite help out my particular situation. Given a
region
in a matrix (x1,x2,y1,y2), I need to find out which dimension (width or

height) is the largest in order to determine the scale of the tiles. I
believe I have solved this part with the following equations:

sizeX=(x2-x1+1)+.5
sizeY=(y2-y1+1)[(.5/cos(30))+.5tan(30)]+.5tan(30)

These equations assume a tile size of 1 since the comparison will be
the
same no matter what the actual size ends up being.

The next problem, though, is to determine the tile size for the actual
map.
If the region width is larger, then I simply have to divide
widthOfScreen by
sizeX.

If, on the other hand, the height is larger, then dividing
heightOfScreen by
sizeY gives me something, but I'm not sure what. I don't think it's
giving
me b (see website). And if it is, I don't know how to get from b to a,
since
I need the horizontal tilesize no matter which dimension is larger.

So, how can I obtain the horizontal tileSize (a) in the case that the
region
is vertically larger than it's width?

Phill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top