HOME

TheInfoList



OR:

In
geometry Geometry (; ) is a branch of mathematics concerned with properties of space such as the distance, shape, size, and relative position of figures. Geometry is, along with arithmetic, one of the oldest branches of mathematics. A mathematician w ...
, there exist various rotation formalisms to express a
rotation Rotation or rotational/rotary motion is the circular movement of an object around a central line, known as an ''axis of rotation''. A plane figure can rotate in either a clockwise or counterclockwise sense around a perpendicular axis intersect ...
in three dimensions as a mathematical transformation. In physics, this concept is applied to
classical mechanics Classical mechanics is a Theoretical physics, physical theory describing the motion of objects such as projectiles, parts of Machine (mechanical), machinery, spacecraft, planets, stars, and galaxies. The development of classical mechanics inv ...
where rotational (or angular)
kinematics In physics, kinematics studies the geometrical aspects of motion of physical objects independent of forces that set them in motion. Constrained motion such as linked machine parts are also described as kinematics. Kinematics is concerned with s ...
is the science of quantitative description of a purely rotational
motion In physics, motion is when an object changes its position with respect to a reference point in a given time. Motion is mathematically described in terms of displacement, distance, velocity, acceleration, speed, and frame of reference to an o ...
. The orientation of an object at a given instant is described with the same tools, as it is defined as an imaginary rotation from a reference placement in space, rather than an actually observed rotation from a previous placement in space. According to Euler's rotation theorem, the rotation of a
rigid body In physics, a rigid body, also known as a rigid object, is a solid body in which deformation is zero or negligible, when a deforming pressure or deforming force is applied on it. The distance between any two given points on a rigid body rema ...
(or three-dimensional
coordinate system In geometry, a coordinate system is a system that uses one or more numbers, or coordinates, to uniquely determine and standardize the position of the points or other geometric elements on a manifold such as Euclidean space. The coordinates are ...
with a fixed origin) is described by a single rotation about some axis. Such a rotation may be uniquely described by a minimum of three real parameters. However, for various reasons, there are several ways to represent it. Many of these representations use more than the necessary minimum of three parameters, although each of them still has only three
degrees of freedom In many scientific fields, the degrees of freedom of a system is the number of parameters of the system that may vary independently. For example, a point in the plane has two degrees of freedom for translation: its two coordinates; a non-infinite ...
. An example where rotation representation is used is in
computer vision Computer vision tasks include methods for image sensor, acquiring, Image processing, processing, Image analysis, analyzing, and understanding digital images, and extraction of high-dimensional data from the real world in order to produce numerical ...
, where an automated observer needs to track a target. Consider a rigid body, with three orthogonal unit vectors fixed to its body (representing the three axes of the object's local
coordinate system In geometry, a coordinate system is a system that uses one or more numbers, or coordinates, to uniquely determine and standardize the position of the points or other geometric elements on a manifold such as Euclidean space. The coordinates are ...
). The basic problem is to specify the orientation of these three
unit vector In mathematics, a unit vector in a normed vector space is a Vector (mathematics and physics), vector (often a vector (geometry), spatial vector) of Norm (mathematics), length 1. A unit vector is often denoted by a lowercase letter with a circumfle ...
s, and hence the rigid body, with respect to the observer's coordinate system, regarded as a reference placement in space.


Rotations and motions

Rotation formalisms are focused on proper ( orientation-preserving) motions of the
Euclidean space Euclidean space is the fundamental space of geometry, intended to represent physical space. Originally, in Euclid's ''Elements'', it was the three-dimensional space of Euclidean geometry, but in modern mathematics there are ''Euclidean spaces ...
with one fixed point, that a ''rotation'' refers to. Although physical motions with a fixed point are an important case (such as ones described in the
center-of-mass frame In physics, the center-of-momentum frame (COM frame) of a system, also known as zero-momentum frame, is the inertial frame in which the total momentum of the system vanishes. It is unique up to velocity, but not origin. The ''center of momentum' ...
, or motions of a
joint A joint or articulation (or articular surface) is the connection made between bones, ossicles, or other hard structures in the body which link an animal's skeletal system into a functional whole.Saladin, Ken. Anatomy & Physiology. 7th ed. McGraw- ...
), this approach creates a knowledge about all motions. Any proper motion of the Euclidean space decomposes to a rotation around the origin and a
translation Translation is the communication of the semantics, meaning of a #Source and target languages, source-language text by means of an Dynamic and formal equivalence, equivalent #Source and target languages, target-language text. The English la ...
. Whichever the order of their composition will be, the "pure" rotation component wouldn't change, uniquely determined by the complete motion. One can also understand "pure" rotations as
linear map In mathematics, and more specifically in linear algebra, a linear map (also called a linear mapping, linear transformation, vector space homomorphism, or in some contexts linear function) is a mapping V \to W between two vector spaces that p ...
s in a
vector space In mathematics and physics, a vector space (also called a linear space) is a set (mathematics), set whose elements, often called vector (mathematics and physics), ''vectors'', can be added together and multiplied ("scaled") by numbers called sc ...
equipped with Euclidean structure, not as maps of points of a corresponding
affine space In mathematics, an affine space is a geometric structure that generalizes some of the properties of Euclidean spaces in such a way that these are independent of the concepts of distance and measure of angles, keeping only the properties relat ...
. In other words, a rotation formalism captures only the rotational part of a motion, that contains three degrees of freedom, and ignores the translational part, that contains another three. When representing a rotation as numbers in a computer, some people prefer the quaternion representation or the axis+angle representation, because they avoid the
gimbal lock Gimbal lock is the loss of one degree of freedom (mechanics), degree of freedom in a multi-dimensional mechanism at certain alignments of the axes. In a three-dimensional three-gimbal mechanism, gimbal lock occurs when the axes of two of the gi ...
that can occur with Euler rotations.


Formalism alternatives


Rotation matrix

The above-mentioned triad of
unit vector In mathematics, a unit vector in a normed vector space is a Vector (mathematics and physics), vector (often a vector (geometry), spatial vector) of Norm (mathematics), length 1. A unit vector is often denoted by a lowercase letter with a circumfle ...
s is also called a basis. Specifying the coordinates (''components'') of vectors of this basis in its current (rotated) position, in terms of the reference (non-rotated) coordinate axes, will completely describe the rotation. The three unit vectors, , and , that form the rotated basis each consist of 3 coordinates, yielding a total of 9 parameters. These parameters can be written as the elements of a matrix , called a rotation matrix. Typically, the coordinates of each of these vectors are arranged along a column of the matrix (however, beware that an alternative definition of rotation matrix exists and is widely used, where the vectors' coordinates defined above are arranged by rows) \mathbf = \begin \hat_x & \hat_x & \hat_x \\ \hat_y & \hat_y & \hat_y \\ \hat_z & \hat_z & \hat_z \\ \end The elements of the rotation matrix are not all independent—as Euler's rotation theorem dictates, the rotation matrix has only three degrees of freedom. The rotation matrix has the following properties: * is a real,
orthogonal matrix In linear algebra, an orthogonal matrix, or orthonormal matrix, is a real square matrix whose columns and rows are orthonormal vectors. One way to express this is Q^\mathrm Q = Q Q^\mathrm = I, where is the transpose of and is the identi ...
, hence each of its rows or columns represents a
unit vector In mathematics, a unit vector in a normed vector space is a Vector (mathematics and physics), vector (often a vector (geometry), spatial vector) of Norm (mathematics), length 1. A unit vector is often denoted by a lowercase letter with a circumfle ...
. * The
eigenvalues In linear algebra, an eigenvector ( ) or characteristic vector is a vector that has its direction unchanged (or reversed) by a given linear transformation. More precisely, an eigenvector \mathbf v of a linear transformation T is scaled by a ...
of are \left\ = \ where is the standard
imaginary unit The imaginary unit or unit imaginary number () is a mathematical constant that is a solution to the quadratic equation Although there is no real number with this property, can be used to extend the real numbers to what are called complex num ...
with the property * The
determinant In mathematics, the determinant is a Scalar (mathematics), scalar-valued function (mathematics), function of the entries of a square matrix. The determinant of a matrix is commonly denoted , , or . Its value characterizes some properties of the ...
of is +1, equivalent to the product of its eigenvalues. * The trace of is , equivalent to the sum of its eigenvalues. The angle which appears in the eigenvalue expression corresponds to the angle of the Euler axis and angle representation. The
eigenvector In linear algebra, an eigenvector ( ) or characteristic vector is a vector that has its direction unchanged (or reversed) by a given linear transformation. More precisely, an eigenvector \mathbf v of a linear transformation T is scaled by ...
corresponding to the eigenvalue of 1 is the accompanying Euler axis, since the axis is the only (nonzero) vector which remains unchanged by left-multiplying (rotating) it with the rotation matrix. The above properties are equivalent to \begin , \hat, = , \hat, = , \hat, &= 1\\ \hat \cdot \hat &= 0\\ \hat \times \hat &= \hat \,, \end which is another way of stating that form a 3D
orthonormal basis In mathematics, particularly linear algebra, an orthonormal basis for an inner product space V with finite Dimension (linear algebra), dimension is a Basis (linear algebra), basis for V whose vectors are orthonormal, that is, they are all unit vec ...
. These statements comprise a total of 6 conditions (the cross product contains 3), leaving the rotation matrix with just 3 degrees of freedom, as required. Two successive rotations represented by matrices and are easily combined as elements of a group, \mathbf_\text = \mathbf_2\mathbf_1 (Note the order, since the vector being rotated is multiplied from the right). The ease by which vectors can be rotated using a rotation matrix, as well as the ease of combining successive rotations, make the rotation matrix a useful and popular way to represent rotations, even though it is less concise than other representations.


Euler axis and angle (rotation vector)

From Euler's rotation theorem we know that any rotation can be expressed as a single rotation about some axis. The axis is the unit vector (unique except for sign) which remains unchanged by the rotation. The magnitude of the angle is also unique, with its sign being determined by the sign of the rotation axis. The axis can be represented as a three-dimensional
unit vector In mathematics, a unit vector in a normed vector space is a Vector (mathematics and physics), vector (often a vector (geometry), spatial vector) of Norm (mathematics), length 1. A unit vector is often denoted by a lowercase letter with a circumfle ...
\hat = \begin e_x \\ e_y \\ e_z \end and the angle by a scalar . Since the axis is normalized, it has only two
degrees of freedom In many scientific fields, the degrees of freedom of a system is the number of parameters of the system that may vary independently. For example, a point in the plane has two degrees of freedom for translation: its two coordinates; a non-infinite ...
. The angle adds the third degree of freedom to this rotation representation. One may wish to express rotation as a rotation vector, or Euler vector, an un-normalized three-dimensional vector the direction of which specifies the axis, and the length of which is , \mathbf = \theta \hat\,. The rotation vector is useful in some contexts, as it represents a three-dimensional rotation with only three scalar values (its components), representing the three degrees of freedom. This is also true for representations based on sequences of three Euler angles (see below). If the rotation angle is zero, the axis is not uniquely defined. Combining two successive rotations, each represented by an Euler axis and angle, is not straightforward, and in fact does not satisfy the law of vector addition, which shows that finite rotations are not really vectors at all. It is best to employ the rotation matrix or quaternion notation, calculate the product, and then convert back to Euler axis and angle.


Euler rotations

The idea behind Euler rotations is to split the complete rotation of the coordinate system into three simpler constitutive rotations, called
precession Precession is a change in the orientation of the rotational axis of a rotating body. In an appropriate reference frame it can be defined as a change in the first Euler angle, whereas the third Euler angle defines the rotation itself. In o ...
, nutation, and intrinsic rotation, being each one of them an increment on one of the Euler angles. Notice that the outer matrix will represent a rotation around one of the axes of the reference frame, and the inner matrix represents a rotation around one of the moving frame axes. The middle matrix represents a rotation around an intermediate axis called line of nodes. However, the definition of Euler angles is not unique and in the literature many different conventions are used. These conventions depend on the axes about which the rotations are carried out, and their sequence (since rotations on a sphere are non-commutative). The convention being used is usually indicated by specifying the axes about which the consecutive rotations (before being composed) take place, referring to them by index or letter . The engineering and robotics communities typically use 3-1-3 Euler angles. Notice that after composing the independent rotations, they do not rotate about their axis anymore. The most external matrix rotates the other two, leaving the second rotation matrix over the line of nodes, and the third one in a frame comoving with the body. There are possible combinations of three basic rotations but only of them can be used for representing arbitrary 3D rotations as Euler angles. These 12 combinations avoid consecutive rotations around the same axis (such as XXY) which would reduce the degrees of freedom that can be represented. Therefore, Euler angles are never expressed in terms of the external frame, or in terms of the co-moving rotated body frame, but in a mixture. Other conventions (e.g.,
rotation matrix In linear algebra, a rotation matrix is a transformation matrix that is used to perform a rotation (mathematics), rotation in Euclidean space. For example, using the convention below, the matrix :R = \begin \cos \theta & -\sin \theta \\ \sin \t ...
or quaternions) are used to avoid this problem. In
aviation Aviation includes the activities surrounding mechanical flight and the aircraft industry. ''Aircraft'' include fixed-wing and rotary-wing types, morphable wings, wing-less lifting bodies, as well as lighter-than-air aircraft such as h ...
orientation of the aircraft is usually expressed as intrinsic Tait-Bryan angles following the convention, which are called ''heading'', ''elevation'', and ''bank'' (or synonymously, ''yaw'', ''pitch'', and ''roll'').


Quaternions

Quaternion In mathematics, the quaternion number system extends the complex numbers. Quaternions were first described by the Irish mathematician William Rowan Hamilton in 1843 and applied to mechanics in three-dimensional space. The algebra of quater ...
s, which form a four-dimensional
vector space In mathematics and physics, a vector space (also called a linear space) is a set (mathematics), set whose elements, often called vector (mathematics and physics), ''vectors'', can be added together and multiplied ("scaled") by numbers called sc ...
, have proven very useful in representing rotations due to several advantages over the other representations mentioned in this article. A quaternion representation of rotation is written as a versor (normalized quaternion): \hat =q_i\mathbf+q_j\mathbf+q_k\mathbf+q_r = \begin q_i \\ q_j \\ q_k \\ q_r \end The above definition stores the quaternion as an array following the convention used in (Wertz 1980) and (Markley 2003). An alternative definition, used for example in (Coutsias 1999) and (Schmidt 2001), defines the "scalar" term as the first quaternion element, with the other elements shifted down one position. In terms of the Euler axis \hat = \begin e_x \\ e_y \\ e_z \end and angle this versor's components are expressed as follows: \begin q_i &= e_x\sin\frac\\ q_j &= e_y\sin\frac\\ q_k &= e_z\sin\frac\\ q_r &= \cos\frac \end Inspection shows that the quaternion parametrization obeys the following constraint: q_i^2 + q_j^2 + q_k^2 + q_r^2 = 1 The last term (in our definition) is often called the scalar term, which has its origin in quaternions when understood as the mathematical extension of the complex numbers, written as a + b i + c j + d k \qquad \text a, b, c, d \in \R and where are the
hypercomplex number In mathematics, hypercomplex number is a traditional term for an element (mathematics), element of a finite-dimensional Algebra over a field#Unital algebra, unital algebra over a field, algebra over the field (mathematics), field of real numbers. ...
s satisfying \begin i^2 &=& j^2 &=& k^2 &=& -1\\ ij &=& -ji &=& k&&\\ jk &=& -kj &=& i&&\\ ki &=& -ik &=& j&& \end Quaternion multiplication, which is used to specify a composite rotation, is performed in the same manner as multiplication of
complex numbers In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the form a ...
, except that the order of the elements must be taken into account, since multiplication is not commutative. In matrix notation we can write quaternion multiplication as \tilde\otimes\mathbf = \begin \;\;\, q_r & \;\;\, q_k & -q_j & \;\;\, q_i\\ -q_k & \;\;\, q_r & \;\;\, q_i & \;\;\, q_j\\ \;\;\, q_j & -q_i & \;\;\, q_r & \;\;\, q_k\\ -q_i & -q_j & -q_k & \;\;\, q_r \end \begin \tilde_i\\ \tilde_j\\ \tilde_k\\ \tilde_r \end = \begin \;\;\, \tilde_r & -\tilde_k & \;\;\, \tilde_j & \;\;\, \tilde_i\\ \;\;\, \tilde_k & \;\;\, \tilde_r & -\tilde_i & \;\;\, \tilde_j\\ -\tilde_j & \;\;\, \tilde_i & \;\;\, \tilde_r & \;\;\, \tilde_k\\ -\tilde_i & -\tilde_j & -\tilde_k & \;\;\, \tilde_r \end \begin q_i\\ q_j\\ q_k\\ q_r \end Combining two consecutive quaternion rotations is therefore just as simple as using the rotation matrix. Just as two successive rotation matrices, followed by , are combined as \mathbf_3 = \mathbf_2\mathbf_1, we can represent this with quaternion parameters in a similarly concise way: \mathbf_3 = \mathbf_2 \otimes \mathbf_1 Quaternions are a very popular parametrization due to the following properties: *More compact than the matrix representation and less susceptible to round-off errors *The quaternion elements vary continuously over the unit sphere in , (denoted by ) as the orientation changes, avoiding discontinuous jumps (inherent to three-dimensional parameterizations) *Expression of the rotation matrix in terms of quaternion parameters involves no
trigonometric function In mathematics, the trigonometric functions (also called circular functions, angle functions or goniometric functions) are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. They are widely used in all ...
s *It is simple to combine two individual rotations represented as quaternions using a quaternion product Like rotation matrices, quaternions must sometimes be renormalized due to rounding errors, to make sure that they correspond to valid rotations. The computational cost of renormalizing a quaternion, however, is much less than for normalizing a matrix. Quaternions also capture the spinorial character of rotations in three dimensions. For a three-dimensional object connected to its (fixed) surroundings by slack strings or bands, the strings or bands can be untangled after ''two'' complete turns about some fixed axis from an initial untangled state. Algebraically, the quaternion describing such a rotation changes from a scalar +1 (initially), through (scalar + pseudovector) values to scalar −1 (at one full turn), through (scalar + pseudovector) values back to scalar +1 (at two full turns). This cycle repeats every 2 turns. After turns (integer ), without any intermediate untangling attempts, the strings/bands can be partially untangled back to the turns state with each application of the same procedure used in untangling from 2 turns to 0 turns. Applying the same procedure times will take a -tangled object back to the untangled or 0 turn state. The untangling process also removes any rotation-generated twisting about the strings/bands themselves. Simple 3D mechanical models can be used to demonstrate these facts.


Rodrigues vector

The Rodrigues vector (sometimes called the Gibbs vector, with coordinates called Rodrigues parameters)online
/ref> can be expressed in terms of the axis and angle of the rotation as follows: \mathbf = \hat\tan\frac This representation is a higher-dimensional analog of the gnomonic projection, mapping unit quaternions from a 3-sphere onto the 3-dimensional pure-vector hyperplane. It has a discontinuity at 180° ( radians): as any rotation vector tends to an angle of radians, its tangent tends to infinity. A rotation followed by a rotation in the Rodrigues representation has the simple rotation composition form Today, the most straightforward way to prove this formula is in the (faithful) doublet representation, where , etc. The combinatoric features of the Pauli matrix derivation just mentioned are also identical to the equivalent
quaternion In mathematics, the quaternion number system extends the complex numbers. Quaternions were first described by the Irish mathematician William Rowan Hamilton in 1843 and applied to mechanics in three-dimensional space. The algebra of quater ...
derivation below. Construct a quaternion associated with a spatial rotation as, S = \cos\frac + \sin\frac \mathbf. Then the composition of the rotation with is the rotation , with rotation axis and angle defined by the product of the quaternions, A=\cos\frac+ \sin\frac\mathbf\quad \text \quad B=\cos\frac+ \sin\frac\mathbf, that is C = \cos\frac+\sin\frac\mathbf = \left(\cos\frac+\sin\frac\mathbf\right) \left(\cos\frac + \sin\frac\mathbf\right). Expand this quaternion product to \cos\frac+\sin\frac \mathbf = \left(\cos\frac\cos\frac - \sin\frac\sin\frac \mathbf\cdot \mathbf\right) + \left(\sin\frac \cos\frac \mathbf + \sin\frac \cos\frac \mathbf + \sin\frac \sin\frac \mathbf\times \mathbf\right). Divide both sides of this equation by the identity resulting from the previous one, \cos\frac = \cos\frac\cos\frac - \sin\frac\sin\frac \mathbf\cdot \mathbf, and evaluate This is Rodrigues' formula for the axis of a composite rotation defined in terms of the axes of the two component rotations. He derived this formula in 1840 (see page 408). The three rotation axes , , and form a spherical triangle and the dihedral angles between the planes formed by the sides of this triangle are defined by the rotation angles. Modified Rodrigues Parameters (MRPs) Modified Rodrigues parameters (MRPs) can be expressed in terms of Euler axis and angle by \mathbf = \hat\tan\frac\,. Its components can be expressed in terms of the components of a unit quaternion representing the same rotation as p_ = \frac\,. The modified Rodrigues vector is a
stereographic projection In mathematics, a stereographic projection is a perspective transform, perspective projection of the sphere, through a specific point (geometry), point on the sphere (the ''pole'' or ''center of projection''), onto a plane (geometry), plane (th ...
mapping unit quaternions from a 3-sphere onto the 3-dimensional pure-vector hyperplane. The projection of the opposite quaternion results in a different modified Rodrigues vector than the projection of the original quaternion . Comparing components one obtains that p^s_ = \frac =\frac\,. Notably, if one of these vectors lies inside the unit 3-sphere, the other will lie outside.


Cayley–Klein parameters

See definition a
Wolfram Mathworld


Higher-dimensional analogues


Vector transformation law

Active rotations of a 3D vector in Euclidean space around an axis over an angle can be easily written in terms of dot and cross products as follows: \mathbf' = p_\parallel \mathbf + \cos \, \mathbf_\perp + \sin \, \mathbf \wedge \mathbf wherein p_\parallel = \mathbf \cdot \mathbf is the longitudinal component of along , given by the
dot product In mathematics, the dot product or scalar productThe term ''scalar product'' means literally "product with a Scalar (mathematics), scalar as a result". It is also used for other symmetric bilinear forms, for example in a pseudo-Euclidean space. N ...
, \mathbf_\perp = \mathbf - (\mathbf \cdot \mathbf) \mathbf is the transverse component of with respect to , and \mathbf \wedge \mathbf is the
cross product In mathematics, the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a binary operation on two vectors in a three-dimensional oriented Euclidean vector space (named here E), and ...
of with . The above formula shows that the longitudinal component of remains unchanged, whereas the transverse portion of is rotated in the plane perpendicular to . This plane is spanned by the transverse portion of itself and a direction perpendicular to both and . The rotation is directly identifiable in the equation as a 2D rotation over an angle . Passive rotations can be described by the same formula, but with an inverse sign of either or .


Conversion formulae between formalisms


Rotation matrix ↔ Euler angles

The Euler angles can be extracted from the rotation matrix by inspecting the rotation matrix in analytical form.


Rotation matrix → Euler angles ( extrinsic)

Using the -convention, the 3-1-3 extrinsic Euler angles , and (around the -axis, -axis and again the Z-axis) can be obtained as follows: \begin \phi &= \operatorname\left(A_, A_\right)\\ \theta &= \arccos\left(A_\right)\\ \psi &= -\operatorname\left(A_, A_\right) \end Note that is equivalent to where it also takes into account the quadrant that the point is in; see atan2. When implementing the conversion, one has to take into account several situations: * There are generally two solutions in the interval . The above formula works only when is within the interval . * For the special case , and will be derived from and . * There are infinitely many but countably many solutions outside of the interval . * Whether all mathematical solutions apply for a given application depends on the situation.


Euler angles ( intrinsic) → rotation matrix

The rotation matrix is generated from the 3-2-1 intrinsic Euler angles by multiplying the three matrices generated by rotations about the axes. \mathbf = \mathbf_3\mathbf_2\mathbf_1 = \mathbf_Z\mathbf_Y\mathbf_X The axes of the rotation depend on the specific convention being used. For the -convention the rotations are about the -, - and -axes with angles , and , the individual matrices are as follows: \begin \mathbf_X &= \begin 1 & 0 & 0\\ 0 & \cos\phi & -\sin\phi\\ 0 & \sin\phi & \cos\phi \end \\ px \mathbf_Y &= \begin \cos\theta & 0 & \sin\theta\\ 0 & 1 & 0\\ -\sin\theta & 0 & \cos\theta \end \\ px \mathbf_Z &= \begin \cos\psi & -\sin\psi & 0\\ \sin\psi & \cos\psi & 0\\ 0 & 0 & 1 \end \end This yields \mathbf = \begin \cos\theta \cos\psi & -\cos\phi \sin\psi + \sin\phi \sin\theta \cos\psi & \sin\phi \sin\psi + \cos\phi \sin\theta \cos\psi \\ \cos\theta\sin\psi & \cos\phi \cos\psi + \sin\phi \sin\theta \sin\psi & - \sin\phi \cos\psi + \cos\phi \sin\theta \sin\psi \\ -\sin\theta & \sin\phi \cos\theta & \cos\phi \cos\theta \\ \end Note: This is valid for a right-hand system, which is the convention used in almost all engineering and physics disciplines. The interpretation of these right-handed rotation matrices is that they express coordinate transformations ( passive) as opposed to point transformations ( active). Because expresses a rotation from the local frame to the global frame (i.e., encodes the axes of frame with respect to frame ), the elementary rotation matrices are composed as above. Because the inverse rotation is just the rotation transposed, if we wanted the global-to-local rotation from frame to frame , we would write \mathbf^\mathsf = (\mathbf_Z\mathbf_Y\mathbf_X)^\mathsf = \mathbf_X^\mathsf\mathbf_Y^\mathsf\mathbf_Z^\mathsf\,.


Rotation matrix ↔ Euler axis/angle

If the Euler angle is not a multiple of , the Euler axis and angle can be computed from the elements of the rotation matrix as follows: \begin \theta &= \arccos\frac\\ e_1 &= \frac\\ e_2 &= \frac\\ e_3 &= \frac \end Alternatively, the following method can be used: Eigendecomposition of the rotation matrix yields the eigenvalues 1 and . The Euler axis is the eigenvector corresponding to the eigenvalue of 1, and can be computed from the remaining eigenvalues. The Euler axis can be also found using singular value decomposition since it is the normalized vector spanning the null-space of the matrix . To convert the other way the rotation matrix corresponding to an Euler axis and angle can be computed according to
Rodrigues' rotation formula In the theory of three-dimensional rotation, Rodrigues' rotation formula, named after Olinde Rodrigues, is an efficient algorithm for rotating a vector in space, given an axis and angle of rotation. By extension, this can be used to transfo ...
(with appropriate modification) as follows: \mathbf = \mathbf_3\cos\theta + (1-\cos\theta)\hat\hat^\mathsf + \left hat\right \sin\theta with the
identity matrix In linear algebra, the identity matrix of size n is the n\times n square matrix with ones on the main diagonal and zeros elsewhere. It has unique properties, for example when the identity matrix represents a geometric transformation, the obje ...
, and \left hat\right = \begin 0 & -e_3 & e_2\\ e_3 & 0 & -e_1\\ -e_2 & e_1 & 0 \end is the cross-product matrix. This expands to: \begin A_ &= (1-\cos\theta) e_1^2 + \cos\theta \\ A_ &= (1-\cos\theta) e_1 e_2 - e_3 \sin\theta \\ A_ &= (1-\cos\theta) e_1 e_3 + e_2 \sin\theta \\ A_ &= (1-\cos\theta) e_2 e_1 + e_3 \sin\theta \\ A_ &= (1-\cos\theta) e_2^2 + \cos\theta \\ A_ &= (1-\cos\theta) e_2 e_3 - e_1 \sin\theta \\ A_ &= (1-\cos\theta) e_3 e_1 - e_2 \sin\theta \\ A_ &= (1-\cos\theta) e_3 e_2 + e_1 \sin\theta \\ A_ &= (1-\cos\theta) e_3^2 + \cos\theta \end


Rotation matrix ↔ quaternion

When computing a quaternion from the rotation matrix there is a sign ambiguity, since and represent the same rotation. One way of computing the quaternion \mathbf = \begin q_i \\ q_j \\ q_k \\ q_r \end = q_i\mathbf+q_j\mathbf+q_k\mathbf+q_r from the rotation matrix is as follows: \begin q_r &= \frac\sqrt\\ q_i &= \frac\left(A_- A_\right)\\ q_j &= \frac\left(A_- A_\right)\\ q_k &= \frac\left(A_- A_\right) \end There are three other mathematically equivalent ways to compute . Numerical inaccuracy can be reduced by avoiding situations in which the denominator is close to zero. One of the other three methods looks as follows: \begin q_i &= \frac\sqrt\\ q_j &= \frac\left(A_ + A_\right)\\ q_k &= \frac\left(A_ + A_\right)\\ q_r &= \frac\left(A_ - A_\right) \end The rotation matrix corresponding to the quaternion can be computed as follows: \mathbf = \left(q_r^2 - \check^\mathsf\check\right)\mathbf_3 + 2\check\check^\mathsf + 2q_r\mathbf where \check = \begin q_i\\q_j\\q_k\end \,, \quad \mathbf = \begin 0 & -q_k & q_j\\ q_k & 0 & -q_i\\ -q_j & q_i & 0 \end which gives \mathbf = \begin 1 - 2q_j^2 - 2q_k^2 & 2\left(q_iq_j - q_kq_r\right) & 2\left(q_iq_k + q_jq_r\right)\\ 2\left(q_iq_j + q_kq_r\right) & 1 - 2q_i^2- 2 q_k^2 & 2\left(q_jq_k - q_iq_r\right)\\ 2\left(q_iq_k - q_jq_r\right) & 2\left(q_jq_k + q_iq_r\right) & 1 - 2q_i^2 - 2q_j^2 \end or equivalently \mathbf = \begin -1 + 2q_i^2 + 2q_r^2 & 2\left(q_iq_j - q_kq_r\right) & 2\left(q_iq_k + q_jq_r\right)\\ 2\left(q_iq_j + q_kq_r\right) & -1 + 2q_j^2 + 2q_r^2 & 2\left(q_jq_k - q_iq_r\right)\\ 2\left(q_iq_k - q_jq_r\right) & 2\left(q_jq_k + q_iq_r\right) & -1 + 2q_k^2 + 2q_r^2 \end This is called the Euler–Rodrigues formula for the transformation matrix \mathbf


Euler angles ↔ quaternion


Euler angles ( extrinsic) → quaternion

We will consider the -convention 3-1-3 extrinsic Euler angles for the following algorithm. The terms of the algorithm depend on the convention used. We can compute the quaternion \mathbf = \begin q_i \\ q_j \\ q_k \\ q_r \end = q_i\mathbf+q_j\mathbf+q_k\mathbf+q_r from the Euler angles as follows: \begin q_i &= \cos\frac\sin\frac\\ q_j &= \sin\frac\sin\frac\\ q_k &= \sin\frac\cos\frac\\ q_r &= \cos\frac\cos\frac \end


Euler angles ( intrinsic) → quaternion

A quaternion equivalent to yaw (), pitch () and roll () angles. or intrinsic Tait–Bryan angles following the convention, can be computed by \begin q_i &= \sin \frac \cos \frac \cos \frac - \cos \frac \sin \frac \sin \frac\\ q_j &= \cos \frac \sin \frac \cos \frac + \sin \frac \cos \frac \sin \frac\\ q_k &= \cos \frac \cos \frac \sin \frac - \sin \frac \sin \frac \cos \frac\\ q_r &= \cos \frac \cos \frac \cos \frac + \sin \frac \sin \frac \sin \frac \end


Quaternion → Euler angles ( extrinsic)

Given the rotation quaternion \mathbf = \begin q_i \\ q_j \\ q_k \\ q_r \end = q_i\mathbf+q_j\mathbf+q_k\mathbf+q_r \,, the -convention 3-1-3 extrinsic Euler Angles can be computed by \begin \phi &= \operatorname\left(\left(q_iq_k + q_jq_r\right), -\left(q_jq_k - q_iq_r\right)\right)\\ \theta &= \arccos\left(-q_i^2 - q_j^2 + q_k^2+q_r^2\right)\\ \psi &= \operatorname\left(\left(q_iq_k - q_jq_r\right), \left(q_jq_k + q_iq_r\right)\right) \end


Quaternion → Euler angles ( intrinsic)

Given the rotation quaternion \mathbf = \begin q_i \\ q_j \\ q_k \\ q_r \end = q_i\mathbf+q_j\mathbf+q_k\mathbf+q_r \,, yaw, pitch and roll angles, or intrinsic Tait–Bryan angles following the convention, can be computed by \begin \text &= \operatorname \left(2\left(q_r q_i + q_j q_k\right),1 - 2\left(q_i^2 + q_j^2\right)\right) \\ \text &= \arcsin \left(2\left(q_r q_j - q_k q_i\right)\right) \\ \text &= \operatorname \left(2\left(q_r q_k + q_i q_j\right),1 - 2\left(q_j^2 + q_k^2\right)\right) \end


Euler axis–angle ↔ quaternion

Given the Euler axis and angle , the quaternion \mathbf = \begin q_i \\ q_j \\ q_k \\ q_r \end = q_i\mathbf+q_j\mathbf+q_k\mathbf+q_r \,, can be computed by \begin q_i &= \hat_1\sin\frac \\ q_j &= \hat_2\sin\frac \\ q_k &= \hat_3\sin\frac \\ q_r &= \cos\frac \end Given the rotation quaternion , define \check = \begin q_i \\ q_j \\ q_k \end\,. Then the Euler axis and angle can be computed by \begin \hat &= \frac \\ \theta &= 2\arccos q_r \end


Rotation matrix ↔ Rodrigues vector


Rodrigues vector → Rotation matrix

Since the definition of the Rodrigues vector can be related to rotation quaternions: \begin g_i = \dfrac = e_x \tan\left(\dfrac\right) \\ g_j = \dfrac = e_y \tan\left(\dfrac\right)\\ g_k = \dfrac = e_z \tan\left(\dfrac\right) \endBy making use of the following property 1 = q_r^2 + q_i^2 + q_j^2 + q_k^2 = q_r^2 \left(1 + \frac + \frac + \frac\right) = q_r^2 \left(1 + g_i^2 + g_j^2 + g_k^2\right)The formula can be obtained by factoring from the final expression obtained for quaternions: \mathbf = q_r^2 \begin \frac - 2\frac - 2\frac & 2\left(\frac\frac - \frac\right) & 2\left(\frac\frac + \frac\right)\\ 2\left(\frac\frac + \frac\right) & \frac - 2\frac - 2 \frac & 2\left(\frac\frac - \frac\right)\\ 2\left(\frac\frac - \frac\right) & 2\left(\frac\frac + \frac\right) & \frac - 2\frac - 2\frac \end Leading to the final formula: \mathbf = \frac \begin 1 + g_i^2 - g_j^2 - g_k^2 & 2\left(g_i g_j - g_k\right) & 2\left(g_i g_k + g_j\right)\\ 2\left(g_i g_j + g_k\right) &1 - g_i^2 + g_j^2 - g_k^2 & 2\left(g_j g_k - g_i\right)\\ 2\left(g_i g_k - g_j\right) & 2\left(g_j g_k + g_i\right) &1 - g_i^2 - g_j^2 + g_k^2 \end


Conversion formulae for derivatives


Rotation matrix ↔ angular velocities

The angular velocity vector \boldsymbol = \begin \omega_x \\ \omega_y \\ \omega_z \end can be extracted from the time derivative of the rotation matrix by the following relation: boldsymbol\times = \begin 0 & -\omega_z & \omega_y \\ \omega_z & 0 & -\omega_x \\ -\omega_y & \omega_x & 0 \end = \frac\mathbf^\mathsf The derivation is adapted from Ioffe as follows: For any vector , consider and differentiate it: \frac = \frac \mathbf_0 = \frac \mathbf^\mathsf(t) \mathrm(t) The derivative of a vector is the linear velocity of its tip. Since is a rotation matrix, by definition the length of is always equal to the length of , and hence it does not change with time. Thus, when rotates, its tip moves along a circle, and the linear velocity of its tip is tangential to the circle; i.e., always perpendicular to . In this specific case, the relationship between the linear velocity vector and the angular velocity vector is \frac = \boldsymbol(t)\times \mathbf(t) = boldsymbol\times \mathbf(t) (see circular motion and
cross product In mathematics, the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a binary operation on two vectors in a three-dimensional oriented Euclidean vector space (named here E), and ...
). By the transitivity of the abovementioned equations, \frac \mathbf^\mathsf(t) \mathbf(t) = boldsymbol\times \mathbf(t) which implies \frac \mathbf^\mathsf(t) = boldsymbol\times


Quaternion ↔ angular velocities

The angular velocity vector \boldsymbol = \begin \omega_x \\ \omega_y \\ \omega_z \end can be obtained from the derivative of the quaternion as follows:Quaternions and Rotation
lecture notes, p. 14-15
\begin 0 \\ \omega_x \\ \omega_y \\ \omega_z \end = 2 \frac\tilde where is the conjugate (inverse) of . Conversely, the derivative of the quaternion is \frac = \frac\begin 0 \\ \omega_x \\ \omega_y \\ \omega_z \end\mathbf \,.


Rotors in a geometric algebra

The formalism of geometric algebra (GA) provides an extension and interpretation of the quaternion method. Central to GA is the geometric product of vectors, an extension of the traditional inner and
cross product In mathematics, the cross product or vector product (occasionally directed area product, to emphasize its geometric significance) is a binary operation on two vectors in a three-dimensional oriented Euclidean vector space (named here E), and ...
s, given by \mathbf = \mathbf \cdot \mathbf + \mathbf \wedge \mathbf where the symbol denotes the exterior product or wedge product. This product of vectors , and produces two terms: a scalar part from the inner product and a bivector part from the wedge product. This bivector describes the plane perpendicular to what the cross product of the vectors would return. Bivectors in GA have some unusual properties compared to vectors. Under the geometric product, bivectors have a negative square: the bivector describes the -plane. Its square is . Because the unit basis vectors are orthogonal to each other, the geometric product reduces to the antisymmetric outer product, so and can be swapped freely at the cost of a factor of −1. The square reduces to since the basis vectors themselves square to +1. This result holds generally for all bivectors, and as a result the bivector plays a role similar to the
imaginary unit The imaginary unit or unit imaginary number () is a mathematical constant that is a solution to the quadratic equation Although there is no real number with this property, can be used to extend the real numbers to what are called complex num ...
. Geometric algebra uses bivectors in its analogue to the quaternion, the ''rotor'', given by \mathbf = \exp\left(\frac\right) = \cos \frac - \hat\mathbf \sin \frac\,, where is a unit bivector that describes the plane of rotation. Because squares to −1, the
power series In mathematics, a power series (in one variable) is an infinite series of the form \sum_^\infty a_n \left(x - c\right)^n = a_0 + a_1 (x - c) + a_2 (x - c)^2 + \dots where ''a_n'' represents the coefficient of the ''n''th term and ''c'' is a co ...
expansion of generates the
trigonometric function In mathematics, the trigonometric functions (also called circular functions, angle functions or goniometric functions) are real functions which relate an angle of a right-angled triangle to ratios of two side lengths. They are widely used in all ...
s. The rotation formula that maps a vector to a rotated vector is then \mathbf = \mathbf^\dagger where \mathbf^\dagger = \exp\left(\frac\hat\mathbf \theta\right) = \cos \frac + \hat\mathbf \sin \frac is the ''reverse'' of \scriptstyle R (reversing the order of the vectors in B is equivalent to changing its sign). Example. A rotation about the axis \hat \mathbf = \frac\left(\hat \mathbf + \hat \mathbf + \hat \mathbf\right) can be accomplished by converting to its dual bivector, \hat \mathbf = \hat \mathbf \hat \mathbf \hat \mathbf \hat \mathbf = \mathbf \hat \mathbf \,, where is the unit volume element, the only trivector (pseudoscalar) in three-dimensional space. The result is \hat \mathbf = \frac\left(\hat \mathbf \hat \mathbf + \hat \mathbf \hat \mathbf + \hat \mathbf \hat \mathbf\right) \,. In three-dimensional space, however, it is often simpler to leave the expression for , using the fact that commutes with all objects in 3D and also squares to −1. A rotation of the vector in this plane by an angle is then \hat \mathbf' = \mathbf \hat \mathbf \mathbf^\dagger = e^ \hat \mathbf e^ = \hat \mathbf \cos^2 \frac + \mathbf \left(\hat \mathbf \hat \mathbf - \hat \mathbf \hat \mathbf\right) \cos \frac \sin \frac + \hat \mathbf \hat \mathbf \hat \mathbf \sin^2 \frac Recognizing that \mathbf (\hat \mathbf \hat \mathbf - \hat \mathbf \hat \mathbf) = 2\mathbf (\hat \mathbf \wedge \hat \mathbf) and that is the reflection of about the plane perpendicular to gives a geometric interpretation to the rotation operation: the rotation preserves the components that are parallel to and changes only those that are perpendicular. The terms are then computed: \begin \hat \mathbf \hat \mathbf \hat \mathbf &= \frac \left(-\hat \mathbf + 2 \hat \mathbf + 2 \hat \mathbf\right) \\ 2\mathbf \hat \mathbf \wedge \hat \mathbf &= 2\mathbf \frac \left(\hat \mathbf \hat \mathbf + \hat \mathbf \hat \mathbf\right) = \frac \left(\hat \mathbf - \hat \mathbf\right) \end The result of the rotation is then \hat \mathbf' = \hat \mathbf \left(\cos^2 \frac - \frac \sin^2 \frac\right) + \frac \hat \mathbf \sin \frac \left(\sin \frac + \sqrt \cos \frac\right) + \frac \hat \mathbf \sin \frac \left(\sin \frac - \sqrt \cos \frac\right) A simple check on this result is the angle . Such a rotation should map to . Indeed, the rotation reduces to \begin \hat \mathbf' &= \hat \mathbf\left(\frac - \frac \frac\right) + \frac \hat \mathbf \frac \left(\frac + \sqrt\frac\right) + \frac \hat \mathbf \frac \left(\frac - \sqrt\frac\right) \\ &= 0 \hat \mathbf + \hat \mathbf + 0 \hat \mathbf = \hat \mathbf \end exactly as expected. This rotation formula is valid not only for vectors but for any multivector. In addition, when Euler angles are used, the complexity of the operation is much reduced. Compounded rotations come from multiplying the rotors, so the total rotor from Euler angles is \mathbf = \mathbf_ \mathbf_ \mathbf_\alpha = \exp\left(\frac\right) \exp\left(\frac\right) \exp\left(\frac\right) but \begin \hat \mathbf' &= \mathbf_\alpha \hat \mathbf \mathbf_\alpha^\dagger \quad \text \\ \hat \mathbf' &= \mathbf_ \hat \mathbf \mathbf_^\dagger \,. \end These rotors come back out of the exponentials like so: \mathbf_ = \cos \frac - \mathbf \mathbf_\alpha \hat \mathbf \mathbf_\alpha^\dagger \sin \frac = \mathbf_\alpha \mathbf_\beta \mathbf_\alpha^\dagger where refers to rotation in the original coordinates. Similarly for the rotation, \mathbf_ = \mathbf_ \mathbf_\gamma \mathbf_^\dagger = \mathbf_\alpha \mathbf_\beta \mathbf_\alpha^\dagger \mathbf_\gamma \mathbf_\alpha \mathbf_\beta^\dagger \mathbf_\alpha^\dagger \,. Noting that and commute (rotations in the same plane must commute), and the total rotor becomes \mathbf = \mathbf_\alpha \mathbf_\beta \mathbf_\gamma Thus, the compounded rotations of Euler angles become a series of equivalent rotations in the original fixed frame. While rotors in geometric algebra work almost identically to quaternions in three dimensions, the power of this formalism is its generality: this method is appropriate and valid in spaces with any number of dimensions. In 3D, rotations have three degrees of freedom, a degree for each linearly independent plane (bivector) the rotation can take place in. It has been known that pairs of quaternions can be used to generate rotations in 4D, yielding six degrees of freedom, and the geometric algebra approach verifies this result: in 4D, there are six linearly independent bivectors that can be used as the generators of rotations.


See also

* Euler filter *
Orientation (geometry) In geometry, the orientation, attitude, bearing, direction, or angular position of an object – such as a Line (geometry), line, plane (geometry), plane or rigid body – is part of the description of how it is placed in the Euclidean space, spa ...
*
Rotation around a fixed axis Rotation around a fixed axis or axial rotation is a special case of rotational motion around an ''axis of rotation'' fixed, stationary, or static in three-dimensional space. This type of motion excludes the possibility of the instantaneous axis ...


References


Further reading

* * * * * * * * * * * *


External links

{{Commons category, Rotation in three dimensions
EuclideanSpace
has a wealth of information on rotation representation

and ttp://www.j3d.org/matrix_faq/matrfaq_latest.html#Q37 Q37. How do I convert a rotation matrix to Euler angles?— The Matrix and Quaternions FAQ
Imaginary numbers are not Real – the Geometric Algebra of Spacetime
– Section "Rotations and Geometric Algebra" derives and applies the rotor description of rotations

– Direction cosine matrix theory tutorial and applications. Space orientation estimation algorithm using accelerometer, gyroscope and magnetometer IMU devices. Using complimentary filter (popular alternative to Kalman filter) with DCM matrix. Rotation Euclidean symmetries Orientation (geometry) Rigid bodies mechanics