我想用球坐标旋转轴。 有一个矢量P. 所以我想将轴z旋转到p 如何制作旋转矩阵? 我不确定。所以我只是做这样的旋转功能。 R = RZ * RY Rz = cos(delta), - sin(delta),0 sin(delta),cos(delta),0 0,0,1
喜欢这些东西......
答案 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)]