Path: news.mathworks.com!not-for-mail
From: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Re: angle from rotation matrix
Date: Sat, 15 Dec 2007 20:32:35 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <fk1dl2$p4l$1@fred.mathworks.com>
References: <fjvbqk$gbt$1@fred.mathworks.com> <fk0cpd$g0v$1@fred.mathworks.com> <fk0iq9$k0j$1@fred.mathworks.com> <fk0rjr$rig$1@fred.mathworks.com>
Reply-To: "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
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 1197750755 25749 172.30.248.37 (15 Dec 2007 20:32:35 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 15 Dec 2007 20:32:35 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:442620


"Bruno Luong" <brunoluong@yahoo.com> wrote in message <fk0rjr$rig
$1@fred.mathworks.com>...
> 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
-------
  Your second method is better than mine, Bruno.  I hadn't noticed that the 
call to 'eig' could be eliminated altogether by using the fact that the vector,

 [A(3,2)-A(2,3);A(1,3)-A(3,1);A(2,1)-A(1,2)],

must necessarily lie along the axis of rotation.

Roger Stafford