![]() |
Rotation Matrix is a matrix used to perform a rotation in a coordinate space. Rotation matrices are widely used in various fields, including computer graphics, robotics, physics, and navigation systems, to describe and manipulate the orientation of objects in space. In this article, we will discuss Rotation Matrices including 2D and 3D rotation matrices. Table of Content What is a Rotation Matrix?A rotation matrix is a matrix used to perform a rotation in a Euclidean space. For 2D and 3D spaces, which are the most common cases in applications across different fields, rotation matrices rotate points or vectors about an origin without changing their magnitude. A rotation matrix is a mathematical representation of the rotation of a coordinate system or a set of vectors in a Euclidean space. It is a square matrix that, when multiplied with a vector, results in the rotation of that vector around the origin. This implies that it will always have an equal number of rows and columns. Moreover, rotation matrices are orthogonal matrices with a determinant equal to 1. Suppose we have a square matrix P. Then P will be a rotation matrix if and only if PT = P-1 and |P| = 1. Definition of Rotation Matrix
Example of Rotation using MatrixSay we have a matrix [Tex]P= \begin{bmatrix} cos\theta & sin\theta \\ -sin\theta & cos\theta \end{bmatrix}[/Tex] . This is a 2 × 2 matrix. [Tex]P^T = \begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix} P^-1 = \begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix}[/Tex] Hence, PT = P-1 Now, |P| = (cos2θ + sin2θ) = 1. Thus, P is a rotation matrix. We can say that P rotates the cartesian coordinates in an anticlockwise direction through θ with respect to the x-axis in a 2-D system. Representation of Rotations in MathematicsIn mathematics, rotations can be represented in various ways, including:
Each representation has its own advantages and disadvantages, and the choice of representation often depends on the specific requirements of the application. 2D Rotation MatrixThe process of rotating an object with respect to an angle in a two-dimensional plane is 2D rotation. We accomplish this rotation with the help of a 2 × 2 rotation matrix that has the standard form as given below: [Tex]M(\theta)=\begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix}[/Tex] If we want to rotate a vector with the coordinates (x, y) then we use matrix multiplication to perform the rotation as follows: [Tex]\begin{bmatrix} x’\\ y’ \end{bmatrix}=\begin{bmatrix} cos\theta & -sin\theta \\ sin\theta & cos\theta \end{bmatrix} \begin{bmatrix} x\\ y \end{bmatrix}[/Tex] On solving this equation we get, x’ = xcosθ – ysinθ. y’ = xsinθ + ycosθ. Here, θ is the angle of rotation in the anti-clockwise direction. Derivation of the 2D Rotation MatrixLet G be a vector in the x-y plane with a length r and it traces out an angle v with respect to the x-axis. We now rotate G in the counter-clockwise direction by an angle θ. If (x, y) were the original coordinates of the tip of the vector G, then (x’, y’) will be the new coordinates after rotation. Expressing (x, y) in the polar form we have;
Similarly, expressing (x’, y’) in polar form x’ = r cos (v + θ) y’ = r sin (v + θ) Expanding the brackets using trigonometric identities we get, x’ = r (cos v.cos θ – sin v.sin θ) ⇒ x’ = r cos v.cos θ – r sin v.sin θ From (1) and (2) we have, x’ = x cos θ – y sin θ . . . (3) y’ = r (sin v.cos θ + cos v.sin θ) ⇒ y’ = r sin v.cos θ + r cos v.sin θ ⇒ y’ = y cos θ + x sin θ . . . (4) If we take the help of a 2 × 2 rotation matrix to denote (3) and (4) we get, [Tex]\begin{bmatrix} x’ \\ y’ \end{bmatrix} = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix} \cdot \begin{bmatrix} x \\ y \end{bmatrix}[/Tex] Thus, [Tex] R(\theta) = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix}[/Tex] will be the rotation matrix. Rotating Points in a 2D PlaneTo rotate a point (x, y) in a 2D plane by an angle θ, you can multiply the point vector by the 2D rotation matrix: [Tex]\begin{bmatrix} x’ \\ y’ \end{bmatrix} = \begin{bmatrix} cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}[/Tex] The resulting vector (x’, y’) represents the rotated point. 3D Rotation MatrixIn 3D space, rotation can occur about the x, y, or z-axis. Such a type of rotation that occurs about any one of the axis is known as a basic or elementary rotation. Given below are the rotation matrices that can rotate a vector through an angle about any particular axis. [Tex]P(x, \gamma) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(\gamma) & -sin(\gamma) \\ 0 & sin(\gamma) & cos(\gamma) \end{bmatrix}[/Tex]. This is also known as a roll and it’s defined as the counterclockwise rotation of γ about the x axis. [Tex]P(y, \beta)=\begin{bmatrix} cos(\beta) & 0 & sin(\beta) \\ 0 & 1 & 0 \\ -sin(\beta) & 0 & cos(\beta) \end{bmatrix}[/Tex]. Such a matrix is known as a pitch. Here, it represents the counterclockwise rotation of β about the y axis. [Tex]P(z, \alpha)=\begin{bmatrix} cos(\alpha) & -sin(\alpha) & 0 \\ sin(\alpha) & cos(\alpha) & 0 \\ 0 & 0 & 1 \end{bmatrix}[/Tex]. This rotation matrix is called a yaw and it is the the counterclockwise rotation of α about the z axis. According to the convention, a positive rotation given by angle θ is used to denote a counter-clockwise rotation. However, if we change the signs according to the right-hand rule, we can also represent clockwise rotations. The right-hand rule states that if you curl your fingers around the axis of rotation, where the fingers point to the direction of θ then the thumb points perpendicular to the plane of rotation in the direction of the axis of rotation. Now if we want to find the new coordinates (x’, y’, z’) of a vector(x, y, z) after rotation about a particular axis we follow the formula given below: [Tex]\begin{bmatrix} x’ \\ y’\\ z’ \end{bmatrix} = P(x, y \space or z)\begin{bmatrix} x \\ y\\ z \end{bmatrix} [/Tex] Suppose an object is rotated about all three axes, then such a rotation matrix will be a product of the three aforementioned rotation matrices [P (z, α), P (y, β) and P (x, γ)]. The general rotation matrix is represented as follows: [Tex]P=\begin{bmatrix} cos(\alpha) & -sin(\alpha) & 0 \\ sin(\alpha) & cos(\alpha) & 0 \\ 0 & 0 & 1 \end{bmatrix}\begin{bmatrix} cos(\beta) & 0 & sin(\beta) \\ 0 & 1 & 0 \\ -sin(\beta) & 0 & cos(\beta) \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(\gamma) & -sin(\gamma) \\ 0 & sin(\gamma) & cos(\gamma) \end{bmatrix}[/Tex] To find the coordinates of the rotated vector about all three axes we multiply the rotation matrix P with the original coordinates of the vector. Derivation of the 3D Rotation MatrixTo derive the x, y, and z rotation matrices, we will follow the steps similar to the derivation of the 2D rotation matrix. A 3D rotation is defined by an angle and the rotation axis. Suppose we move a point Q given by the coordinates (x, y, z) about the x-axis to a new position given by (x’, y,’ z’). The x component of the point remains the same. Hence, this rotation is analogous to a 2D rotation in the y-z plane. For this reason our 3 × 3 rotation matrix is given by [Tex]Q(x, \gamma)=\begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(\gamma) & -sin(\gamma) \\ 0 & sin(\gamma) & cos(\gamma) \end{bmatrix}[/Tex]. The same concept is applied to the rotation of the object about the y and z axes in order to obtain the respective rotation matrices. Rotating Points in 3D CoordinatesTo rotate a point (x, y, z) in 3D space by an angle θ around a specific axis, you can multiply the point vector by the corresponding 3D rotation matrix: [Tex]\begin{bmatrix} x’ \\ y’\\ z’ \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(\theta) & -sin(\theta) \\ 0 & sin(\theta) & cos(\theta) \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix}[/Tex] The resulting vector (x’, y’, z’) represents the rotated point. Properties of Rotation MatricesRotation matrices possess several important properties:
These properties make rotation matrices a powerful and versatile tool for representing and manipulating rotations in various applications. Euler’s Rotation TheoremEuler’s rotation theorem states that any rotation of a rigid body in three-dimensional space can be described as a single rotation around a fixed axis. This axis is known as the Euler axis, and the angle of rotation around this axis is called the Euler angle. Applications of Rotation MatricesSome of the most common applications of rotation of matrices are:
ConclusionRotation matrices are a fundamental concept in mathematics and have numerous applications in various fields, including computer graphics, robotics, physics, and navigation systems. Understanding the properties and representations of rotation matrices is crucial for working with spatial transformations and orientation-related problems. This article has provided a comprehensive overview of rotation matrices, covering their definition, 2D and 3D representations, properties, and the Euler rotation theorem. By mastering the concepts presented here, you can effectively work with rotations and apply them in your own projects and research. Read More,
Solved Problems on Rotation MatrixExample 1: If A (1, -2) is rotated in the counterclockwise direction by 60°, what are the coordinate values?Solution:
Example 2: If B (2, 3) is rotated in the clockwise direction by 90°, what are the coordinate values?Solution:
Example 3: If C (5, 2, 6) is rotated in the counterclockwise direction by 180° about the x-axis, what are the coordinate values?Solution:
Practice ProblemsQ1: State whether true or false: Is [Tex]\begin{bmatrix} 5 & -1\\2&0 \end{bmatrix}[/Tex] a rotation matrix. Q2: If we rotate J(3, 4, -1) in a counterclockwise direction by 45° about the z-axis, what are the new coordinates? a) (-1, -3, -2) b) (1, 4, 5) c) (6, -1, -2) d) (-0.71, 4.97, -1) Q3: Prove that the product of two rotation matrices is also a rotation matrix. FAQs on Rotation MatrixWhat is the difference between a rotation matrix and a transformation matrix?
How can I convert between different representations of rotations (e.g., rotation matrices, quaternions, Euler angles)?
How can I compose multiple rotations using rotation matrices?
What is the difference between a clockwise and a counterclockwise rotation?
|
Reffered: https://www.geeksforgeeks.org
Mathematics |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |