ACE3/addons/common/functions/fnc_interpolateFromArray.sqf

25 lines
523 B
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
2015-09-19 20:27:23 +00:00
/*
* Author: commy2
* Interpolates between two set points in a curve.
*
* Arguments:
* 0: List of numbers to interpolate from <ARRAY>
* 1: Value / index <NUMBER>
*
* Return Value:
* Interpolation result <NUMBER>
*
* Example:
* [[0,1], 5] call ace_common_fnc_interpolateFromArray
*
2015-09-19 20:27:23 +00:00
* Public: Yes
*/
2015-09-19 20:27:23 +00:00
params ["_array", "_value"];
private _min = _array select floor _value;
private _max = _array select ceil _value;
linearConversion [0, 1, _value % 1, _min, _max] // return