javascript 获取两点的像素距离

1 getPosLen(sdot, edot){//获取2点距离
2         /* 
3         56 40 56
4         40 00 40
5         56 40 56
6         */
7         return parseInt(Math.sqrt(Math.pow(Math.abs(sdot.x - edot.x), 2) + Math.pow(Math.abs(sdot.y - edot.y), 2)));
8 }

 

posted @ 2020-02-16 16:55  鸡儿er  阅读(345)  评论(0编辑  收藏  举报