Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Computing rotation matrix from one vector
Replies: 7   Last Post: Oct 28, 2011 2:50 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bruno Luong

Posts: 8,824
Registered: 7/26/08
Re: Computing rotation matrix from one vector
Posted: Mar 29, 2011 1:52 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Note thet R cannot be NOT uniquely determined from ONE vector and its rotation. You need at least two pairs.

u = [ 0.245 -0.563 -0.055 ]';
v = [ 0.3 -0.5 0.2 ]' ;

u1 = u/norm(u)
v1 = v/norm(v)

k = cross(u1,v1);
% Rodrigues's formula:
costheta = dot(u1,v1);
R =[ 0 -k(3) k(2);
k(3) 0 -k(1);
-k(2) k(1) 0];
R = costheta*eye(3) + R + k*k'*(1-costheta)/sum(k.^2);

disp(v)
disp(R*u)

% Bruno



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.