CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

LieGroups.Analysis.rotationAngle

Principal SO(3) angle represented by a rotation matrix

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputRReal[3, 3]
outputangleRealAngle in [0, pi]

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function rotationAngle "Principal SO(3) angle represented by a rotation matrix"
  input Real R[3, 3];
  output Real angle "Angle in [0, pi]";
protected
  Real cosine;
algorithm
  cosine := max(-1.0, min(1.0, 0.5 * (R[1, 1] + R[2, 2] + R[3, 3] - 1.0)));
  angle := acos(cosine);
end rotationAngle;