使用缩放器旋转矢量圆形原点

rotating vector round origin using a scaler

我知道对于旋转 x = xcos(theta) - ysin(theta) 和 y = xsin(theta) + ycos(theta) 所以我写了下面的代码来做到这一点但是它失败了(错误的结果)并且我不知道为什么。

rotate(pScaler) {
    this.xResult = (this.getX() * Math.cos(this.pScaler)) - (this.getY() * Math.sin(this.pScaler));
    this.yResult = (this.getX() * Math.sin(this.pScaler)) + (this.getY() * Math.cos(this.pScaler));
    return new Vector(this.xResult, this.yResult, 0);
}

仔细检查后发现我已经复制并粘贴了有效的代码我不小心看到了错误的代码操作版本。