Corrected Arctangent
fatan2(x,y) Compute the corrected arctangent of x,y.
Arguments
| Argument | Description | Type | Constraints | Notes |
|---|
| x | | R | | |
| y | | R | | |
Return
| Value | Description | Type | Constraints | Notes |
|---|
| θ | direction angle | R | −π<θ≤π | |
Usage
f_{atan2}left(x, y\right)=left{x>0:\tan^{-1}left(rac{y}{x}\right), x<0: left{y<0:\tan^{-1}left(rac{y}{x}\right)-pi,\tan^{-1}left(rac{y}{x}\right)+pi\right}, x=0: left{y>0: rac{pi}{2}, y<0: -rac{pi}{2}, 0\right}, 0\right}
phi=f_{atan2}left(P.x, P.y\right)
left(tcosphi, tsinphi\right)
P=left(0.2, 0.2\right)
Implementation
fatan2(x,y)={x>0:tan−1(xy), x<0: {y<0:tan−1(xy)−π,tan−1(xy)+π}, x=0: {y>0: 2π, y<0: −2π, 0}, 0} Dependencies
None