Search All of the Math Forum:

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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

 Messages: [ Previous | Next ]
 Colin Posts: 3 Registered: 10/28/11
Re: Computing rotation matrix from one vector
Posted: Oct 28, 2011 2:50 PM

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <imrs24\$rq6\$1@fred.mathworks.com>...
> 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

Bruno,

Thank you so much for this. I was really struggling with this exact problem. You make it look so easy.

Date Subject Author
3/29/11 Carlos Junior
3/29/11 Rune Allnor
3/29/11 Carlos Junior
3/29/11 Bruno Luong
10/28/11 Colin
3/29/11 Bruno Luong
3/29/11 Bruno Luong
3/29/11 Carlos Junior