linearConversion: Difference between revisions
Jump to navigation
Jump to search
m (note formate) |
m (note formate) |
||
Line 45: | Line 45: | ||
<dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note"> | <dt class="note">'''[[User:ffur2007slx2_5|ffur2007slx2_5]]'''<dd class="note"> | ||
(A3 0.50) It is recommended to use [[linearConversion]] instead of [[BIS_fnc_linearConversion]]: | (A3 0.50) It is recommended to use [[linearConversion]] instead of [[BIS_fnc_linearConversion]]: | ||
<code>[[linearConversion]] [0,100,50,0,50,true]; //same as [[0,100],50,[0,50]] [[call]] [[BIS_fnc_linearConversion]]</code> | <code>[[linearConversion]] [0,100,50,0,50,[[true]] ]; //same as [[0,100],50,[0,50]] [[call]] [[BIS_fnc_linearConversion]]</code> | ||
As for clamp, true will disable new value out of its range while false won't: | As for clamp, true will disable new value out of its range while false won't: | ||
<code>[[linearConversion]] [0,100,150,0,50,true]; //return 50 | <code>[[linearConversion]] [0,100,150,0,50,[[true]] ]; //return 50 | ||
[[linearConversion]] [0,100,150,0,50,false]; //return 75 | [[linearConversion]] [0,100,150,0,50,[[false]] ]; //return 75 | ||
</code> | </code> | ||
<!-- Note Section END --> | <!-- Note Section END --> |
Revision as of 04:00, 4 August 2014
Description
- Description:
- Converts value in interval [min, max] to
newMin + a * (max - min) / (newMax - newMin)
, potentially clamps the final value. - Groups:
- Uncategorised
Syntax
- Syntax:
- linearConversion [min, max, value, newMin, newMax, clamp]
- Parameters:
- [min, max, value, newMin, newMax, clamp]: Object
- min: Number
- max: Number
- value: Number
- newMin: Number
- newMax: Number
- clamp: Boolean
- Return Value:
- Number
Examples
- Example 1:
linearConversion [4, 8, 5, 0, 1, false];
Additional Information
- See also:
- See also needed
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Posted on Mar 29, 2014 - 09:39
- ffur2007slx2_5
-
(A3 0.50) It is recommended to use linearConversion instead of BIS_fnc_linearConversion:
linearConversion [0,100,50,0,50,true ]; //same as [[0,100],50,[0,50]] call BIS_fnc_linearConversion
As for clamp, true will disable new value out of its range while false won't:linearConversion [0,100,150,0,50,true ]; //return 50 linearConversion [0,100,150,0,50,false ]; //return 75