Ok, I've been trying to do this for far longer than I care to admit, but its obvious even though I CLEPed geometry and trigonometry my understanding of it is pretty pathetic.

I've successfully made hexmaps with the point up, and the point on the side, and drew them in various scales. I've also got pretty darned reliable pixel to hexagon routines for both. BUT, I have no way to really rotate it and do exactly what I want real time :(

Basically, I'm trying to make a hexmap that is actually a portion of a larger map, is scrollable, and can be rotated any angle and scaled any scale.

I will be providing the following information:
W (Total width of a hex)
H (Total height of a hex)
P (Width of the hex part)
A (Angle of rotation for the entire MAP (NOT each individual hex))
S (Scale of the map/hex, .5=half, 2=double)
R (Row of the hex)
C (Column of the hex)
X (X offset of the MAP)
Y (Y offset of the MAP)

And I need it to return the pixel's X and Y location for the upper left hand point of the hexagon square (basically a point in space at the upper left hand portion of the hex, so I can blt stuff to it later).

I also need a function that takes the above information, PLUS the pixel X/Y coordinates and returns the hexagon row and column.

This allows me to have any shape of hexagon and a map that can rotate any angle. I am basically creating a map of a planet with 10km accuracy (roughly 8mb per pixel) where each pixel is a sector of around 10km (1024 pixel square, as each pixel is a 10m "hex"). A texture will be drawn in the background and a hexagonal grid will overlay it (thus it won't look like a crappy hexmap). There will be another file that determines the predominate terrain in each hex, as well as another for altitude (earth would be around 50mb total for this, plus up to 250GB for 65000 unique 10km sectors). Each of these maps will be a bitmap sorta format where a sector is pulled (or up to 4 if your on a corner) and the particular area drawn thats necessary.

I know I'm asking a lot, but I've tried for a LONG time to get this and have never gotten it to the point I could consider it a "production" piece of code. I don't care if its in VB, C, C#, Java, ASM, whatever (ASM would be nice!) but just want it to work. If you know how to do it and just dont wanna help cause I'm basically asking somebody else to write 2 functions for me, I'd be happy to share anything else I have or perhaps even pay (need a new $50 computer book?).

I'm trying to do a generic hexagonal game engine that'll have plugins for a HUGE # of board games out there. But I need the code to be very versatile and modular and allow quick coding of the game engines. I'm going to *try* to do it with the .NET GDI to avoid any 3D dependencies, but DX may have to be used if I can't get the 3 layers plus borders and such drawn quick enough (with maybe 2500 hexes on screen max).

Anyway, thanks for any help you can provide (I've already searched here and all over google with no avail) as I'm pretty darned desparate at this point.



...<--------W------->
................<-P->
^...../``````````\
|..../............\
|.../..............\
|../................\
H..\................/
|...\............../
|....\............/
|.....\__________/
V