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
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > Formatting and Annotation > 3-D Scene Control >
- Aerospace > Aerospace Toolbox > Standard Workflow Procedures > Coordinate Systems > Quaternion Math >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.