I have to write an algorithm that can given a rotation matrix, find $k$ and $f_i$. $R = \text{rotationMatrix}(k, f_i)$
I am given $R$ and need to find $k$ and $f_i$, but i don't know how to do this, and the only formula i know for converting $k$ and $f_i$ into a rotation matrix is
Any ideas on how I can attack this problem? Maybe use another formula to figure it out from?
Edit: Thank you for the help. This is the correct function
Reverse rotation
function [ k, fi ] = arot( R ) fi = acosd(0.5*(R(1,1)+R(2,2)+R(3,3)-1)); k = zeros(3,1); k(1) = (R(3,2)-R(2,3))/(2*sind(fi)); k(2) = (R(1,3)-R(3,1))/(2*sind(fi)); k(3) = (R(2,1)-R(1,2))/(2*sind(fi)); end
The rotation matrix
function R = rot(k,fi) % This is just to make it easyer to read! x = k(1); y = k(2); z = k(3); % Create a 3x3 zero matrix R = zeros(3,3); % We use the formual for rotationg matrix about a unit vector k R(1,1) = cosd(fi)+x^2*(1-cosd(fi)); R(1,2) = x*y*(1-cosd(fi))-z*sind(fi); R(1,3) = x*z*(1-cosd(fi))+y*sind(fi); R(2,1) = y*x*(1-cosd(fi))+z*sind(fi); R(2,2) = cosd(fi)+y^2*(1-cosd(fi)); R(2,3) = y*z*(1-cosd(fi))-x*sind(fi); R(3,1) = z.*x.*(1-cosd(fi))-y.*sind(fi); R(3,2) = z.*y.*(1-cosd(fi))+x.*sind(fi); R(3,3) = cosd(fi)+z^2.*(1-cosd(fi)); end