I saw an earlier thread where people were discussing Hex-grid math.
I have been trying for a while (a long long long while) to make a comprehensive game-aid for Starfleet Battles and recently through the above thread and some other very handy pages started coding the problem using VBA in Excel 2007.
I have a version available for anyone who wants to look at it and play around with it. All it does is let you select an attacker and defender from a user customizable list of units and it will calculate the distance between them, the bearing from the attacker to the defender, the angle to same, and a list of all hexes which make up the LOS.
It will show the hex at every range (1, 2, 3, etc) and in cases where the LOS crosses exactly halfway between two hexes it will show both hexes and allow you to pick which one you actually move through.
There are two VBA modules (module1/module2) which contain all the code executed when the button is clicked on the Ship Position track worksheet.
Visual Map Aid worksheet is static, its just something I made up to show the units relative to each other along with a little LOS ruler object.
Battleboard worksheet is a very early idea of how I want units to be listed during a game and doesn't do much of anything yet.
If anyone wants to play with it, here is the archived version:
It is saved in Excel 2007 format, you may have to activate macros when you open it. Scan it to be safe.
I figure once I get the movement down everything else will hook into it naturally. One thing I haven't done yet is to code for conditions where both attacker/defender are in the same hex. Starfleet Battles has several different ways of determining which shield is struck by fire at 0 hexes. I've got to study that some more before I tackle it.
Also, final caveat, I am using a 8-digit x-y coordinate instead of the usual 4-digit in SFB. This gives me a larger play area with the center of the map at 50005000, instead of 5050. I like not worrying about shifting the whole map when units approach the edges.
Cheers! Let me know what you think. Ugg, if you absolutely need a 2003 excel version I can do that, I just like the extra formatting and color options (plus the larger cell/row size) of 2007 a lot.