Matrix 在球坐标系中旋转

Matrix 在球坐标系中旋转,matrix,rotation,coordinate,Matrix,Rotation,Coordinate,我想用球坐标旋转轴。 有一个向量P。 所以我想把z轴旋转到p轴 如何制作旋转矩阵? 我不确定。所以我只做了这样的旋转函数。R=Rz*Ry Rz=cos(δ),-sin(δ),0 sin(delta),cos(delta),0 0,0,1 像这些东西 Let w=P/r=[sin(t)cos(f), sin(t)sin(f), cos(t)] v=[cos(f), sin(f), 0] u=v ^ k = [sin(f), -cos(f), 0] (cross product) In the

我想用球坐标旋转轴。 有一个向量P。 所以我想把z轴旋转到p轴 如何制作旋转矩阵? 我不确定。所以我只做了这样的旋转函数。R=Rz*Ry Rz=cos(δ),-sin(δ),0 sin(delta),cos(delta),0 0,0,1

像这些东西

Let w=P/r=[sin(t)cos(f), sin(t)sin(f), cos(t)]
v=[cos(f), sin(f), 0]
u=v ^ k = [sin(f), -cos(f), 0]  (cross product)

In the plan (v, k):
R(v)=cos(t)v -sin(t)k

R(k)=w=sin(t)v+cos(t)k

i,j,k function of u, v, k:

u=sin(f)i-cos(f)j
v=cos(f)i+sin(f)j

(1)sin(f)+(2)cos(f) and (1)(-cos(f))+(2)sin(f):

i=sin(f)u+cos(f)v
j=-cos(f)u+sin(f)v

As R(u)=u, R(k)=w, R(v)=cos(t)v-sin(t)k and (u,v,k) orthonormal:

R(i)=sin(f)u+cos(f)cos(t)v-cos(f)sin(t)k

R(i).i=sin^2(f)+cos^2(f)cos(t)
R(i).j=-cos(f)sin(f)+sin(f)cos(f)cos(t)
R(i).k=-cos(f)sin(t)
...

matrix in (i,j,k):

[sin^2(f)+cos^2(f)cos(t),  -sin(f)cos(f)+cos(f)cos(t)sin(f),  cos(f)sin(t)]
[-sin(f)cos(f)+cos(f)cos(t)sin(f), cos^2(f)+sin^2(f)cos(t), sin(f)sin(t)]
[-cos(f)sin(t),                    -sin(f)sin(t),           cos(t)]      

For information, the matrix in (u, v, k):
[1  , 0,   0]
[0,   cos(t),  sin(t)]
[0,   -sin(t), cos(t)]