Rotation Matrix 3D

Version 1.2.0.0 (3.82 KB) by AlbeCrive
3D rotation matrix class
802 Downloads
Updated 29 Jul 2015

View License

The class RotationMatrix allows to handle a 3D rotation matrix with different parametrizations:
- a [3x3] rotation matrix
- Euler angles
- exponential map
- quaternions
Once a RotationMatrix instance has been created from one of the parametrizations above,
all the parametrizations can be obtained interchangeably.
Additional static methods allow to convert a parametrization into another one without creating instances.

Examples:

% create a RotationMatrix from different parametrizations

r = RotationMatrix(rand([3,1]), 'exponentialMap');
r = RotationMatrix(eye(3), 'rotationMatrix');
r = RotationMatrix(rand([4,1]), 'quaternion');
r = RotationMatrix(rand([3,1]), 'eulerAngles');

% get a particular representation of a RotationMatrix

aMatrix = r.GetRotationMatrix();
aQuaternion = r.GetQuaternion();
eulerAngles = r.GetEulerAngles();
anExponentialMap = r.GetExponentialMap();

% use static methods for creating 3x3 rotation matrices:

rotationMatrix = RotationMatrix.ComputeRotationMatrixFromQuaternion(rand(4,1))
rotationMatrix = RotationMatrix.ComputeRotationMatrixFromEulerAngles(rand(), rand(), rand());
rotationMatrix = RotationMatrix.ComputeRotationMatrixFromExponentialMap(rand(3,1))

% See RotationMatrixTest.m for further examples.

Cite As

AlbeCrive (2024). Rotation Matrix 3D (https://www.mathworks.com/matlabcentral/fileexchange/46419-rotation-matrix-3d), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.2.0.0

quaternion computation ok for degenerate cases

1.1.0.0

Updated computation of angle/axis from matrix for numerical stability.

1.0.0.0