Rotation Matrix 3D

3D rotation matrix class

You are now following this Submission

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 (2026). Rotation Matrix 3D (https://www.mathworks.com/matlabcentral/fileexchange/46419-rotation-matrix-3d), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
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