Add atmosphere and coord

This commit is contained in:
omltcat 2024-05-23 19:31:38 -04:00
parent e4716df351
commit 389d056e60
2 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,50 @@
---@meta
---@class atmosphere
atmosphere = {}
---Returns a velocity vector of the wind at a specified point.<br>
---Return Example:
---```
---{ ["y"] = 0, ["x"] = 2.1700058188484, ["z"] = 3.058223998561, }
---```
---Example:
---```
---local point = trigger.misc.getZone('z').point
---local windOverPoint = {}
---for i = 0, 20 do
--- point.y = i * 500
--- windOverPoint[i+1] = atmosphere.getWind(point)
---end
---```
---@param vec3 vec3
---@return vec3
function atmosphere.getWind(vec3) end
---Returns a velocity vector of the wind at a specified point, this time factoring turbulence into the equation.<br>
---Return Example:
---```
---{ ["y"] = 0.03367256503866, ["x"] = 2.0073974820325, ["z"] = 3.0021618733208, }
---```
---@param vec3 vec3
---@return vec3
function atmosphere.getWindWithTurbulence(vec3) end
---Returns the temperature and pressure at a given point in 3d space. Temperature is returned in Kelvins. Pressure is returned in Pascals.<br>
---Return Example:
---```
---temperature = 293.15
---pressure = 101325
---```
---Example:
---```
---local pos = trigger.misc.getZone('posit').point
---for i = 0, 10 do
--- pos.y = (i * 1000)
--- local t, p = atmosphere.getTemperatureAndPressure(pos)
---end
---```
---@param vec3 vec3
---@return number temperature, number pressure
function atmosphere.getTemperatureAndPressure(vec3) end

87
library/mission/coord.lua Normal file
View File

@ -0,0 +1,87 @@
---@meta
---@class coord
coord = {}
---Returns a point from latitude, longitude and altitude (optional) in the vec3 format.
---@param latitude number
---@param longitude number
---@param altitude number? -- Optional parameter
---@return vec3
function coord.LLtoLO(latitude, longitude, altitude) end
---Returns multiple values of a given vec3 point in latitude, longitude, and altitude.
---@param vec3 vec3
---@return number latitude, number logitude, number altitude
---Example:
---```
---local curPoint = Unit.getByName('bob'):getPoint()
---local lat, lon, alt = coord.LOtoLL(curPoint)
---trigger.action.outText('Bob is at the raw coordinates of \nLatitude: ' .. lat .. ' \nLongitude: ' .. lon .. '\nAltitude: ' .. alt, 20)
---```
function coord.LOtoLL(vec3) end
---Returns an MGRS table from the latitude and longitude coordinates provided.
---@param latitude number
---@param longitude number
---@return table MGRS
---Return Example:
---```
---MGRS = {
--- UTMZone = string,
--- MGRSDigraph = string,
--- Easting = number,
--- Northing = number
---}
---```
---Example:
---```
---local grid = coord.LLtoMGRS(coord.LOtoLL(Unit.getByName('bobTheTarget'):getPoint()))
---local s = grid.UTMZone .. ' ' .. grid.MGRSDigraph .. ' ' .. grid.Easting .. ' ' .. grid.Northing
---trigger.action.outText(s, 20)
---```
function coord.LLtoMGRS(latitude, longitude) end
---Returns latitude, longitude, and altitude of a given MGRS coordinates.<br>
---MGRS table format:
---```
---MGRS = {
--- UTMZone = string,
--- MGRSDigraph = string,
--- Easting = number,
--- Northing = number
---}
---```
---Example:
---```
---local mId = 0
---local function id()
--- mId = mId + 1
--- return mId
---end
---local colors = {{0.894, 0.012, 0.012, .8},{1, 0.549, 0, .8},{1, 0.929, 0, .8},{0, 0.502, 0.149, .8},{0.141, 0.251, 0.557, .8},{0.451, 0.161, 0.51, .8}}
---local wMod = {-1, 1, 1, -1}
---local hMod = {1, 1, -1, -1}
---local mgrs = {UTMZone = "37T", MGRSDigraph = "DK",}
---local w = -15000
---local h = -1000
---local startEast = 40000
---for i = 1, 6 do
--- local startNorth = 29000 + (h * i * 2)
--- local tbl = {-1, id()}
--- for j = 1, 4 do
--- mgrs.Easting = startEast + (w * wMod[j])
--- mgrs.Northing = startNorth + (h * hMod[j])
--- local lat, lon = coord.MGRStoLL(mgrs)
--- local point = coord.LLtoLO(lat, lon, 0)
--- table.insert(tbl,point)
--- end
--- table.insert(tbl, {0, 0, 0, 0} )
--- table.insert(tbl, colors[i])
--- table.insert(tbl, math.random(0, 6))
--- trigger.action.quadToAll(unpack(tbl))
---end
---```
---@param MGRS table
---@return number latitude, number longitude, number altitude
function coord.MGRStoLL(MGRS) end