当前位置:网站首页>计算由两点定义的线的角度
计算由两点定义的线的角度
2022-08-01 23:03:00 【紫微前端】
JavaScript version
// In radians
const radiansAngle = (p1, p2) => Math.atan2(p2.y - p1.y, p2.x - p1.x);
// In degrees
const degreesAngle = (p1, p2) => (Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180) / Math.PI;
TypeScript version
interface Point {
x: number;
y: number;
}
const radiansAngle = (p1: Point, p2: Point): number => Math.atan2(p2.y - p1.y, p2.x - p1.x);
const degreesAngle = (p1: Point, p2: Point): number => (Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180) / Math.PI;
边栏推荐
- 【参营经历贴】2022网安夏令营
- 最短路模板
- Deep learning Course2 first week Practical aspects of Deep Learning exercises
- JS 数组去重(含简单数组去重、对象数组去重)
- Wechat Gymnasium Appointment Mini Program Graduation Design Finished Work (4) Opening Report
- excel remove all carriage return from a cell
- 2022/7/31
- 欧拉路径与欧拉回路
- SQL Server(设计数据库--存储过程--触发器)
- Prufer sequence
猜你喜欢
使用Jenkins做持续集成,这个知识点必须要掌握
华为无线设备配置全局双链路冷备份(AC全局配置方式)
Background project Express-Mysql-Vue3-TS-Pinia page layout-sidebar menu
【数据分析03】
分享10套开源免费的高品质源码,免费源码下载平台
Ten years after graduation, financial freedom: those things that are more important than hard work, no one will ever teach you
xctf攻防世界 Web高手进阶区 webshell
深度学习Course2第二周Optimization Algorithms习题整理
Postman batch test interface detailed tutorial
简单3D渲染器的制作
随机推荐
域名重定向工具 —— SwitchHosts 实用教程
牛客多校4 A.Task Computing 思维
excel edit a cell without double clicking
力扣第 304 场周赛复盘
Prufer序列
使用Jenkins做持续集成,这个知识点必须要掌握
Go 微服务开发框架DMicro的设计思路
Graph Theory - Strongly Connected Component Condensation + Topological Sort
C#大型互联网平台管理框架源码:基于ASP.NET MVC+EF6+Bootstrap开发,支持多数据库
How to prevent governance attacks in DAOs?
论文解读(GSAT)《Interpretable and Generalizable Graph Learning via Stochastic Attention Mechanism》
D - Linear Probing- 并查集
毕业作业
xss相关知识点以及从 XSS Payload 学习浏览器解码
xctf攻防世界 Web高手进阶区 web2
字符串——Trie
联邦学习的框架搭建
[机缘参悟-58]:《素书》-5-奉行仁义[遵义章第五]
13、学习MySQL 分组
小程序毕设作品之微信美食菜谱小程序毕业设计成品(6)开题答辩PPT