let getAngle = (x, y)=> {
var l = Math.sqrt(x*x + y*y);
var a = Math.acos(x/l);
var ret = a * 180 / Math.PI; //弧度转角度,方便调试
if (y < 0) {
return 360 - ret;
}
return ret;
}
console.log(getAngle(45,-45))
posted on
2021-02-20 16:13loocer
阅读(85)
评论(0)
编辑收藏举报