慕九州9195492
2021-07-17 17:00
point.getDistances()
/**
* 计算a到b的距离
* @param a
* @param b
*/
let getDistance = (a: Point, b:Point) => {
let dx = a.x - b.x;
let dy = a.y - b.y;
let distance:number = Math.sqrt(dx*dx+dy*dy);
console.log('distance = ', distance);
}
point.getDistances(p: 345)
2小时极速入门 TypeScript
26622 学习 · 64 问题
相似问题