当前位置:网站首页>Calculate the distance between two points
Calculate the distance between two points
2022-08-01 23:07:00 【Ziwei front end】
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));
边栏推荐
- Chapter 11 Working with Dates and Times
- How to use pywinauto and pyautogui to link the anime lady and sister please go home
- 小程序毕设作品之微信美食菜谱小程序毕业设计成品(5)任务书
- From 0 to 100: Notes on the Development of Enrollment Registration Mini Programs
- 隔离和降级
- PDF转Word有那么难吗?做一个文件转换器,都解决了
- Small application project works WeChat stadium booking applet graduation design of the finished product (1) the development profile
- [机缘参悟-58]:《素书》-5-奉行仁义[遵义章第五]
- 1. @Component注解的原理剖析
- 基于JAX的激活函数、softmax函数和交叉熵函数
猜你喜欢
文件查询匹配神器 【glob.js】 实用教程
Wechat Gymnasium Appointment Mini Program Graduation Design Finished Work (4) Opening Report
域名重定向工具 —— SwitchHosts 实用教程
简单3D渲染器的制作
SQL29 Calculate the average next day retention rate of users
APP专项测试:流量测试
小程序毕设作品之微信体育馆预约小程序毕业设计成品(2)小程序功能
img 响应式图片的实现(含srcset属性、sizes属性的使用方法,设备像素比详解)
从0到1:图文投票小程序设计与研发笔记
Small application project works WeChat stadium booking applet graduation design of the finished product (1) the development profile
随机推荐
03、GO语言变量定义、函数
vscode hide menu bar
解决 win10 下 ISE14.7的 iMPACT 崩溃问题 - FPGA 笔记
数据库表设计规则
PostgreSQL 基础--常用命令
When solving yolov5 training: "AssertionError: train: No labels in VOCData/dataSet_path/train.cache. Can not train"
Error creating bean with name ‘dataSource‘:Unsatisfied dependency expressed through field ‘basicPro
ping no reply
excel change cell size
Chapter 11 Working with Dates and Times
域名重定向工具 —— SwitchHosts 实用教程
C#大型互联网平台管理框架源码:基于ASP.NET MVC+EF6+Bootstrap开发,支持多数据库
E - Integer Sequence Fair
【参营经历贴】2022网安夏令营
【C补充】链表专题 - 单向链表
Use Jenkins for continuous integration, this knowledge point must be mastered
Three, mysql storage engine - building database and table operation
部门项目源码分享
perspectiveTransform warpPerspective getPerspectiveTransform findHomography
还在纠结报表工具的选型么?来看看这个