设有二维向量 v ⃗ = ( x , y ) \vec{v} = (x, y) v=(x,y),将其旋转 θ \theta θ 度(逆时针旋转时 θ > 0 \theta>0 θ>0;顺时针旋转时 θ < 0 \theta<0 θ<0)。旋转矩阵 R R R 可以表示为:
R = [ cos θ − sin θ sin θ cos θ ] R = \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix} R=[cosθsinθ−sinθcosθ]
旋转后的向量 v ′ ⃗ \vec{v'} v′ 可以通过以下公式计算:
v ′ ⃗ = R v ⃗ \vec{v'} = R \vec{v} v′=Rv
将 v ⃗ \vec{v} v 和 R R R 代入,我们得到:
v ′ ⃗ = [ cos θ − sin θ sin θ cos θ ] [ x y ] \vec{v'} = \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} v′=[cosθsinθ−sinθcosθ][xy]
所以旋转后的向量 v ′ ⃗ \vec{v'} v′ 的坐标为 ( x cos θ − y sin θ , x sin θ + y cos θ ) (x \cos \theta - y \sin \theta, x \sin \theta + y \cos \theta) (xcosθ−ysinθ,xsinθ+ycosθ)。