Battle Analysis: Line of Sight Calculator
In "real life" the Line-of-Sight would be a perfectly straight line. In wargames, however, the Line-of-Sight is traced through the hexagons in a manner similar to the way units are moved. First, determine the range to the target. Then plot the route through the hexagons which the Line-of-Sight takes. The Line-of-Sight should trace through the exact same number of hexes as the range to the target.
Line of Sight algorithm calculates the Line-of-Sight route using geometry and cartesian coordinates.
The Line of Sight Calculator checks if there is blocking terrain or blocking units.
Battery A is attacking from hexagon 1410 to Garland at hexagon 1211
Line of Sight algorithm returns route: 1410, 1311, 1211
Terrain is at hexagons and hexsides. This example checks hexagons only
Line of Sight algorithm gives: coordinate and step count ( # of dots from start )
step 0 is start, step 1 is hexside edge of unit, step at 2*range is target,
step count can be used to determine if terrain is less than 1/2 range
wargame rule: Just the hexagon terrain data is checked at step 2 because max range is 2
30,46 : hexagon :
Pelham is attacking from hexagon 0508 to 1/1/IV at hexagon 0406
Line of Sight algorithm returns route: 0508, 0407 & 0507, 0406
Terrain is at hexagons and hexsides. This example checks hexagons only
Line of Sight algorithm gives: coordinate and step count ( # of dots from start )
step 0 is start, step 1 is hexside edge of unit, step at 2*range is target,
step count can be used to determine if terrain is less than 1/2 range
wargame rule: Just the hexagon terrain data is checked at step 2 because max range is 2
10,34 : hexagon : Forest → blocking
10,34 : hexagon : Road
12,32 : hexagon : Forest → blocking
12,32 : hexagon : Road
usually there is only one step 2 terrain, but in this special case there are 2
rule: with both step 2 terrain blocked, los blocked