Supervisor -> Re: How about calculating rather than counting ? (8/1/2002 2:28:21 PM)
|
[QUOTE]Originally posted by Bernd Hesberg [B] Well, haven't you thought about letting Excel do all that work? The necessary data are just the position of every base (you have them) and a sufficient algorithm. You may try this one =MAX( ABS( ColumnDifference); ABS( RowDifference))+IF( ABS( ColumnDifference)>ABS( RowDifference); ABS( RowDifference)/2; IF( ABS( ColumnDifference)>ABS( RowDifference)/2; ABS( ColumnDifference)-ABS( RowDifference)/2)) Of course, you need to substitute every occurrence of the variables 'RowDifference' and 'ColumnDifference' by their actual pairs of coordinates. I haven't checked that for *every* possible combination. So, if there's something wrong with it, please reply. I'd think it saves a lot of counting. Even better, it can be easily used for any other hex-based map. [/B][/QUOTE]Sounds close to what I used. Actually (since I was using Quattro Pro and the formulas wouldn't translate to Excel) what I used was a nested IF statement. Essentially it was as follows: ([I]horizontal[/I] is the absolute value of difference between the columns, [I]vertical[/I] is the absolute value of the difference between the rows, and I rounded any calculation result) If the horizontal was less than ½ the vertical, then the distance is equal to the vertical. Then if the vertical was 0 or 1, then the distance is equal to the horizontal. Otherwise, the distance is equal to the horizontal + ½ the vertical. As I said, every distance I checked worked with this logic, and I didn't find any that didn't, but I didn't check more than a random sample of all possible combinations. I may have time on my hands, but I'm not a masochist! :D (btw: I don't have Excel. :))
|
|
|
|