向量(x, y)逆时针绕起点旋转
α度后得到的向量(x’, y’):
x′=xcosα−ysinα
y′=xsinα+ycosα
推导过程:
d=x2+y2
cosθ=x/d
sinθ=y/d
cos(θ+α)=x′/d
sin(θ+α)=y′/d
由:
cos(α+θ)=cosαcosθ−sinαsinθ
sin(α+θ)=sinαcosθ+cosαsinθ
得:
cos(θ+α)=cosαcosθ−sinαsinθ
=cosαdx−sinαdy=dx′
sin(θ+α)=sinαcosθ+cosαsinθ
=sinαdx+cosαdy=dy′
消除
d得:
x′=cosα⋅x−sinα⋅y
y′=sinα⋅x+cosα⋅y