BIS fnc vectorDivide: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (infobox to template)
m (Some wiki formatting)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.00


|1.00|Game version=
|gr1= Vectors


<!---|arg= local |Multiplayer Arguments=--->
|descr= Divides vector by scalar, by dividing all vector elements.
{{Feature|informative|
[[vectorMultiply]] can be used instead as <sqf inline>vector vectorMultiply 1/scale</sqf>, but:
* ''scale'' cannot be 0
* in some rare cases, the result is not ''exactly'' the same as [[BIS_fnc_vectorDivide]] - this is due to [[Floating Point Number]] precision and rounding.
}}


<!---|eff= local |Multiplayer Effects=--->
|s1= [vector, divider] call [[BIS_fnc_vectorDivide]]


| <pre>/*
|p1= vector: [[Array]] of [[Number]]s - (Optional, default [0,0,0]) can be any array of numbers
Author:
Nelson Duarte


Description:
|p2= divider: [[Number]] - (Optional, default 1)
Divides vector by scalar, by dividing all vector elements


Parameters:
|r1= [[Array]] of [[Number]]s
_this: ARRAY
0: ARRAY - The vector to divide
1: ARRAY - The scale used to divide each vector element


Returns:
|x1= <sqf>[[123, 456, 789], 5] call BIS_fnc_vectorDivide;</sqf>
ARRAY
*/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=


|[] call [[BIS_fnc_vectorDivide]]|Syntax=
|x2= <sqf>[[1, 2, 3, 4, 5, 6, 7, 8, 9], 5] call BIS_fnc_vectorDivide;</sqf>


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
|seealso= [[vectorMultiply]] [[BIS_fnc_vectorMultiply]]
 
|Datatype - description|Return value=
 
|x1= <code></code>|Example 1=
 
| |See also=
}}
}}
[[Category:Function Group: Math|{{uc:vectorDivide}}]]
[[Category:Functions|{{uc:vectorDivide}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:vectorDivide}}]]

Latest revision as of 15:35, 13 July 2022

Hover & click on the images for description

Description

Description:
Divides vector by scalar, by dividing all vector elements.
vectorMultiply can be used instead as vector vectorMultiply 1/scale, but:
Execution:
call
Groups:
Vectors

Syntax

Syntax:
[vector, divider] call BIS_fnc_vectorDivide
Parameters:
vector: Array of Numbers - (Optional, default [0,0,0]) can be any array of numbers
divider: Number - (Optional, default 1)
Return Value:
Array of Numbers

Examples

Example 1:
[[123, 456, 789], 5] call BIS_fnc_vectorDivide;
Example 2:
[[1, 2, 3, 4, 5, 6, 7, 8, 9], 5] call BIS_fnc_vectorDivide;

Additional Information

See also:
vectorMultiply BIS_fnc_vectorMultiply

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