ATragMX and RangeCard - Fixed incorrect MRAD conversions (#5640)

- This greatly improves the accuracy of the MRAD output in both modules
- Old and incorrect conversion factor: 3.38 [(360 * 60) / 6400]
- New and correct conversion factor: 3.44 [54 / (5 * PI)]
This commit is contained in:
ulteq 2017-10-20 17:33:26 +02:00 committed by jonpas
parent 18c2f45b3a
commit 923507d009
8 changed files with 36 additions and 22 deletions

View File

@ -139,7 +139,7 @@ while {_TOF < 15 && (_bulletPos select 1) < _targetRange} do {
_windage1 = - atan(_tx / _trueRange);
_windDrift = (_wind2 select 0) * (_TOF - _trueRange / _muzzleVelocity);
_windage2 = - atan(_windDrift / _trueRange);
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _trueRange);
_lead = (_targetSpeed * _TOF) / (Tan(MRAD_TO_DEG(1)) * _trueRange);
};
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));
_kineticEnergy = _kineticEnergy * 0.737562149;
@ -174,7 +174,7 @@ if (_targetRange != 0) then {
_windage1 = - atan(_tx / _targetRange);
_windDrift = (_wind2 select 0) * (_TOF - _targetRange / _muzzleVelocity);
_windage2 = - atan(_windDrift / _targetRange);
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _targetRange);
_lead = (_targetSpeed * _TOF) / (Tan(MRAD_TO_DEG(1)) * _targetRange);
};
_kineticEnergy = 0.5 * (_bulletMass / 1000 * (_bulletSpeed ^ 2));

View File

@ -46,8 +46,8 @@ if (_parseInput) then {
};
switch (_dropUnit) do {
case 0: {
_transonicDrop = _transonicDrop * 3.38;
_subsonicDrop = _subsonicDrop * 3.38;
_transonicDrop = MRAD_TO_MOA(_transonicDrop);
_subsonicDrop = MRAD_TO_MOA(_subsonicDrop);
};
case 2: {
_transonicDrop = _transonicDrop / 1.047;

View File

@ -45,9 +45,9 @@ private _speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSou
switch (GVAR(currentScopeUnit)) do {
case 0: {
_elevation = _elevation / 3.38;
_windage1 = _windage1 / 3.38;
_windage2 = _windage2 / 3.38;
_elevation = MRAD_TO_MOA(_elevation);
_windage1 = MRAD_TO_MOA(_windage1);
_windage2 = MRAD_TO_MOA(_windage2);
};
case 2: {
_elevation = _elevation * 1.047;
@ -55,7 +55,7 @@ private _speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSou
_windage2 = _windage2 * 1.047;
};
case 3: {
private _clickSize = [1, 1 / 1.047, 3.38] select (GVAR(workingMemory) select 7);
private _clickSize = [1, 1 / 1.047, MOA_TO_MRAD(1)] select (GVAR(workingMemory) select 7);
private _clickNumber = GVAR(workingMemory) select 8;
private _clickInterval = _clickSize / _clickNumber;

View File

@ -41,16 +41,16 @@ private _lead = GVAR(leadOutput) select GVAR(currentTarget);
switch (GVAR(currentScopeUnit)) do {
case 0: {
_elevationAbs = _elevationAbs / 3.38;
_windageAbs = _windageAbs / 3.38;
_elevationAbs = MRAD_TO_MOA(_elevationAbs);
_windageAbs = MRAD_TO_MOA(_windageAbs);
_wind2 = _wind2 / 3.38;
_wind2 = MRAD_TO_MOA(_wind2);
_elevationRel = _elevationRel / 3.38;
_windageRel = _windageRel / 3.38;
_elevationRel = MRAD_TO_MOA(_elevationRel);
_windageRel = MRAD_TO_MOA(_windageRel);
_elevationCur = _elevationCur / 3.38;
_windageCur = _windageCur / 3.38;
_elevationCur = MRAD_TO_MOA(_elevationCur);
_windageCur = MRAD_TO_MOA(_windageCur);
};
case 2: {
_elevationAbs = _elevationAbs * 1.047;
@ -65,7 +65,7 @@ switch (GVAR(currentScopeUnit)) do {
_windageCur = _windageCur * 1.047;
};
case 3: {
private _clickSize = [1, 1 / 1.047, 3.38] select (GVAR(workingMemory) select 7);
private _clickSize = [1, 1 / 1.047, MOA_TO_MRAD(1)] select (GVAR(workingMemory) select 7);
private _clickNumber = GVAR(workingMemory) select 8;
private _clickInterval = _clickSize / _clickNumber;

View File

@ -42,9 +42,9 @@ private _dropData = +GVAR(truingDropDropData);
switch (_dropUnit) do {
case 0: {
_dropData set [0, (_dropData select 0) / 3.38];
_dropData set [1, (_dropData select 1) / 3.38];
_dropData set [2, (_dropData select 2) / 3.38];
_dropData set [0, MRAD_TO_MOA(_dropData select 0)];
_dropData set [1, MRAD_TO_MOA(_dropData select 1)];
_dropData set [2, MRAD_TO_MOA(_dropData select 2)];
};
case 2: {
_dropData set [0, (_dropData select 0) * 1.047];

View File

@ -16,4 +16,11 @@
#include "\z\ace\addons\main\script_macros.hpp"
#define MOA_TO_MRAD(d) (d * 3.43774677) // Conversion factor: 54 / (5 * PI)
#define MRAD_TO_MOA(d) (d * 0.29088821) // Conversion factor: (5 * PI) / 54
#define DEG_TO_MOA(d) (d * 60) // Conversion factor: 60
#define MOA_TO_DEG(d) (d / 60) // Conversion factor: 1 / 60
#define DEG_TO_MRAD(d) (d * 17.45329252) // Conversion factor: (50 * PI) / 9
#define MRAD_TO_DEG(d) (d / 17.45329252) // Conversion factor: 9 / (50 * PI)
#define ATRAGMX_PROFILE_NAMESPACE_VERSION 2.1

View File

@ -122,17 +122,17 @@ while {_TOF < 6 && (_bulletPos select 1) < _targetRange} do {
_tz = (_lastBulletPos select 2) + (_range - (_lastBulletPos select 1)) * ((_bulletPos select 2) - (_lastBulletPos select 2)) / ((_bulletPos select 1) - (_lastBulletPos select 1));
_elevation = - atan(_tz / _range);
_windage = - atan(_tx / _range);
_lead = (_targetSpeed * _TOF) / (Tan(3.38 / 60) * _range);
_lead = (_targetSpeed * _TOF) / (Tan(MRAD_TO_DEG(1)) * _range);
};
private _elevationString = Str(round(-_elevation * 60 / 3.38 * 10) / 10);
private _elevationString = Str(round(-DEG_TO_MRAD(_elevation) * 10) / 10);
if (_elevationString == "0") then {
_elevationString = "-0.0";
};
if (_elevationString find "." == -1) then {
_elevationString = _elevationString + ".0";
};
private _windageString = Str(round(_windage * 60 / 3.38 * 10) / 10);
private _windageString = Str(round(DEG_TO_MRAD(_windage) * 10) / 10);
if (_windageString find "." == -1) then {
_windageString = _windageString + ".0";
};

View File

@ -15,3 +15,10 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define MOA_TO_MRAD(d) (d * 3.43774677) // Conversion factor: 54 / (5 * PI)
#define MRAD_TO_MOA(d) (d * 0.29088821) // Conversion factor: (5 * PI) / 54
#define DEG_TO_MOA(d) (d * 60) // Conversion factor: 60
#define MOA_TO_DEG(d) (d / 60) // Conversion factor: 1 / 60
#define DEG_TO_MRAD(d) (d * 17.45329252) // Conversion factor: (50 * PI) / 9
#define MRAD_TO_DEG(d) (d / 17.45329252) // Conversion factor: 9 / (50 * PI)