atan2: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
[[Category:Scripting Commands|ATAN2]]
{{Command|= Comments
[[Category:Scripting Commands OFP 1.96|ATAN2]]
____________________________________________________________________________________________
[[Category:Scripting Commands OFP 1.46|ATAN2]]
[[Category:Scripting Commands ArmA|ATAN2]]


| ofp |= Game name


<h2 style="color:#000066">'''''x'' atan2 ''y'''''</h2>
|1.00|= Game version
____________________________________________________________________________________________


| Arctangens of x/y. Used to determine the angle of a vector [x,y]. Result in degrees. |= Description
____________________________________________________________________________________________


'''Operand types:'''
| x '''atan2''' y |= Syntax


'''x:''' [[Number]]
|p1= x: [[Number]] |= Parameter 1


'''y:''' [[Number]]
|p2= y: [[Number]] |= Parameter 2


'''Type of returned value:'''
| [[Number]] |= Return value
____________________________________________________________________________________________
 
|x1= <pre>5 atan2 3</pre>


[[Number]]
returns 59.0362 |= Example 1
____________________________________________________________________________________________


'''Description:'''
| [[atan]], [[tan]] |= See also


Returns the arctangens of '''x/y'''.
}}


Returned value is in degrees, in the range -180 to +180, using the signs of both parameters to determine the quadrant of the return value.
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->


Positive angles are clockwise and negative angles are counter-clockwise.
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>


'''Example:'''
[[Category:Scripting Commands|ATAN2]]
 
[[Category:Scripting Commands OFP 1.96|ATAN2]]
_angle = 5 '''atan2''' 3 ..........Result is 59.0362
[[Category:Scripting Commands OFP 1.46|ATAN2]]
 
[[Category:Scripting Commands ArmA|ATAN2]]
 
'''Notes:'''<br>
'''atan2''' is safer than the alternative [[atan]].
 
This is because '''atan2''' will correctly return the angle when the tangent is infinite:<br>
1 '''atan2''' 0<br>
will correctly return the answer 90.<br>
[[atan]] 1/0 will return a Divide by Zero Error

Revision as of 22:05, 1 August 2006

Hover & click on the images for description

Description

Description:
Arctangens of x/y. Used to determine the angle of a vector [x,y]. Result in degrees.
Groups:
Uncategorised

Syntax

Syntax:
x atan2 y
Parameters:
x: Number
y: Number
Return Value:
Number

Examples

Example 1:
5 atan2 3
returns 59.0362

Additional Information

See also:
atantan

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