AB Performance Optimization (Part 2)

This commit is contained in:
Michael Braun 2015-08-05 05:19:08 +02:00
parent f6bc361734
commit b8f1fa82ae

View File

@ -19,21 +19,17 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_l", "_t", "_stabilityFactor"]; private ["_twist", "_length", "_stabilityFactor"];
params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"]; params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf // Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_t = _barrelTwist / _caliber; _twist = _barrelTwist / _caliber;
_l = _bulletLength / _caliber; _length = _bulletLength / _caliber;
_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2)); _stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
if (_muzzleVelocity > 341.376) then { if (_muzzleVelocity > 341.376) then {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3); (_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
} else { } else {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3); (_stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure
}; };
_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure;
_stabilityFactor