Difference between revisions of "ATAN2"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m (Created page with '{{DISPLAYTITLE:_ATAN2}} The '''_ATAN2''' function returns the radian angle between the positive x-axis of a plane and the point given by the coordinates (x, y) on it. {{PageSyn…')
 
imported>Clippy
m
Line 12: Line 12:
  
 
{{PageDescription}}
 
{{PageDescription}}
* The angle is positive for counter-clockwise angles (upper half-plane, y > 0), and negative for clockwise angles (lower half-plane, y < 0).
+
* The [[DOUBLE]] radian angle returned is positive for counter-clockwise angles (upper half-plane, y > 0).
 +
* The [[DOUBLE]] radian angle returned is negative for clockwise angles (lower half-plane, y < 0).
 
* _ATAN2(y, x) = [[ATN]](y / x) when x > 0
 
* _ATAN2(y, x) = [[ATN]](y / x) when x > 0
 
* _ATAN2(y, x) = [[ATN]](y / x) + [[_PI]] when x < 0 and y >= 0
 
* _ATAN2(y, x) = [[ATN]](y / x) + [[_PI]] when x < 0 and y >= 0
Line 18: Line 19:
 
* _ATAN2(y' x) = [[_PI]] / 2 when x = 0 and y > 0
 
* _ATAN2(y' x) = [[_PI]] / 2 when x = 0 and y > 0
 
* _ATAN2(y, x) = -[[_PI]] / 2 when x = 0 and y < 0
 
* _ATAN2(y, x) = -[[_PI]] / 2 when x = 0 and y < 0
* _ATAN2(0, 0) is undefined and returns 0.
+
* _ATAN2(0, 0) is undefined and the function returns 0.
  
  

Revision as of 17:09, 14 November 2015

The _ATAN2 function returns the radian angle between the positive x-axis of a plane and the point given by the coordinates (x, y) on it.


Syntax

angle! = _ATAN2( y, x)


Parameters

  • y is the vertical axis position(row) as a floating point value.
  • x is the horizontal axis position(column) as a floating point value.

Description

  • The DOUBLE radian angle returned is positive for counter-clockwise angles (upper half-plane, y > 0).
  • The DOUBLE radian angle returned is negative for clockwise angles (lower half-plane, y < 0).
  • _ATAN2(y, x) = ATN(y / x) when x > 0
  • _ATAN2(y, x) = ATN(y / x) + _PI when x < 0 and y >= 0
  • _ATAN2(y, x) = ATN(y / x) - _PI when x < 0 and y < 0
  • _ATAN2(y' x) = _PI / 2 when x = 0 and y > 0
  • _ATAN2(y, x) = -_PI / 2 when x = 0 and y < 0
  • _ATAN2(0, 0) is undefined and the function returns 0.


Errors

See also

  • ATN (arctangent)



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By usage
Main WIKI Page