两点之间计算角度

两点之间水平角度

1
2
3
4
5
6
function rotateCompute(start,end){
var diff_x = end.x - start.x,
diff_y = end.y - start.y;
//返回角度,不是弧度
return 360*Math.atan(diff_y/diff_x)/(2*Math.PI);
}
分享到