mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-13 15:33:29 +00:00
improved cucui map handler
This commit is contained in:
@@ -1,23 +1,30 @@
|
|||||||
params["_latitude", "_longitude", "_altitude"];
|
params ["_longitudeInGame", "_latitudeInGame", "_altitude"];
|
||||||
|
|
||||||
_playerPosition = [_latitude, _longitude, _altitude];
|
private _mapWidth = 19456;
|
||||||
|
private _mapHeight = 19456;
|
||||||
|
|
||||||
_playerLatitude = _playerPosition select 0;
|
// SW corner (used as origin)
|
||||||
_playerLongitude = _playerPosition select 1;
|
private _SW_lat = 1.097575;
|
||||||
|
private _SW_lon =-66.937113;
|
||||||
|
|
||||||
_playerMaxLongitude = 19456;
|
// SE corner
|
||||||
_playerMaxLatitude = 19456;
|
private _SE_lat = 1.097575;
|
||||||
|
private _SE_lon =-66.762179;
|
||||||
|
|
||||||
_MapMaxLatitude = -66.762250;
|
// NW corner
|
||||||
_MapMinLatitude = -66.937028;
|
private _NW_lat = 1.273832;
|
||||||
|
private _NW_lon =-66.937113;
|
||||||
|
|
||||||
_MapMaxLongitude = 1.273167;
|
private _edgeSE_lat = _SE_lat - _SW_lat;
|
||||||
_MapMinLongitude = 1.098444;
|
private _edgeSE_lon = _SE_lon - _SW_lon;
|
||||||
|
|
||||||
_LongitudeDifference = _MapMaxLongitude - _MapMinLongitude;
|
private _edgeNW_lat = _NW_lat - _SW_lat;
|
||||||
_LatitudeDifference = _MapMaxLatitude - _MapMinLatitude;
|
private _edgeNW_lon = _NW_lon - _SW_lon;
|
||||||
|
|
||||||
_RealLongitude = (_playerLongitude / _playerMaxLongitude) * _LongitudeDifference + _MapMinLongitude;
|
private _fx = _longitudeInGame / _mapWidth;
|
||||||
_RealLatitude = (_playerLatitude / _playerMaxLatitude) * _LatitudeDifference + _MapMinLatitude;
|
private _fy = _latitudeInGame / _mapHeight;
|
||||||
|
|
||||||
[_RealLongitude, _RealLatitude, _playerPosition select 2]
|
private _realLat = _SW_lat + (_fx * _edgeSE_lat) + (_fy * _edgeNW_lat);
|
||||||
|
private _realLon = _SW_lon + (_fx * _edgeSE_lon) + (_fy * _edgeNW_lon);
|
||||||
|
|
||||||
|
[_realLat, _realLon, _altitude]
|
||||||
Reference in New Issue
Block a user