_ATAN2

From QB64 Wiki
Revision as of 03:44, 15 November 2015 by imported>Clippy
Jump to navigation Jump to search

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).
  • x is the horizontal axis position(column).

Description

  • The DOUBLE radian angle returned is positive for upper row values where y > 0.
  • The DOUBLE radian angle returned is negative for lower row values where 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 instead of an error.


Errors

  • Note: With ATN(y / x), x can never be 0! That would create a Division by Zero error 11.


See also



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page