ACE3/addons/common/functions/fnc_interpolateFromArray.sqf

24 lines
449 B
Plaintext
Raw Normal View History

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>
*
* Public: Yes
*/
2015-01-13 19:56:02 +00:00
#include "script_component.hpp"
2015-09-19 20:27:23 +00:00
params ["_array", "_value"];
2015-09-19 20:27:23 +00:00
private ["_min", "_max"];
_min = _array select floor _value;
_max = _array select ceil _value;
2015-09-19 20:27:23 +00:00
_min + (_max - _min) * (_value % 1) // return