matrixrotationcoordinate

Rotate in spherical coordinate


enter image description here

I want to rotate axis with spherical coordinate. There is a vector P. So I want to rotate axis z to p How can I make rotation matrix? I am not sure. So i just make rotation function like this. R=Rz*Ry Rz = cos (delta), -sin (delta), 0 sin (delta) ,cos (delta) ,0 0 , 0 , 1

Like these things...


Solution

  • 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)]