Difference between revisions of "ATAN2"
Jump to navigation
Jump to search
Navigation:
imported>Clippy m |
imported>Clippy m |
||
Line 8: | Line 8: | ||
{{Parameters}} | {{Parameters}} | ||
− | * ''y'' is the vertical axis position(row). | + | * ''y'' is the vertical axis position(row) as a positive, zero or negative floating point value. |
− | * ''x'' is the horizontal axis position(column). | + | * ''x'' is the horizontal axis position(column) as a positive, zero or negative floating point value. |
{{PageDescription}} | {{PageDescription}} | ||
+ | * _ATAN2(y, x) = [[ATN]](y# / x#) when x > 0 with any y value. Returns positive or negative. | ||
* The [[DOUBLE]] radian angle returned is positive for upper row values where y > 0. | * The [[DOUBLE]] radian angle returned is positive for upper row values where y > 0. | ||
+ | ::* _ATAN2(y, x) = [[ATN]](y# / x#) + [[_PI]] when x < 0 | ||
+ | ::* _ATAN2(y, x) = [[_PI]] / 2 when x = 0 | ||
* The [[DOUBLE]] radian angle returned is negative for lower 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 | + | ::* _ATAN2(y, x) = [[ATN]](y# / x#) - [[_PI]] when x < 0 |
− | + | ::* _ATAN2(y, x) = -[[_PI]] / 2 when x = 0 | |
− | + | * _ATAN2(0, 0) is undefined and the function returns 0 instead of a division error. | |
− | |||
− | * _ATAN2(y, x) = -[[_PI]] / 2 when x = | ||
− | * _ATAN2(0, 0) is undefined and the function returns 0 instead of | ||
{{PageErrors}} | {{PageErrors}} | ||
− | * Note: With [[ATN]](y / x), x can never be 0 | + | * Note: With [[ATN]](y / x), x can never be 0 as that would create a Division by Zero [[ERROR Codes|error]] 11. |
Revision as of 16:17, 15 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 positive, zero or negative floating point value.
- x is the horizontal axis position(column) as a positive, zero or negative floating point value.
Description
- _ATAN2(y, x) = ATN(y# / x#) when x > 0 with any y value. Returns positive or negative.
- 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(0, 0) is undefined and the function returns 0 instead of a division error.
Errors
See also
- ATN (arctangent)
- _PI (QB64 constant value)
- Mathematical Operations