ACE3/addons/advanced_ballistics/functions/fnc_calculateRoughnessLength.sqf

35 lines
836 B
Plaintext
Raw Normal View History

/*
* Author: Ruthberg
*
* Calculates the terrain roughness length at a given world position
*
* Arguments:
* 0: _this - world position <posASL>
*
* Return Value:
2015-04-07 19:54:29 +00:00
* 0: roughness length <NUMBER>
*
* Public: No
*/
2015-04-05 19:08:55 +00:00
#include "script_component.hpp"
private ["_roughness_lengths", "_windSource", "_nearBuildings", "_isWater"];
// Source: http://es.ucsc.edu/~jnoble/wind/extrap/index.html
_roughness_lengths = [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6];
2015-04-12 10:34:42 +00:00
_windSource = _this vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 25);
2015-04-05 19:08:55 +00:00
_nearBuildings = count (_windSource nearObjects ["Building", 50]);
_isWater = surfaceIsWater _windSource;
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
};
_roughness_lengths select (2 + (_nearBuildings min 6))