BIS fnc rotateVector2D: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 1: Line 1:
<syntaxhighlight lang=javascript>scriptName "Functions\vectors\fn_rotateVector2D.sqf";
{{Function|= Comments
____________________________________________________________________________________________
 
| arma2 |= Game name
 
|1.00|= Game version
____________________________________________________________________________________________
 
| <pre>
/************************************************************
/************************************************************
Rotate 2D Vector
Rotate 2D Vector
By Andrew Barron


Parameters: [[vector], angle]
Parameters: [[vector], angle]
Line 11: Line 18:
************************************************************/
************************************************************/


private ["_v","_d","_x","_y"];
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________
 
| <!-- [] call [[BIS_fnc_rotateVector2D]]; --> |= Syntax
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


//extract parameters
}}
_v = +(_this select 0); //we don't want to modify the originally passed vector
_d = _this select 1;


//extract old x/y values
<h3 style="display:none">Notes</h3>
_x = _v select 0;
<dl class="command_description">
_y = _v select 1;
<!-- Note Section BEGIN -->


//if vector is 3d, we don't want to mess up the last element
<!-- Note Section END -->
_v set [0, (cos _d)*_x - (sin _d)*_y];
</dl>
_v set [1, (sin _d)*_x + (cos _d)*_y];


//return new vector
<h3 style="display:none">Bottom Section</h3>
_v
[[Category:Function Group: Vectors|{{uc:rotateVector2D}}]]
</syntaxhighlight>
[[Category:Functions|{{uc:rotateVector2D}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:rotateVector2D}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:rotateVector2D}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:rotateVector2D}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:rotateVector2D}}]]

Revision as of 17:14, 25 July 2014

Hover & click on the images for description

Description

Description:
/************************************************************
	Rotate 2D Vector

Parameters: [[vector], angle]
Returns: [vector]

This function returns a 2D vector rotated a specified number
of degrees around the origin.
************************************************************/

(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
Syntax needed
Return Value:
Return value needed

Examples

Example 1:

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

Bottom Section