当前位置:网站首页>Unity——Mathf. Similarities and differences between atan and atan2
Unity——Mathf. Similarities and differences between atan and atan2
2022-06-26 19:16:00 【DESIDERIO】
Catalog
identical
Atan and Atan2 Are all arctangent functions
Such as : There are two points. point(x1,y1), and point(x2,y2), Then the angle calculation method of the slope formed by these two points is :
float angle = Atan((y2-y1) / (x2-x1));
float angle = Atan2( y2-y1, x2-x1 );
difference
1: Parameters are filled in in different ways .
public static float Atan2 (float y, float x);
public static float Atan (float f);
2:Atan2 The advantage is If x2-x1 be equal to 0 It can still be calculated , however Atan Function will cause program error .
3:Mathf.Atan() The range of returned values is [-π/2,π/2],Mathf.Atan() The range of returned values is [-π/2,π/2].
Reference resources
atan Function and atan2 A little difference between functions
边栏推荐
猜你喜欢
随机推荐
Redis Basics
The king of Internet of things protocol: mqtt
50 lines of code to crawl TOP500 books and import TXT documents
Determine whether a sequence is a stack pop-up sequence
Tiktok practice ~ sharing module ~ generate short video QR code
股票开户的具体步骤是什么?网上开户安全吗?
find_ path、find_ Library memo
ROS query topic specific content common instructions
Tiktok practice ~ search page ~ video details
微信小程序 自定义 弹框组件
物联网协议的王者:MQTT
数据库范式和主码的选择
[kubernetes] kubernetes principle analysis and practical application (under update)
Microservice architecture
Union, intersection and difference operations in SQL
Feign remote call
Chain game development finished product source code chain game system development details
ARM裸板调试之串口打印及栈初步分析
项目实战六:分布式事务-Seata
Nftgamefi chain game system development detailed solution - chain game system development principle analysis