|
Quaternions provide a convenient mathematical notation for representing orientations and rotations of objects. Due to certain compactness, efficiency, and stability advantages over matrices, quaternions have found their way into applications in computer graphics, robotics, global navigation, and orbital mechanics of satellites.[1] In mathematics, the quaternions are a non-commutative extension of the complex numbers. ...
Orientation can refer to different things. ...
A sphere rotating around its axis. ...
In mathematics, a matrix (plural matrices) is a rectangular table of numbers or, more generally, a table consisting of abstract quantities that can be added and multiplied. ...
Computer graphics is a sub-field of computer science and is concerned with digitally synthesizing and manipulating visual content. ...
Robotics is the science and technology of robots, their design, manufacture, and application. ...
This article or section should be merged with Celestial Mechanics Astrodynamics is the study and creation of orbits, especially those of artificial satellites. ...
For other uses, please see Satellite (disambiguation) A satellite is an object that orbits another object (known as its primary). ...
Quaternion rotation operations
Goal The goal is to find a formula that expresses rotation in 3D space using quaternion multiplication. Ideally, this formula should be an analog to the complex multiplication used to represent 2D rotations: 2-dimensional renderings (ie. ...
In mathematics, a complex number is a number of the form where a and b are real numbers, and i is the imaginary unit, with the property i 2 = â1. ...
2D computer graphics is the computer-based generation of digital imagesâmostly from two-dimensional models (such as 2D geometric models, text, and digital images) and by techniques specific to them. ...
, where  is used for rotation by an angle α. An angle is the figure formed by two rays sharing a common endpoint, called the vertex of the angle. ...
Derivation The desired 3D rotation formula cannot be simple quaternion multiplication, because rotating a vector (represented as a quaternion with zero real part) should yield a vector, but multiplying a vector with an arbitrary quaternion may result in a non-vector (with non-zero real part). However, it turns out that we can cancel the real part if we multiply by a quaternion from one side and by the inverse of that quaternion from the other side. Let z = a + u be a non-zero quaternion, and consider the function  where z−1 is the multiplicative inverse of z, and v is a vector in quaternion form. The function f is known as conjugation by z. Note that the real part of f(v) is zero, because in general zw and wz have the same real part for any quaternions z and w, and so In mathematics, especially group theory, the elements of any group may be partitioned into conjugacy classes; members of the same conjugacy class share many properties, and study of conjugacy classes of non-abelian groups reveals many important features of their structure. ...
 (note that this proof applies the associativity of quaternion multiplication). Furthermore, f is R-linear and we have f(v) = v if and only if v and the imaginary part u of z are collinear (because f(v) = v means v z = z v). Hence f is a rotation whose axis of rotation passes through the origin and is given by the vector u. In mathematics, associativity is a property that a binary operation can have. ...
In mathematics, a linear transformation (also called linear map or linear operator) is a function between two vector spaces that preserves the operations of vector addition and scalar multiplication. ...
A line, or straight line, is, roughly speaking, an (infinitely) thin, (infinitely) long, straight geometrical object, i. ...
Note that conjugation with z is the equivalent to conjugation with rz for any real number r. We can thus restrict our attention to the quaternions of absolute value 1, the so-called unit quaternions. Note that even then z and −z represent the same rotation. (The absolute value |z| of the quaternion z = a + v is defined as the square root of a2 + ||v||2, which makes it multiplicative: |zw| = |z| |w|.) Inverting unit quaternions is especially easy: If |z| = 1, then z−1 = z* (the conjugate z* of the quaternion z = a + v is defined as z* = a − v) and this makes our rotation formula even easier. In mathematics, a square root of a number x is a number r such that , or in words, a number r whose square (the result of multiplying the number by itself) is x. ...
It turns out that the angle of rotation α is also easy to read off if we are dealing with a unit quaternion z = a + v: we have . Summary To summarize, a counterclockwise rotation through an angle α about an axis v can be represented via conjugation by the unit quaternion z  where is the normalized vector . The composition of two rotations corresponds to quaternion multiplication: if the rotation f is represented by conjugation with the quaternion z and the rotation g is represented by conjugation with w, then the composition f ∘ g is represented by conjugation with zw. In mathematics, a composite function, formed by the composition of one function on another, represents the application of the former to the result of the application of the latter to the argument of the composite. ...
If one wishes to rotate about an axis that does not pass through the origin, then one first translates the vectors into the origin, conjugates, and translates back. The angle between two quaternions should not be confused with the angle of rotation involved in the rotation between the orientations corresponding to these quaternions: the former is half of the latter (or 180° minus half the latter). The angle between the axes of two rotations is again different. For example the quaternion for the identity is ±1 and for a 180° rotation about the z-axis is ±k. The angle between the two quaternions is 90°. The angle between the axes of the two rotations is in this case undefined.
Example Consider the rotation f around the axis u = i + j + k, with a rotation angle of 120°, or 2π⁄3 radians. Some common angles, measured in radians. ...
 The length of u is √3, the half angle is π⁄3 (60°) with cosine ½, (cos 60° = 0.5) and sine √3⁄2, (sin 60° = 0.866...). We are therefore dealing with a conjugation by the unit quaternion In mathematics, the trigonometric functions are functions of an angle, important when studying triangles and modeling periodic phenomena. ...
In mathematics, the trigonometric functions are functions of an angle, important when studying triangles and modeling periodic phenomena. ...
    . Concretely, - f(ai + bj + ck) = z (ai + bj + ck) z∗ .
Note that z∗ = 1/z, as z has unit modulus; here z∗ = (1−i−j−k)/2. This can be simplified, using the ordinary rules for quaternion arithmetic, to - f(ai + bj + ck) = ci + aj + bk,
as expected: the rotation corresponds to keeping a cube held fixed at one point, and rotating it 120° about the long diagonal through the fixed point (observe how the three axes are permuted cyclically). A cube[1] is a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex. ...
A cyclic permutation is a permutation that shifts all elements of given ordered set by a fixed offset, with the elements shifted off the end inserted back at the beginning in the same order, i. ...
Quaternion non-commutativity and rotations The multiplication of quaternions is non-commutative. Since this operation corresponds to a three dimensional rotation, this property can be easily demonstrated by showing that three dimensional rotations are not commutative in general. A simple exercise of applying two rotations to an asymmetrical object (e.g., a book) can explain it. First, rotate a book 90 degrees clockwise around the z axis. Next rotate it 180 degrees clockwise around the x axis. Then restore the original orientation, so that the book title is again readable, and apply those rotations in opposite order. This shows that, in general, the composition of two different rotations around two distinct spatial axes will not commute. In mathematics, especially abstract algebra, a binary operation * on a set S is commutative if x * y = y * x for all x and y in S. Otherwise * is noncommutative. ...
Quaternions versus other representations of rotations The representation of a rotation as a quaternion (4 numbers) is more compact than the representation as an orthogonal matrix (9 numbers). Furthermore, for a given axis and angle, one can easily construct the corresponding quaternion, and conversely, for a given quaternion one can easily read off the axis and the angle. Both of these are much harder with matrices or Euler angles. In matrix theory, a real orthogonal matrix is a square matrix Q whose transpose is its inverse: // Overview An orthogonal matrix is the real specialization of a unitary matrix, and thus always a normal matrix. ...
Euler angles are the classical way of representing rotations in 3-dimensional Euclidean space, named after Leonhard Euler. ...
In computer games and other applications, one is often interested in “smooth rotations,” meaning that the scene should slowly rotate and not in a single step. This can be accomplished by choosing a curve such as the spherical linear interpolation in the quaternions, with one endpoint being the identity transformation 1 (or some other initial rotation) and the other being the intended final rotation. This is more problematic with other representations of rotations. A computer game is a game composed of a computer-controlled virtual universe that players interact with in order to achieve a defined goal or set of goals. ...
In mathematics, the concept of a curve tries to capture the intuitive idea of a geometrical one-dimensional and continuous object. ...
Slerp, or spherical linear interpolation, is a type of interpolation used to make points travel along the surface of a sphere as they are moved from one orientation to another. ...
When composing several rotations on a computer, rounding errors necessarily accumulate. A quaternion that’s slightly off still represents a rotation after being normalised—a matrix that’s slightly off need not be orthogonal anymore and therefore is harder to convert back to a proper orthogonal matrix. In mathematics, orthogonal is synonymous with perpendicular when used as a simple adjective that is not part of any longer phrase with a standard definition. ...
Quaternions also avoid a phenomenon called gimbal lock which can result when, for example in pitch/yaw/roll rotational systems, the pitch is rotated 90 degrees up or down, so that yaw and roll then correspond to the same motion, and a degree of freedom of rotation is lost. In the case of airplane controls, this could have disastrous results if an airplane is in a steep dive or ascent. In gyroscopic devices controlled by Euler mechanics or Euler angles, gimbal lock is caused by the alignment of two of the three gimbals together so that one of the rotation references (pitch/yaw/roll, often yaw) is cancelled. ...
Flight dynamics is the science of air and space vehicle orientation and control in three dimensions. ...
The orthogonal matrix corresponding to a rotation by the unit quaternion z = a + bi + cj + dk (with |z| = 1) is given by In matrix theory, a real orthogonal matrix is a square matrix Q whose transpose is its inverse: // Overview An orthogonal matrix is the real specialization of a unitary matrix, and thus always a normal matrix. ...
 (Compare the equivalent general formula for a 3 × 3 rotation matrix in terms of the axis and the angle.) A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
(Matrix is valid for opposite sense rotation (e.g., right-handed rotation on a left-handed coordinate system). For same-sense rotation, transpose the matrix.) Fig. ...
In linear algebra, the transpose of a matrix A is another matrix AT (also written Atr, tA, or Aâ²) created by any one of the following equivalent actions: write the rows of A as the columns of AT write the columns of A as the rows of AT reflect A...
See also: Charts on SO(3), Euler angles, axis angle In mathematics, the special orthogonal group in three dimensions, otherwise known as the rotation group SO(3), is a naturally occurring example of a manifold. ...
Euler angles are a means of representing the spatial orientation of an object. ...
The axis angle representation of a rotation parameterizes a rotation by two values: an axis, or a line, and an angle describing the magnitude of the rotation about the axis. ...
Performance comparisons with other rotation methods This section discusses the performance implications of using quaternions versus other methods (axis/angle or rotation matrices) to perform rotations in 3D. A brief summary: Performance comparison of various rotation methods | Method | Storage | # multiplies | # add/subtracts | # sin/cos | total operations | | Rotation matrix | 9 | 9 | 6 | 0 | 15 | | Quaternions | 4 | 21 | 18 | 0 | 39 | | Angle/axis | 4* | 23 | 16 | 2 | 41 | * Note: angle-axis can be stored as 3 elements by multiplying the unit rotation axis by the rotation angle; however, before using it the unit axis and angle must be recovered by normalizing, costing additional math operations. Quaternions, treated the same way, lose their sign, and so cannot be stored only in 3 elements. A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
In mathematics, the quaternions are a non-commutative extension of the complex numbers. ...
A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
There are three basic approaches to rotating a vector v: - Compute the matrix-vector product of a 3x3 rotation matrix R and the original 3x1 vector v, giving
. This requires 3*(3 multiplications + 2 additions) = 9 multiplications and 6 additions, the most efficient method for rotating a vector. - Use the quaternion rotation formula derived above of
. Computing this result is equivalent to transforming the quaternion to a rotation matrix R using the formula above then multiplying with a vector. Performing some common subexpression elimination yields an algorithm that costs 21 multiplies and 18 adds. As a second approach, the quaternion could first be converted to its equivalent angle/axis representation then the angle/axis representation used to rotate the vector. However, this is both less efficient and less numerically stable when the quaternion nears the no rotation point. - Use the angle-axis formula to convert an angle/axis to a rotation matrix R then multiplying with a vector. Converting the angle/axis to R using common subexpression elimination costs 14 multiplies, 2 function calls (sin, cos), and 10 add/subtracts; from item 1, rotating using R adds an additional 9 multiplications and 6 additions for a total of 23 multiplies, 16 add/subtracts, and 2 function calls (sin, cos).
Pseudo-code for rotating using a quaternion: given a quaternion z = a + bi + cj + dk (with |z| = 1) and a vector v with elements v1, v2, and v3, the following code performs a rotation. Note the use of temporary variables txx. Also note one optimization of the diagonal entries of the R matrix: since a2 + b2 + c2 + d2 = 1, rewrite the top-left entry as a2 + b2 + c2 + d2 − 2c2 − 2d2 = 1 − 2c2 − 2d2; the other two diagonal entries can be similarly rewritten. A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
In compiler theory, common subexpression elimination (CSE) is the practice of finding repeated redundant expression evaluations, and replacing them with a single computation assigned to a temporary variable. ...
A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
In compiler theory, common subexpression elimination (CSE) is the practice of finding repeated redundant expression evaluations, and replacing them with a single computation assigned to a temporary variable. ...
t2 = a*b t3 = a*c t4 = a*d t5 = -b*b t6 = b*c t7 = b*d t8 = -c*c t9 = c*d t10 = -d*d v1new = 2*( (t8 + t10)*v1 + (t6 - t4)*v2 + (t3 + t7)*v3 ) + v1 v2new = 2*( (t4 + t6)*v1 + (t5 + t10)*v2 + (t9 - t2)*v3 ) + v2 v3new = 2*( (t7 – t3)*v1 + (t2 + t9)*v2 + (t5 + t8)*v3 ) + v3 Pseudo-code for creating an angle/axis matrix where the unit axis is (v1, v2, v3) and the angle is θ: A rotation matrix is a matrix which when multiplied by a vector has the effect of changing the direction of the vector but not its magnitude. ...
t1 = cos(theta) t2 = 1 - t1 t3 = v1*v1 t6 = t2*v1 t7 = t6*v2 t8 = sin(theta) t9 = t8*v3 t11 = t6*v3 t12 = t8*v2 t15 = v2*v2 t19 = t2*v2*v3 t20 = t8*v1 t24 = v3*v3 R[1, 1] = t1 + t2*t3 R[1, 2] = t7 - t9 R[1, 3] = t11 + t12 R[2, 1] = t7 + t9 R[2, 2] = t1 + t2*t15 R[2, 3] = t19 - t20 R[3, 1] = t11 - t12 R[3, 2] = t19 + t20 R[3, 3] = t1 + t2*t24 Pairs of unit quaternions as rotations in 4D space A pair of unit quaternions zl and zr can represent any rotation in 4D space. Given a four dimensional vector v, and pretending that it is a quaternion, we can rotate the vector v like this:
 It is straightforward to check that for each matrix M MT = I, that is, that each matrix (and hence both matrices together) represents a rotation. Note that since (zl v) zr = zl (v zr), the two matrices must commute. Therefore, there are two commuting subgroups of the set of four dimensional rotations. Arbitrary four dimensional rotations have 6 degrees of freedom, each matrix represents 3 of those 6 degrees of freedom. Since an infinitesimal four-dimensional rotation can be represented by a pair of quaternions (as follows), all (non-infinitesimal) four-dimensional rotations can also be represented. In mathematics, an infinitesimal, or infinitely small number, is a number that is smaller in absolute value than any positive real number. ...



See also Slerp, or spherical linear interpolation, is a type of interpolation used to make points travel along the surface of a sphere as they are moved from one orientation to another. ...
Spatial rotations in three dimensions can be parametrized using both Euler angles and unit quaternions. ...
In mechanics and geometry, the rotation group is the set of all rotations about the origin of 3-dimensional Euclidean space, R3. ...
In linear algebra and geometry, a coordinate rotation is a type of transformation from one system of coordinates to another system of coordinates such that distance between any two points remains invariant under the transformation. ...
Clifford algebras are a type of associative algebra in mathematics. ...
In mathematics the spinor group or spin group Spin(n) is a particular double cover of the special orthogonal group SO(n, R). ...
In mathematics, specifically topology, a covering map is a continuous surjective map p : C â X, with C and X being topological spaces, which has the following property: to every x in X there exists an open neighborhood U such that p -1(U) is a union of mutually disjoint open...
In mathematics, a 3-sphere is a higher-dimensional analogue of a sphere. ...
References - ^ Quaternions and rotation Sequences: a Primer with Applications to Orbits, Aerospace, and Virtual Reality. Kuipers, Jack B., Princeton University Press copyright 1999.
External links and resources - Shoemake, Ken. Quaternion tutorial
- Hart, Francis, Kauffman. Quaternion demo
- Dam, Koch, Lillholm. Quaternions, Interpolation and Animation
- Byung-Uk Lee, Unit Quaternion Representation of Rotation
- Ibanez, Luis, Quaternion Tutorial I
- Ibanez, Luis, Quaternion Tutorial II
|