No BSD License  

Highlights from
Compute 3D rotation matrix

2.0

2.0 | 1 rating Rate this file 55 Downloads (last 30 days) File Size: 1.13 KB File ID: #23417

Compute 3D rotation matrix

by Stanley

 

24 Mar 2009

Simplifies computation of 3D rotation matrices.

| Watch this File

File Information
Description

Given input:
r: angle to rotate, in rads
Axis: axis of rotation, defined as a 3point which connects to the origin.

Output:
3x3 Matrix R such that for an arbitrary point v, Rv is the point corresponding to v rotated around the Axis.

% example:
% rotate around a random direction a random amount and then back
% the result should be an Identity matrix

r = rand(4,1);
rotationmat3D(r(1),[r(2),r(3),r(4)]) * rotationmat3D(-r(1),[r(2),r(3),r(4)])

ans =

    1.0000 0.0000 0.0000
    0.0000 1.0000 0
    0.0000 0 1.0000

%
% example2:
% rotate around z axis 45 degrees
 Rtest = rotationmat3D(pi/4,[0 0 1])
Rtest =

    0.7071 -0.7071 0
    0.7071 0.7071 0
         0 0 1.0000

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
27 Oct 2011 Mohammad  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
geometry Stanley 25 Mar 2009 16:02:22
3d Stanley 25 Mar 2009 16:02:22
geometry dawn 19 May 2010 07:39:34
3d dawn 19 May 2010 07:39:36
3d edi2005 Edi 22 Oct 2010 03:19:18
geometry edi2005 Edi 22 Oct 2010 03:19:21
3d Julien 12 May 2011 05:42:00

Contact us at files@mathworks.com