sustaining_gazes/matlab_version/pdm_generation/PDM_helpers/Rot2AxisAngle.m

12 lines
318 B
Mathematica
Raw Normal View History

2016-04-28 21:40:36 +02:00
function [ axisAngle ] = Rot2AxisAngle( Rot )
%ROT2AXISANGLE Summary of this function goes here
% Detailed explanation goes here
theta = acos((trace(Rot) - 1) / 2);
vec = 1.0/(2*sin(theta));
vec = vec * [Rot(3,2) - Rot(2,3), Rot(1,3) - Rot(3,1), Rot(2,1) - Rot(1,2)];
axisAngle = vec * theta;
end