Difference between revisions of "Rotations using quaternions"
Line 4: | Line 4: | ||
Usually rotations are defined by 3 angles, either [[Euler angles|Euler]] or [[Roll-Pitch-Yaw]] angles. So three successive rotations around three different axes lead to a combined rotation, that can be described by a single rotation matrix. Such a combined rotation is equal to a rotation around a certain axis in three-dimensional space about a certain angle. This is shown in the figure on the right. The vector <math>\vec{\mathbf{r}}</math> is rotated such that it results in <math>\vec{\mathbf{r}}'</math>. This could be done by rotating the vector around the z-, the y- and the x-axis successively or by just rotating it around the rotation axis <math>\vec{\mathbf{u}}</math> by <math>\phi</math>. | Usually rotations are defined by 3 angles, either [[Euler angles|Euler]] or [[Roll-Pitch-Yaw]] angles. So three successive rotations around three different axes lead to a combined rotation, that can be described by a single rotation matrix. Such a combined rotation is equal to a rotation around a certain axis in three-dimensional space about a certain angle. This is shown in the figure on the right. The vector <math>\vec{\mathbf{r}}</math> is rotated such that it results in <math>\vec{\mathbf{r}}'</math>. This could be done by rotating the vector around the z-, the y- and the x-axis successively or by just rotating it around the rotation axis <math>\vec{\mathbf{u}}</math> by <math>\phi</math>. | ||
− | But how | + | === Mathematical Description=== |
+ | |||
+ | But how can such a rotation be described by a quaternion? First the rotation axis <math>\vec{\mathbf{u}}</math> has to be defined by a unit vector. So it holds: | ||
+ | :<math> | ||
+ | |\vec{\mathbf{u}}|=1 | ||
+ | </math> | ||
+ | A quaternion <math>q</math> consists of a scalar component <math>q_0</math> and 3 vector components <math>q_1</math>, <math>q_2</math> and <math>q_3</math>. | ||
+ | |||
+ | ===Applet=== | ||
The following three-dimensional applet helps you to understand the relation between [[Roll-Pitch-Yaw]] angles and a quaternion. The initial position of the object can be set using the sliders for x, y and z. Then the object can be rotated by defining the roll, pitch and yaw angles. The most intuitive way is to start with the yaw angle, because this one is applied first. Then the object is rotated aroud the y-axis by the pitch angle followed by a rotation around the x-axis by the roll angle. The quaternion describing the same rotation is shown dynamically and the corresponding angle <math>\alpha</math> and the rotation axis <math>\vec{\mathbf{u}}</math> are presented. The rotation axis and the rotational path are visualized on the left side. After pressing the ''Show Quaternion Rotation'' button, the rotation of the object around <math>\vec{\mathbf{u}}</math> gets animated. | The following three-dimensional applet helps you to understand the relation between [[Roll-Pitch-Yaw]] angles and a quaternion. The initial position of the object can be set using the sliders for x, y and z. Then the object can be rotated by defining the roll, pitch and yaw angles. The most intuitive way is to start with the yaw angle, because this one is applied first. Then the object is rotated aroud the y-axis by the pitch angle followed by a rotation around the x-axis by the roll angle. The quaternion describing the same rotation is shown dynamically and the corresponding angle <math>\alpha</math> and the rotation axis <math>\vec{\mathbf{u}}</math> are presented. The rotation axis and the rotational path are visualized on the left side. After pressing the ''Show Quaternion Rotation'' button, the rotation of the object around <math>\vec{\mathbf{u}}</math> gets animated. |
Revision as of 13:15, 8 September 2015
← Back: Multiplication of quaternions | Overview: Quaternions | Next: Realization of transformations → |
Usually rotations are defined by 3 angles, either Euler or Roll-Pitch-Yaw angles. So three successive rotations around three different axes lead to a combined rotation, that can be described by a single rotation matrix. Such a combined rotation is equal to a rotation around a certain axis in three-dimensional space about a certain angle. This is shown in the figure on the right. The vector is rotated such that it results in . This could be done by rotating the vector around the z-, the y- and the x-axis successively or by just rotating it around the rotation axis by .
Mathematical Description
But how can such a rotation be described by a quaternion? First the rotation axis has to be defined by a unit vector. So it holds:
A quaternion consists of a scalar component and 3 vector components , and .
Applet
The following three-dimensional applet helps you to understand the relation between Roll-Pitch-Yaw angles and a quaternion. The initial position of the object can be set using the sliders for x, y and z. Then the object can be rotated by defining the roll, pitch and yaw angles. The most intuitive way is to start with the yaw angle, because this one is applied first. Then the object is rotated aroud the y-axis by the pitch angle followed by a rotation around the x-axis by the roll angle. The quaternion describing the same rotation is shown dynamically and the corresponding angle and the rotation axis are presented. The rotation axis and the rotational path are visualized on the left side. After pressing the Show Quaternion Rotation button, the rotation of the object around gets animated.