mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
ATIS v0.5.0
This commit is contained in:
parent
9b6994749b
commit
fe2ef11f8d
@ -452,7 +452,7 @@ ATIS.Sound = {
|
|||||||
DegreesCelsius={filename="DegreesCelsius.ogg", duration=1.27},
|
DegreesCelsius={filename="DegreesCelsius.ogg", duration=1.27},
|
||||||
DegreesFahrenheit={filename="DegreesFahrenheit.ogg", duration=1.23},
|
DegreesFahrenheit={filename="DegreesFahrenheit.ogg", duration=1.23},
|
||||||
Dust={filename="Dust.ogg", duration=0.54},
|
Dust={filename="Dust.ogg", duration=0.54},
|
||||||
Elevation={filename="Elevation.ogg", duration=0.50},
|
Elevation={filename="Elevation.ogg", duration=0.78},
|
||||||
EndOfInformation={filename="EndOfInformation.ogg", duration=1.15},
|
EndOfInformation={filename="EndOfInformation.ogg", duration=1.15},
|
||||||
Feet={filename="Feet.ogg", duration=0.45},
|
Feet={filename="Feet.ogg", duration=0.45},
|
||||||
Fog={filename="Fog.ogg", duration=0.47},
|
Fog={filename="Fog.ogg", duration=0.47},
|
||||||
@ -513,7 +513,7 @@ _ATIS={}
|
|||||||
|
|
||||||
--- ATIS class version.
|
--- ATIS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ATIS.version="0.4.2"
|
ATIS.version="0.5.0"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -1699,13 +1699,13 @@ function ATIS:GetNavPoint(navpoints, runway, left)
|
|||||||
local rwyy=tonumber(self:GetRunwayWithoutLR(runway))*10
|
local rwyy=tonumber(self:GetRunwayWithoutLR(runway))*10
|
||||||
|
|
||||||
local navL=self:GetRunwayLR(nav.runway)
|
local navL=self:GetRunwayLR(nav.runway)
|
||||||
|
local hdgD=UTILS.HdgDiff(navy,rwyy)
|
||||||
|
|
||||||
if UTILS.HdgDiff(navy,rwyy)<=15 then --We allow an error of +-15° here.
|
if hdgD<=15 then --We allow an error of +-15° here.
|
||||||
if navL==nil or navL==left then
|
if navL==nil or (navL==true and left==true) or (navL==false and left==false) then
|
||||||
return nav
|
return nav
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -857,7 +857,18 @@ end
|
|||||||
-- @param DCS#Vec3 b Vector in 3D with x, y, z components.
|
-- @param DCS#Vec3 b Vector in 3D with x, y, z components.
|
||||||
-- @return #number Angle alpha between and b in degrees. alpha=acos(a*b)/(|a||b|), (* denotes the dot product).
|
-- @return #number Angle alpha between and b in degrees. alpha=acos(a*b)/(|a||b|), (* denotes the dot product).
|
||||||
function UTILS.VecAngle(a, b)
|
function UTILS.VecAngle(a, b)
|
||||||
local alpha=math.acos(UTILS.VecDot(a,b)/(UTILS.VecNorm(a)*UTILS.VecNorm(b)))
|
|
||||||
|
local cosalpha=UTILS.VecDot(a,b)/(UTILS.VecNorm(a)*UTILS.VecNorm(b))
|
||||||
|
|
||||||
|
local alpha=0
|
||||||
|
if cosalpha>=0.9999999999 then --acos(1) is not defined.
|
||||||
|
alpha=0
|
||||||
|
elseif cosalpha<=-0.999999999 then --acos(-1) is not defined.
|
||||||
|
alpha=math.pi
|
||||||
|
else
|
||||||
|
alpha=math.acos(cosalpha)
|
||||||
|
end
|
||||||
|
|
||||||
return math.deg(alpha)
|
return math.deg(alpha)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -879,14 +890,16 @@ end
|
|||||||
function UTILS.HdgDiff(h1, h2)
|
function UTILS.HdgDiff(h1, h2)
|
||||||
|
|
||||||
-- Angle in rad.
|
-- Angle in rad.
|
||||||
local alpha=math.rad(h1)
|
local alpha= math.rad(tonumber(h1))
|
||||||
local beta=math.rad(h2)
|
local beta = math.rad(tonumber(h2))
|
||||||
|
|
||||||
-- Runway vector.
|
-- Runway vector.
|
||||||
local v1={x=math.cos(alpha), y=0, z=math.sin(alpha)}
|
local v1={x=math.cos(alpha), y=0, z=math.sin(alpha)}
|
||||||
local v2={x=math.cos(beta), y=0, z=math.sin(beta)}
|
local v2={x=math.cos(beta), y=0, z=math.sin(beta)}
|
||||||
|
|
||||||
|
local delta=UTILS.VecAngle(v1, v2)
|
||||||
|
|
||||||
return math.abs(UTILS.VecAngle(v1, v2))
|
return math.abs(delta)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user