Tool_LOS ( table)
This function can return
(a) the distance to the radar horizon between mix of units and altitudes, or
(b) a true/false if a LOS exists between a unit and a contact
Parameters
-
table
{
}
- mode = number Distance to horizon (0) or LOS is clear (1)
- horizon = number Radar (0), Visual (1) or ESM (2)
- useRangeLimits = True/False If using a unit as the 'observer', use the min/max ranges of the sensor(s) in the unit to get the 'horizon'
-
observer =
{
}
- altitude = number or string Altitude of the observer.
-
guid =
number
Observer unit GUID. The altitude of the unit and any mast height will be calculated.
If performing a LOS check, then this must be supplied
-
location =
{
}
- latitude = number or string Latitude of the from location
- longitude = number or string Longitude of the from location
-
target =
{
}
- altitude = number or string Altitude of the target
-
guid =
number
Target contact GUID. The altitude of the actual unit will be calculated.
If performing a LOS check, then this must be supplied
-
location =
{
}
- latitude = number or string Latitude of the to location
- longitude = number or string Longitude of the to location
Returns
number The horizontal distance in NM, or
True/False Is the line of sight clearExample
local los = Tool_LOS( {observer = {alt=10}, target ={alt=10972}} )
print(string.format('Distance to horizon = %.2f NM', los) )
local los = Tool_LOS( {observer = {guid='GNRIJH-0HMJFCEE2I3U8'}, target ={alt=10972}, useRangeLimits=true} )
print(string.format('Distance to horizon = %.2f NM', los) )
local los = Tool_LOS( {observer = {guid='GNRIJH-0HMJFCEE2I3U8'}, target ={guid='GNRIJH-0HMJFCEE2I9AN'}, mode = 1, horizon = 0} )
if type(los) == 'boolean' then
print(string.format('Line of sight to target = %s', los) )
else
print(string.format('Distance to horizon = %.2f NM', los) )
end