点A围绕点B 旋转 A度
程序员文章站
2022-04-01 18:41:58
...
Control.prototype.RotatePoint = function (point, center, a) {
var ang = a / 180 * Math.PI;
var x = (point.x - center.x) * Math.cos(ang) - (point.y - center.y) * Math.sin(ang) + center.x;
var y = (point.x - center.x) * Math.sin(ang) + (point.y - center.y) * Math.cos(ang) + center.y;
return new Point(x, y);
}