Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <brunoluong@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: angle from rotation matrix
Date: Sat, 15 Dec 2007 15:24:43 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <fk0rjr$rig$1@fred.mathworks.com>
References: <fjvbqk$gbt$1@fred.mathworks.com> <fk0cpd$g0v$1@fred.mathworks.com> <fk0iq9$k0j$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <brunoluong@yahoo.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1197732283 28240 172.30.248.37 (15 Dec 2007 15:24:43 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 15 Dec 2007 15:24:43 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1184112
Xref: news.mathworks.com comp.soft-sys.matlab:442601


Sorry, I forgot to give detail on calculation of the
rotation vector:

c=(trace(A)-1);
u=[A(3,2)-A(2,3);...
   A(1,3)-A(3,1); ...
   A(2,1)-A(1,2)];
s=norm(u);
theta=atan2(s,c)

if s>0
    u=u/s
else
    warning('A close to identity, arbitrary result');
    u=[1 0 0]
end