当前位置:网站首页>Calculate the angle of a line defined by two points
Calculate the angle of a line defined by two points
2022-08-01 23:08:00 【Ziwei front end】
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;
边栏推荐
- Calculate the midpoint between two points
- 部门项目源码分享
- y84. Chapter 4 Prometheus Factory Monitoring System and Actual Combat -- Advanced Prometheus Alarm Mechanism (15)
- npm npm
- 使用Jenkins做持续集成,这个知识点必须要掌握
- 将vim与系统剪贴板的交互使用
- excel edit a cell without double clicking
- 论文解读(GSAT)《Interpretable and Generalizable Graph Learning via Stochastic Attention Mechanism》
- 下载安装 vscode(含汉化、插件的推荐和安装)
- 杭电多校3 1012. Two Permutations dp*
猜你喜欢
牛客多校4 A.Task Computing 思维
JS prototype hasOwnProperty in Add method Prototype end point Inherit Override parent class method
How to add a game character to a UE4 scene
小程序毕设作品之微信美食菜谱小程序毕业设计成品(8)毕业设计论文模板
Is TCP reliable?Why?
编曲软件FL studio20.8中文版功能和作用
C#大型互联网平台管理框架源码:基于ASP.NET MVC+EF6+Bootstrap开发,支持多数据库
PHP算法之电话号码的字母组合
移动端人脸风格化技术的应用
Codeforces CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) A-D Solution
随机推荐
移动端人脸风格化技术的应用
从0到1:图文投票小程序设计与研发笔记
PostgreSQL 基础--常用命令
excel change cell size
13、学习MySQL 分组
JS 数组去重(含简单数组去重、对象数组去重)
A. Doremy‘s IQ-- Codeforces Round #808 (Div. 1)
excel clear format
Additional Features for Scripting
【C补充】链表专题 - 单向链表
三、mysql 存储引擎-建库建表操作
SQL Server (design database--stored procedure--trigger)
ping no reply
Ten years after graduation, financial freedom: those things that are more important than hard work, no one will ever teach you
欧拉路径与欧拉回路
论文理解【RL - Exp Replay】—— Experience Replay with Likelihood-free Importance Weights
vscode hide menu bar
SQL29 Calculate the average next day retention rate of users
解决端口占用
D - Linear Probing- 并查集