意义
首先我们要了解 t a n ( θ ) tan(\theta) tan(θ)。 t a n ( θ ) tan(\theta) tan(θ)是给出弧度值,求正切值;而 a t a n 2 ( x , y ) atan2(x,y) atan2(x,y)是已知一个角的正切值,求这个角的弧度值。
a t a n 2 ( y , x ) atan2(y,x) atan2(y,x)的值为点 ( x , y ) (x,y) (x,y)与原点的连线同 x x x轴正半轴的夹角。如 a t a n 2 ( 1 , 1 ) = π 4 atan2(1,1)=\frac{\pi}{4} atan2(1,1)=4π。

角度制与弧度值的转换: a ∘ = a π 18 0 ∘ a^\circ=\frac{a\pi}{180^\circ} a∘=180∘aπ
用法
c++中的atan2()
double atan2(double y,double x);
讯享网
code
讯享网#include<bits/stdc++.h> using namespace std; double x,y; int main() {
scanf("%lf%lf",&x,&y); printf("%.5f",atan2(y,x)); return 0; }

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/87047.html