2018-09-17 19:19:29 +00:00
|
|
|
#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>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [[0,1], 5] call ace_common_fnc_interpolateFromArray
|
|
|
|
*
|
2015-09-19 20:27:23 +00:00
|
|
|
* Public: Yes
|
|
|
|
*/
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-09-19 20:27:23 +00:00
|
|
|
params ["_array", "_value"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _min = _array select floor _value;
|
|
|
|
private _max = _array select ceil _value;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2017-04-11 15:04:57 +00:00
|
|
|
linearConversion [0, 1, _value % 1, _min, _max] // return
|