当前位置:网站首页>计算两点之间的距离
计算两点之间的距离
2022-08-01 23:03:00 【紫微前端】
JavaScript version
const distance = (p1, p2) => Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
TypeScript version
interface Point {
x: number;
y: number;
}
const distance = (p1: Point, p2: Point): number => Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
边栏推荐
- NgRx Store createSelector 的单步调试和源代码分析
- excel change cell size
- 【C补充】链表专题 - 单向链表
- 小程序毕设作品之微信体育馆预约小程序毕业设计成品(1)开发概要
- 基于JAX的激活函数、softmax函数和交叉熵函数
- E - Integer Sequence Fair
- When solving yolov5 training: "AssertionError: train: No labels in VOCData/dataSet_path/train.cache. Can not train"
- Interpretation of the paper (GSAT) "Interpretable and Generalizable Graph Learning via Stochastic Attention Mechanism"
- AQS
- 欧拉路径与欧拉回路
猜你喜欢
10年稳定性保障经验总结,故障复盘要回答哪三大关键问题?|TakinTalks大咖分享
罗克韦尔AB PLC RSLogix5000中的比较指令使用方法介绍
小程序毕设作品之微信美食菜谱小程序毕业设计成品(7)中期检查报告
联邦学习在金融领域的发展和应用
数据分析04
When solving yolov5 training: "AssertionError: train: No labels in VOCData/dataSet_path/train.cache. Can not train"
System availability: 3 9s, 4 9s in SRE's mouth... What is it?
编曲软件FL studio20.8中文版功能和作用
CAKE:一个用于多视图知识图谱补全的可扩展性常识感知框架
img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)
随机推荐
PAM 回文自动机
NgRx Selector 的 Memoization 特性学习笔记
excel clear format
Codeforces CodeTON Round 2 (Div. 1 + Div. 2, Rated, Prizes!) A-D Solution
Mini Program Graduation Works WeChat Food Recipe Mini Program Graduation Design Finished Product (8) Graduation Design Thesis Template
13、学习MySQL 分组
Prufer序列
xctf攻防世界 Web高手进阶区 webshell
简单3D渲染器的制作
excel split text into different rows
Jmeter是什么
小程序毕设作品之微信体育馆预约小程序毕业设计成品(2)小程序功能
CAKE:一个用于多视图知识图谱补全的可扩展性常识感知框架
img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)
Chapter 19 Tips and Traps: Common Goofs for Novices
最短路模板
杭电多校3 1012. Two Permutations dp*
JS 数组去重(含简单数组去重、对象数组去重)
线上故障排查方案
小程序毕设作品之微信体育馆预约小程序毕业设计成品(4)开题报告