2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-04-07 19:46:43 +00:00
|
|
|
/*
|
|
|
|
* Author: Ruthberg
|
|
|
|
* Calculates the terrain roughness length at a given world position
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-08-04 00:11:24 +00:00
|
|
|
* world position <posASL>
|
2015-04-07 19:46:43 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-08-04 00:11:24 +00:00
|
|
|
* roughness length <NUMBER>
|
2015-04-07 19:46:43 +00:00
|
|
|
*
|
2016-01-05 07:39:29 +00:00
|
|
|
* Example:
|
|
|
|
* (getPosASL player) call ace_weather_fnc_calculateRoughnessLength
|
|
|
|
*
|
2015-04-07 19:46:43 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
2015-04-05 19:08:55 +00:00
|
|
|
|
|
|
|
// Source: http://es.ucsc.edu/~jnoble/wind/extrap/index.html
|
2016-01-05 07:39:29 +00:00
|
|
|
#define ROUGHNESS_LENGTHS [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6]
|
2015-04-05 19:08:55 +00:00
|
|
|
|
2017-11-10 14:44:15 +00:00
|
|
|
private _windSource = _this vectorDiff ((vectorNormalized wind) vectorMultiply 25);
|
2018-11-15 16:49:43 +00:00
|
|
|
private _nearBuildings = {
|
|
|
|
// Filter lights - fixes high roughness on airports (#6602)
|
|
|
|
str _x find "light" == -1
|
|
|
|
} count (_windSource nearObjects ["Building", 50]);
|
2016-01-05 07:39:29 +00:00
|
|
|
private _isWater = surfaceIsWater _windSource;
|
2015-04-05 19:08:55 +00:00
|
|
|
|
|
|
|
if (_nearBuildings == 0 && _isWater) exitWith {
|
2015-04-07 19:27:04 +00:00
|
|
|
0.0005
|
2015-04-05 19:08:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (_nearBuildings >= 10) exitWith {
|
2015-04-07 19:27:04 +00:00
|
|
|
1.6
|
2015-04-05 19:08:55 +00:00
|
|
|
};
|
|
|
|
|
2016-01-05 07:39:29 +00:00
|
|
|
ROUGHNESS_LENGTHS select (2 + (_nearBuildings min 6))
|