linearConversion: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (<code> and description tidy)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Converts value in interval [min, max] to newMin + a*(max-min)/(newMax - newMin), potentially clamps the final value.  |= Description
| Converts value in interval [min, max] to {{Inline code|newMin + a * (max - min) / (newMax - newMin)}}, potentially clamps the final value.  |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 29: Line 29:




|x1= <code>linearConversion [4, 8, 5, 0, 1, false]</code>|= EXAMPLE1  
|x1= <code>[[linearConversion]] [4, 8, 5, 0, 1, [[false]]<nowiki>]</nowiki>;</code>|= EXAMPLE1  


____________________________________________________________________________________________
____________________________________________________________________________________________

Revision as of 14:13, 31 March 2014

Hover & click on the images for description

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
Since ArmA3 ver 0.50 old BIS function BIS_fnc_linearConversion has been deprecated and please always use linearConversion instead. E.g.
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, e.g. linearConversion [0,100,150,0,50,true]; //return 50 linearConversion [0,100,150,0,50,false]; //return 75

Bottom Section