BIS fnc linearConversion: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Some wiki formatting)
 
(42 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2oa
____________________________________________________________________________________________
|version1= 1.50


| arma2oa |= Game name
|game2= tkoh
|version2= 1.00


|1.00|= Game version
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| <pre>/*
|gr1= Math
File: fn_linearConversion.sqf


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


Parameter(s):
|s1=  [[minFrom, maxFrom], value, [minTo, maxTo]] call [[BIS_fnc_linearConversion]]
_this select 0: Array (originalSet)
Note: should be two elements [minimumValue, maximumValue]
_this select 1: Scalar (originalValue)
_this select 2: Array (newSet)
Note: should be two elements [minimumValue, maximumValue]
Returns:
Scalar (newValue)
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|p1= minFrom: [[Number]]
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_linearConversion]]; --> |= Syntax
|p2= maxFrom: [[Number]]


|p1= |= Parameter 1
|p3= value: [[Number]]


| |= Return value
|p4= minTo: [[Number]]
____________________________________________________________________________________________


|x1= <code></code> |=
|p5= maxTo: [[Number]]
____________________________________________________________________________________________


| |= See also
|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]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Numbers|{{uc:linearConversion}}]]
[[Category:Functions|{{uc:linearConversion}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:linearConversion}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:linearConversion}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:linearConversion}}]]

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