BIS fnc linearConversion: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-9_]+)\]\]([^<]*) *<\/code>" to "<code>$1$2$3</code>")
m (Some wiki formatting)
 
(3 intermediate revisions by the same user not shown)
Line 13: Line 13:


|descr= Linear conversion of a value from one set to another
|descr= Linear conversion of a value from one set to another
{{Feature|arma3|This function became obsolete with the introduction of [[linearConversion]]}}
{{Feature|arma3|This function became obsolete with the introduction of [[linearConversion]].}}


|s1= <!-- [] call [[BIS_fnc_linearConversion]]; -->
|s1= [[minFrom, maxFrom], value, [minTo, maxTo]] call [[BIS_fnc_linearConversion]]


|p1= [[Array]] - [minimumValue,maximumValue] (originalSet)
|p1= minFrom: [[Number]]


|p2= [[Number]] - (originalValue)
|p2= maxFrom: [[Number]]


|p3= [[Array]] - [minimumValue,maximumValue] (newSet)
|p3= value: [[Number]]


|r1= [[Number]] (newValue)
|p4= minTo: [[Number]]


|x1=
|p5= maxTo: [[Number]]
 
|r1= [[Number]] ''value'' adapted to [''minTo'', ''maxTo''] range
 
|x1= <sqf>
[[-50, 50], -50, [0, 1]] call BIS_fnc_linearConversion; // returns 0
[[-50, 50],  0, [0, 1]] call BIS_fnc_linearConversion; // returns 0.5
[[-50, 50], +50, [0, 1]] call BIS_fnc_linearConversion; // returns 1
</sqf>


|seealso= [[linearConversion]]
|seealso= [[linearConversion]]
}}
}}
<dl class="command_description">
<dt></dt>
<dd class="notedate">Posted on Aug 1, 2014 - 23:39</dd>
<dt class="note">[[User:ffur2007slx2_5|ffur2007slx2_5]]</dt>
<dd class="note">
({{arma3}} 0.50) It is recommended to use [[linearConversion]] instead of [[BIS_fnc_linearConversion]]:
<code>linearConversion [0, 100, 50, 0, 50, true]; {{cc|same as [[0, 100], 50, [0, 50]] call [[BIS_fnc_linearConversion]]}}</code>
</dd>
</dl>

Latest revision as of 00:07, 14 May 2023

Hover & click on the images for description

Description

Description:
Linear conversion of a value from one set to another
Arma 3
This function became obsolete with the introduction of linearConversion.
Execution:
call
Groups:
Math

Syntax

Syntax:
[[minFrom, maxFrom], value, [minTo, maxTo]] call BIS_fnc_linearConversion
Parameters:
minFrom: Number
maxFrom: Number
value: Number
minTo: Number
maxTo: Number
Return Value:
Number value adapted to [minTo, maxTo] range

Examples

Example 1:
[[-50, 50], -50, [0, 1]] call BIS_fnc_linearConversion; // returns 0 [[-50, 50], 0, [0, 1]] call BIS_fnc_linearConversion; // returns 0.5 [[-50, 50], +50, [0, 1]] call BIS_fnc_linearConversion; // returns 1

Additional Information

See also:
linearConversion

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