欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

点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);
}

相关标签: 旋转