vectorLinearConversion: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Added third example)
mNo edit summary
 
(32 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|=
{{RV|type=command
____________________________________________________________________________________________


| arma3 |Game=
|game1= arma3
|version1= 1.92


|1.92|Game Version =
|gr2= Math - Vectors


|arg=  |Multiplayer Arguments =
|descr= Interpolates vector between the given ''vectorFrom'' and ''vectorTo'' value according to the given range value.


|eff=  |Multiplayer Effects =
|s1= [[vectorLinearConversion]] [rangeFrom, rangeTo, rangeValue, vectorFrom, vectorTo, clip]


|serverExec= |Multiplayer Execution =("server" or empty)
|p1= rangeFrom: [[Number]] - start "from" range
____________________________________________________________________________________________


| Interpolates vector between the given "vectorFrom" and "vectorTo" value according to the given range value|Description=
|p2= rangeTo: [[Number]] - end "to" range
____________________________________________________________________________________________


| [[vectorLinearConversion]] [rangeFrom, rangeTo, rangeValue, vectorFrom, vectorTo, clip] |Syntax=
|p3= rangeValue: [[Number]] - variable range value


|p1=[rangeFrom, rangeTo, rangeValue, vectorFrom, vectorTo, clip]: [[Array]]
|p4= vectorFrom: [[Array]] - start "from" vector


|p2=rangeFrom: [[Number]] - start "from" range
|p5= vectorTo: [[Array]] - end "to" vector


|p3=rangeTo: [[Number]] - end "to" range
|p6= clip: [[Boolean]] - (Optional, default [[false]]) if [[true]], range value will be clipped to stay within "from" - "to" range


|p4=rangeValue: [[Number]] - variable range value
|r1= [[Array]] - interpolated vector


|p5=vectorFrom: [[Array]] - start "from" vector
|x1= <sqf>vectorLinearConversion [0, 1, 0.5, [0,0,0], [25,50,100], false]; // [12.5,25,50]</sqf>


|p6=vectorTo: [[Array]] - end "to" vector
|x2= <sqf>vectorLinearConversion [0, 1, 100, [0,0,0], [25,50,100], true]; // [25,50,100]</sqf>


|p7=clip (Optional): [[Boolean]] - if [[true]], range value will be clipped to stay within "from" - "to" range. Default: [[false]]
|x3= <sqf>vectorLinearConversion [0, 1, 100, [0,0,0], [25,50,100], false]; // [2500,5000,10000]</sqf>


| [[Array]] - interpolated vector |Return Value=
|seealso= [[linearConversion]] [[bezierInterpolation]] [[matrixMultiply]] [[matrixTranspose]]
____________________________________________________________________________________________
 
|x1= <code>[[vectorLinearConversion]] [0,1,0.5,[0,0,0],[25,50,100],[[false]]]; // [12.5,25,50]</code> |Example 1=
|x2= <code>[[vectorLinearConversion]] [0,1,100,[0,0,0],[25,50,100],[[true]]]; // [25,50,100]</code> |Example 2=
|x3= <code>[[vectorLinearConversion]] [0,1,100,[0,0,0],[25,50,100],[[false]]]; // [2500,5000,10000]</code> |Example 3=
____________________________________________________________________________________________
 
|mp= - |Multiplayer Behaviour=
 
| [[linearConversion]], [[bezierInterpolation]], [[matrixMultiply]], [[matrixTranspose]] |See Also=
}}
}}
<dl class="command_description">
<!-- BEGIN Note Section -->
<!-- For example:
<dd class="notedate">Posted on Month Day, Year - Time (UTC)</dd>
<dt class="note">'''[[User:User Name|User Name]]'''</dt>
<dd class="note">This is an example note. It is true and verifiable, and contains a little code snippet.
<code>[[if]] ([[_this]] == anExample) [[then]] { [[hint]] "Leave it here for others to read"; };</code></dd>
-->
<!-- END Note Section -->
</dl>
<h3 style="display:none">Bottom Section</h3>
<!-- Appropriate categories go here -->
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 21:21, 28 September 2023

Hover & click on the images for description

Description

Description:
Interpolates vector between the given vectorFrom and vectorTo value according to the given range value.
Groups:
Math - Vectors

Syntax

Syntax:
vectorLinearConversion [rangeFrom, rangeTo, rangeValue, vectorFrom, vectorTo, clip]
Parameters:
rangeFrom: Number - start "from" range
rangeTo: Number - end "to" range
rangeValue: Number - variable range value
vectorFrom: Array - start "from" vector
vectorTo: Array - end "to" vector
clip: Boolean - (Optional, default false) if true, range value will be clipped to stay within "from" - "to" range
Return Value:
Array - interpolated vector

Examples

Example 1:
vectorLinearConversion [0, 1, 0.5, [0,0,0], [25,50,100], false]; // [12.5,25,50]
Example 2:
vectorLinearConversion [0, 1, 100, [0,0,0], [25,50,100], true]; // [25,50,100]
Example 3:
vectorLinearConversion [0, 1, 100, [0,0,0], [25,50,100], false]; // [2500,5000,10000]

Additional Information

See also:
linearConversion bezierInterpolation matrixMultiply matrixTranspose

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