【C++】【数学】arctan

atan 和 atan2 都是求反正切函数,如:有两个点 point(x1,y1), 和 point(x2,y2);

那么这两个点形成的斜率的角度计算方法分别是:

float angle = atan( (y2-y1)/(x2-x1) );

float angle = atan2( y2-y1, x2-x1 );     输出角度在[-PI, PI]

 

 atan 和 atan2 区别:

1:参数的填写方式不同;

2:atan2 的优点在于 如果 x2-x1等于0 依然可以计算,但是atan函数就会导致程序出错;

 

https://www.cnblogs.com/feifanrensheng/p/8672437.html

https://blog.csdn.net/tuyang120428941/article/details/5822041?spm=1001.2101.3001.6650.16&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-16-5822041-blog-122695295.t5_layer_eslanding_A_4&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-16-5822041-blog-122695295.t5_layer_eslanding_A_4&utm_relevant_index=19

https://blog.csdn.net/weixin_42142612/article/details/80972768

https://blog.csdn.net/qq_30460949/article/details/122695295

posted @   星火-AI  阅读(2916)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2021-08-31 Autoware 源码解读
点击右上角即可分享
微信分享提示