As shown here the axis angle for this rotation is: angle = 90 degrees axis = 1,0,0. So using the above result: c =cos(angle) = 0; s = sin(angle) = 1; t =1 - c =1; x=1; y=0; z= To understand this we must remember that we are are working with the specific case of rotation by 180° (π radians) which is the same as -180° (-π), reversing the angle is the same as reversing the axis, so if x,y,z is the axis we want then -x,-y,-z is also valid. So it is only the relative signs of these terms that matter and we can get these from the non diagonal terms of the matrix The simplest way to find the rotation angle is to take the trace of the matrix, the sum of the diagonal elements. By Cameron Buie's answer this equals $1 + 2\cos(\theta)$ where $\theta$ is the angle of rotation. $\theta$ can then be determined up to sign which will depend on the orientation of the axis of rotation chosen rotate A around its local axis aligned to axis of rotation by angle. by simple multiplication of A by axis aligned incremental rotation R so. A*R; revert the original transform of A before rotation. by simply multiplying inverse of A to the result so . A*R*Inverse(A); apply this on matrix M you want to rotate. also by simply multiplying this to M so: M*=A*R*Inverse(A); And that is it... Here 3D OBB approximation you can find function
Rodrigues' rotation formula, named after Olinde Rodrigues, is an efficient algorithm for rotating a Euclidean vector, given a rotation axis and an angle of rotation.In other words, Rodrigues' formula provides an algorithm to compute the exponential map from (3) to SO(3) without computing the full matrix exponential.. If v is a vector in ℝ 3 and e is a unit vector rooted at the origin. The rotation matrix in terms of the angle of rotation $\theta$ and axis of rotation $\{n1, n2, n3\}$. R[t_, {n1_, n2_, n3_}] := With[{n = {{0, -n3, n2}, {n3, 0, -n1}, {-n2, n1, 0}}, id = IdentityMatrix[3]}, Inverse[id - t n].(id + t n)
Given a unit axis, , and an angle, : Associate a rotation with a unit quaternion as follows: kˆ θ (just like axis angle) = 2,ˆsin 2 cos ˆ, θ θ θ Q k k The associated quaternion is: Therefore, represents the same rotation asQ − The latter rotation is the inverse of the pose_2-to-camera espressed by R2c, hence: R12 = R1c * inv (R2c) From matrix R12 you can then compute the angle and axis of rotation using Rodiguez's formula To find the angle of a rotation, once the axis of the rotation is known, select a vector perpendicular to the axis. Then the angle of the rotation is the angle between and . Rotation matrix from axis and angle For some applications, it is helpful to be able to make a rotation with a given axis. Given a unit vector u = (ux, uy, uz), where ux 2 + u Axis-Angle {[x, y, z], angle (radians)} Axis with angle magnitude (radians) [x, y, z] Euler angles (radians) Details. Please note that rotation formats vary. For quaternions, it is not uncommon to denote the real part first. Euler angles can be defined with many different combinations (see definition of Cardan angles). All input is normalized to unit quaternions and may therefore mapped to.
eul = rotm2eul (rotm) converts a rotation matrix, rotm, to the corresponding Euler angles, eul. The input rotation matrix must be in the premultiply form for rotations. The default order for Euler angle rotations is ZYX. For more details on Euler angle rotations, see Euler Angles All rotations in 3-D can be defined by an axis of rotation and an angle of rotation about that axis. Consider the 3-D image of a teapot in the leftmost plot. The teapot is rotated by 45 degrees around the Z-axis in the second plot. A more complex rotation of 15 degrees around the axis [1 0 1] is shown in the third plot. Quaternions encapsulate the axis and angle of rotation and have an algebra. 1. rotation by angle φ about the Zaxis; 2. rotation by angle θ about the new x′ 1 axis, which we will call the line of nodes ; 3. rotation by angle ψ about the new x3 axis. These rotations are illustrated in the following ﬁgure: X Y Z 1' 2' 1' 2' 3' 3 32 1' 2 1 2 φ φ θ θ ψ ψ We can now write the general rotation matrix that links A~ body with A~XYZ as the product of th Eqn 1c: Relationship Between the 3D Rotation Matrix and the Angle-Axis Representation; Source Link From the formula above (Eqn 1c), the composition of two 3D rotations about the same axis means that the axis vector u is constant.We can thus add up the rotation angles, as per the 2D case, and the composition of a +90° and a -10° rotation results in a +80° rotation over the axis vector u
The attitude matrix for mars' coordinates is. Either from its construction or by inspection, it is very nearly a rotation thru a small negative angle about the +z-axis, and the positive eigenvector. is nearly the z-axis; so we should go with the negative angle, too. Here it is in radians -0.428857 and in degrees -24.5717 a rotation matrix. Determination of Euler angles is sometimes a necessary step in computer graphics, vision, robotics, and kinematics. However, the solution may or may not be obvious. Rotation matrices We start oﬀ with the standard deﬁnition of the rotations about the three prin-ciple axes. A rotation of ψradians about the x-axis is deﬁned as R x(ψ) = 1 0
angle and a rotation axis. If the rotation axis is restricted to one of the three major axis, then one component always remains same. Look at the following (not optimal) figure where P is rotated around the z-axis: The z- component of the point remains same, so actually it's the same as rotating in the x-y-plane which corresponds to the 2D case. Rotation around the z-axis in matrix notation. interchanging any two columns or rows of a rotation matrix. 4. Rotations and angles A rotational transformation is uniquely deﬁned by a rotation matrix, but the natural expression of a rotation is as an angle; if we wish to enumerate all possible rotations for a systematic search, then angles are the usual way of doing this. However, a Figure 1 (a) Rotation of an object in two dimensions by. Constructs and initialize the angle-axis rotation from an angle in radian and an axis which must be normalized. Warning. If the axis vector is not normalized, then the angle-axis object represents an invalid rotation
There are two conventions on how to interpret rotations: active or passive rotation. The standard in pytransform3d is an active rotation. Note that there are some functions to generate rotation matrices that generate passive rotations as well: matrix_from_angle(), matrix_from_euler_xyz(), and matrix_from_euler_zyx(). These are kept for backward compatibility. When in doubt, read the docstring, which clearly states that a passive convention is used here Axis-angle representation Axis angle is can be encoded by just three numbers instead of four: If thenk 0 and k For most orientations, , is unique. Rk If the three-number version of axis angle is used, then R0 I For rotations of , there are two equivalent representations:180 If then Rk R
Given 3 Euler angles , the rotation matrix is calculated as follows: Note on angle ranges. The Euler angles returned when doing a decomposition will be in the following ranges: If you keep your angles within these ranges, then you will get the same angles on decomposition. Conversely, if your angles are outside these ranges you will still get the correct rotation matrix, but the decomposed. a 2D rotation. 2.1 Axis-Angle to Matrix If U, V, and W form a right-handed orthonormal set, then any point can be represented as X = u 0U + v 0V + w 0W. Rotation of X about the axis W by the angle produces RX = u 1U + v 1V + w 1W. Clearly from the geometry, w 1 = w 0 = WX. The other two components are changed as if a 2D rotation has been applied to them, so u 1 = cos( )u 0 sin( )v 0 and v 1.
↵ rotation of the plane by angle ↵. If ↵ > 0, then R ↵ rotates the plane counterclockwise by an angle of ↵. If ↵ < 0, then R ↵ is a clockwise rotation by an angle of |↵|. The rotation does not a↵ect the origin in the plane. That is, R ↵(0,0) = (0,0) always, no matter which number ↵ is. 258 + 0 vi 0 0 + vi C vi 4. c) C. For example, the most intuitive is that which is obtained first by performing a rotation on the X axis by an angle φ, then on the Y axis by an angle θ and finally on the Z axis by an angle ψ . The triplet of the angles used in these elementary rotations are the Euler angles and are normally indicated (φ, θ, ψ). Let's take an example in Python. We choose three euler angles and then we. The first rotation is around the z axis, through the angle α. It rotates the x and y axes into the x 1 and y 1 directions. Viewed down the z axis, this rotation appears as shown in the insert at the top of the figure. The direction cosine matrix associated with this rotation is [R 3 (α)] Accordingly, such rotation can be described by three independent parameters: two for describing the axis and one for the rotation angle. Orientation in space, however, can be represented in several other ways, each with its own advantages and disadvantages. Some of these representations use more than the necessary minimum of three parameters. The most common way of transforming position. angle. A tensor of shape [A1 An, 1], where the last dimension represents a normalized axis. name. A name for this op that defaults to rotation_matrix_3d_from_axis_angle
3D Rotations in Processing (Vectors, Matrices, Quaternions) Jeremy Behreandt. Feb 5, 2018 · 19 min read. This tutorial introduces how to rotate objects in 3D beyond Euler angles; to do this, it looks at the basics of matrices and quaternions. What follows is math heavy, so a robust artistic imagination will be valuable once we dig in A rotation matrix R should have the property I = R * R', but this isn't enforced by the constructor. Euler Angles - Three-axis rotations RotXYZ{T}, RotXYX{T}, etc. A composition of 3 cardinal axis rotations is typically known as a Euler angle parameterization of a 3D rotation. The rotations with 3 unique axes, such as RotXYZ, are said to follow the Tait Bryan angle ordering, while those. I am observing some surprising behavior in rotation_matrix_to_angle_axis, and I think it is worth raising although I am not yet sure it is actually a bug or a problem with my interpretation of the functions. The main observation is that I expect a cycle of conversion to be consistent (e.g. apllying angle_axis_to_rotation_matrix(rotation_matrix_to_axis_angle()) should be close to identity. nate system, despite its non-zero angular velocity. 2 Rotation Matrix A rotation matrix is a matrix whose multiplication with a vector rotates the vector while preserving its length. The special orthogonal group of all 3£3 rotation matrices is denoted by SO(3). Thus, if R 2 SO(3), then detR = §1 and R¡1 = RT: (1) Many ways to represent a rotation: • 3x3 matrices • Euler angles • Rotation vectors (axis/angle) • Quaternions Why might multiple representations be useful? Uses for Other Representations Numerical issues Storage User interaction Interpolation. Euler's Rotation Theorem An arbitrary rotation may be described by only three parameters (Wolfram definition) i.e. the composition of.
Title: Efficient conversion from rotating matrix to rotation axis and angle by extending Rodrigues' formula. Authors: Kuo Kan Liang (Submitted on 6 Oct 2018) Abstract: In computational 3D geometric problems involving rotations, it is often that people have to convert back and forth between a rotational matrix and a rotation described by an axis and a corresponding angle. For this purpose. Rotations in Space: Euler Angles, Matrices, and Quaternions¶ This notebook demonstrates how to use clifford to implement rotations in three dimensions using euler angles, rotation matices and quaternions. All of these forms are derived from the more general rotor form, which is provided by GA. Conversion from the rotor form to a matrix representation is shown, and takes about three lines of. With r = RotationMatrix[a, {x, y, z}] I can compute a 3D rotation matrix from its axis/angle representation. Given a 3D rotation matrix r, how can I compute a and {x, y, z}? Example: r = {{0.966.. The Rotation Matrix to VR Rotation converts Rotation Matrix (defined columnwise as 3-by-3 matrix or as a 9-element column vector) into the Axis / Angle rotation representation used for defining rotations in VR
Calculate the REAL scale factor and the angle of rotation from an Android Matrix. After performing transformations such as rotation of a bitmap about an arbitrary point, the scale is lost. Of course, this makes sense because the bitmap is rotated inside the same bounds. To get the real scale now, along with the most reliable degree of rotation, I had to follow this method. Hope it saves the. Compute rotation matrices from compact axis-angle representations. axis_angles_from_matrices (Rs[, traces, out]) Compute compact axis-angle representations from rotation matrices. cross_product_matrices (V) Generate the cross-product matrices of vectors. matrices_from_quaternions (Q[, ]) Compute rotation matrices from quaternions. quaternions_from_matrices (Rs[, out]) Compute quaternions.
A rotation matrix from Euler angles is formed by combining rotations around the x-, y-, and z-axes. For instance, rotating θ degrees around Z can be done with the matrix ┌ cosθ -sinθ 0 ┐ Rz = │ sinθ cosθ 0 │ └ 0 0 1 ┘ Similar matrices exist for rotating about the X and Y axes Usually the rotation matrix (R, rotating U to U1 from starting orientation to final orientation as defined above) is composed by a series of 3 rotations around the axes x, y and z by angles alpha, beta, gamma (respectively). The order can vary. This is clear on Wikipedia (Rotation matrix) Rotation of a vector from the Inertial Frame to the Vehicle-1 Frame can be performed by multiplying the vector by the rotation matrix. 4. The Vehicle-2 Frame (Yaw and Pitch Rotation) Pitch represents rotation about the vehicle-1 Y-axis by an angle as shown in Figure 3. For clarity, the inertial-frame axes are not shown. The vehicle-1 frame axes are shown in gray, and the vehicle-2 axes are.
An infinitesimal rotation is defined as a rotation about an axis through an angle that is very small: , where [].Rotations of this type play a role in defining stiffness matrices (see [] and references therein) and in numerical schemes that feature incremental updates to rotations and angular velocities (e.g., see []).Infinitesimal rotations differ from their finite counterparts in the. Euler angles are typically representes as phi (φ) for x-axis rotation, theta (θ) for y-axis rotation, and psi (ψ) for z-axis rotation. Any orientation can be described through a combination of these angles. Figure 1 represents the Euler angles for a multirotor aerial robot. These elemental rotations can take place about the axes of the fixed coordinate frame (extrinsic rotations) or about.
Propagation of quaternion vector: single rotation from inertial to body frame (4 parameters) 4!!Rotation from one axis system, I, to another, B, represented by !! Orientation of axis vector about which the rotation occurs (3 parameters of a unit vector, a 1, a 2, and a 3)!! Magnitude of the rotation angle, , ra Given a 3 x 3 rotation matrix, the angle and the axis of rotation are calcualted. Keywords Angle of rotation , Axis of rotation . Usage Arotation(A) Arguments A. A 3 x 3 rotation matrix. Details. If the user does not supply a rotation matrix a message will appear. Value. A list including: angle. The angle of rotation expressed in degrees. axis. The axis of rotation. A vector of two components. Create an SE(3) pure rotation matrix from Euler angles. Parameters. phi (float) - Z-axis rotation. theta (float) - Y-axis rotation. psi (float) - Z-axis rotation. unit (str) - angular units: 'rad' [default], or 'deg' Returns. SE(3) transformation matrix. Return type. ndarray(4,4) R = eul2tr(PHI, θ, PSI) is an SE(3) homogeneous transformation matrix equivalent to the specified. Transforms a matrix with a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in degrees. From GLM_GTX_transform extension. detail::tmat4x4<T> glm::scale
A rotation matrix is a 3x3 matrix which may be used to transform any arbitrary vector \((x, y, z)\) to the new rotated coordinates \((x', y', z')\). It is often more computationally efficient to consider a rotation matrix over Euler angles. The first rotation \(\alpha\) is about the \(Z\) axis, this is also called the azimuth
rotate - rotation matrix to axis angle . Rotation Matrix given angle and point in X,Y,Z (7) I am doing image manipulation and I want to rotate all of the pixels in xyz space based on an angle, the origin, and an x,y, and z coordinate. I just need to setup the proper matrix (4x4) and then I will be good from there. The Angle is in degrees, not radians and the x,y,z are all going to be from -1. Angle q 1 is defined positively when the rotation of p 1 ' is counterclockwise from f 1, consistent with the angular representation for the f 3, p 3 ' axis. The view is defined with the f 3 , p 3 ' unit vectors pointing out of the paper (directly at the viewer), and with the angle q 1 positive and less than 90 degrees covert rotation matrix to axis-angle. I use IterativeClosestPoint to get the transformation matrix and then I keep the rotation matrix. I want from this matrix to find the axis-angle. Is there any way.. Rotations in Space: Euler Angles, Matrices, and Quaternions ¶ This notebook demonstrates how to use clifford to implement rotations in three dimensions using euler angles, rotation matices and quaternions. All of these forms are derived from the more general rotor form, which is provided by GA. Conversion from the rotor form to a matrix representation is shown, and takes about three lines of.
Creates a rotation matrix from axis and angle around point. Returns the resulting QMatrix4x4. Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE. [static] QMatrix4x4 QTransform:: rotateFromAxes (const QVector3D &xAxis, const QVector3D &yAxis, const QVector3D &zAxis) Returns a rotation matrix defined from the axes xAxis, yAxis, zAxis. Note: This function. Computing Euler angles from a rotation matrix. GitHub Gist: instantly share code, notes, and snippets To understand the involved matrices I found it useful to clarify what a rotation matrix actually does. The common standard matrices for rotations around X, Y, Z axis rotate a point around the respective world axis. Let's take the simple rotation matrix in which rotates around an angle around the imaginary z-axis Rotation vectors (axis/angle) 3x3 matrices Quaternions and more Euler's Theorem Euler's Theorem: Any two independent orthonormal coordinate frames can be related by a sequence of rotations (not more than three) about coordinate axes, where no two successive rotations may be about the same axis. Not to be confused with Euler angles, Euler integration, Newton-Euler dynamics, inviscid.
Return angle, axis corresponding to Euler angles, axis specification: euler2mat (ai, aj, ak[, axes]) Return rotation matrix from Euler angles and axis sequence. euler2quat (ai, aj, ak[, axes]) Return quaternion from Euler angles and axis sequence axes: mat2euler (mat[, axes]) Return Euler angles from rotation matrix for specified axis sequence -7- φ=0 and the axis of rotation is not well defined. If the trace of the rotation matrix is -1, φ=π, and from the Euler-Lexell formula: R =−2uu IT from which u can be solved. For every rotation of angle φ about the axis u, we can also obtain an equivalent axis-angle representation with a rotation -φ about the axis -u.Also for every solution (u, φ), we have othe Rotation given in axis-angle form, returned as an n-by-4 matrix of n axis-angle rotations. The first three elements of every row specify the rotation axis, and the last element defines the rotation angle (in radians). Example: [1 0 0 pi/2] Extended Capabilities. C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™. See Also. axang2rotm. Topics. Coordinate Transformations in.
Rotation matrix sign convention confusion. In rotation matrix, Why do we rotate the first and third rotation in the opposite direction of the 2nd rotation, this is confusing. Image is attached with this. In this image we can note that for x and Z rotation non zero elements are same. But for Y rotation sign of sin (theta) changed Unfortunately, rotation matrices are not so easily (ortho)normalizable, and so you're best off using the full axis-angle to rotation matrix conversion to implement the exponential map for matrices. For this reason the quaternion description is preferable to rotation matrices. Conclusion . We have derived a method for time-stepping rotational dynamics that expresses each update as a rotation. Convert your axis and angle representation into a rotation matrix or a quaternion (like i did below), so you can apply it to your objects transform data. Rotate the object, and optionally constrain its up vector if desired. I did this by constructing orientation matrix manually just like usual when we need a 'look at' matrix. repeat all this in the next frame until the object is nicely.
Tags: Euler Axis, Euler rotation example, Principal Angle, Quaternion, Rotation matrix By smallsat in Space Flight/Orbital Mechanics Excercise on December 9, 2012 . ← CubeSats currently in orbit Space Debris While matrices are a neat way to transform vertices, handling matrices is difficult: for instance, getting the rotation axis from the final matrix is quite tricky. We will present the two most common ways to represent rotation: Euler angles and Quaternions. Most importantly, we will explain why you should probably use Quaternions. Foreword: rotation VS orientation. While reading articles on. Rotations and Angular momentum Intro The material here may be found in Sakurai Chap 3: 1-3, (5-6), 7, (9-10) Merzbacher Chap 11, 17. Chapter 11 of Merzbacher concentrates on orbital angular momentum. Sakurai, and Ch 17 of Merzbacher focus on angular momentum in relation to the group of rotations. Just as linear momentum is related to the translation group, angular momentum operators are. Lecture L3 - Vectors, Matrices and Coordinate Transformations By using vectors and deﬁning appropriate operations between them, physical laws can often be written in a simple form. Since we will making extensive use of vectors in Dynamics, we will summarize some of their important properties. Vectors For our purposes we will think of a vector as a mathematical representation of a physical.
Euler principal rotation angle and Euler axis of rotation. Euler principal rotation angle [deg] theta = 2*acos(q(4))*180/pi % The unit vector along the Euler axis around which the inertial reference % frame is rotated into the body fixed frame u = [q1 q2 q3]/(sind(theta/2)) theta = 109.2075 u = 0.4975 0.7106 -0.497 Rotation of a vector from the Inertial Frame to the Vehicle‐1 Frame can be performed by multiplying the vector by the rotation matrix 4. The Vehicle‐2 Frame (Yaw and Pitch Rotation) Pitch represents rotation about the vehicle‐1 Y‐axis by an angle as shown in Figure 3. For clarity, the inertial‐frame axes are not shown. Th
second-angle matrix. So we need to compute the following: If this product represents a pure rotation about the z-axis, it must be of the following form: and extraction of should be straightforward. In practice we don't even need to compute a full matrix product. Reading across the middle row of , we obtain and hence which requires that we compute the sine and cosine of the value we extracted. Suppose I give you an axis of rotation and an angle of rotation. How do you calculate the rotation matrix armed with these two pieces of information? And note that we already know how to do this if the axis of rotation is the x axis or the y axis or the z axis. In fact, we discussed formulae for these very simple cases. But now, we have an arbitrarily oriented axis given by the unit factor U. The correct way to update a rotation matrix R (t) under a given angular velocity w is as follows: (1) Since w=dot_phi times k, where phi is the rotation angle about a unity axis k, you can find. Introduction A rotation matrix, \({\bf R}\), describes the rotation of an object in 3-D space. It was introduced on the previous two pages covering deformation gradients and polar decompositions. The rotation matrix is closely related to, though different from, coordinate system transformation matrices, \({\bf Q}\), discussed on this coordinate transformation page and on this transformation.
Apr 21, 2013. The way you typically use a rotation matrix R is you multiply it by vector x to get a new vector x'. For example, take a rotation about the z-axis by the angle θ. The matrix that represents that rotation is given by. θ 0 0 0 1]. If we apply it an arbitrary vector, [ x y z], we get Rotations in Three-Dimensions: Euler Angles and Rotation Matrices. Describes a commonly used set of Tait-Bryan Euler angles, and shows how to convert from Euler angles to a rotation matrix and back. Rotation Conversion Tool. An on-line utility that converts between Euler Angles, Quaternions, Axis-Angle, and Rotation Matrix representations We can associate a quaternion with a rotation around an axis by the following expression. where α is a simple rotation angle (the value in radians of the angle of rotation) and cos(β x), cos(β y) and cos(β z) are the direction cosines locating the axis of rotation (Euler's Theorem). Rotation matrices. The orthogonal matrix (post-multiplying a column vector) corresponding to a clockwise.
If you use the standard y-rotation matrix (assume rotation around the y 1 axis of frame 1), you would place that after the matrix we found earlier (i.e. on the right). That would look like this: Multiplying the matrices above, together, we get: The middle column of the matrix above represents the projection of the y 1 axis onto frame 0. You can see that, no matter what servo 0 (i.e. joint 1. • The y-axis is aligned at right angles to both the x and z axes so that the three axes form a right handed coordinate system. Changes in orientation are described by rotations in roll φ, pitch θ and yaw ψ about the x, y and z axes respectively. Proof Mass Simplified Model Equivalent Circuit. Tilt Sensing Using a Three-Axis Accelerometer, Rev. 6 Freescale Semiconductor, Inc. 5 Figure 3. Angular displacement of a body is the angle in radians (degrees, revolutions) through which a point revolves around a centre or line has been rotated in a specified sense about a specified axis.When a body rotates about its axis, the motion cannot simply be analyzed as a particle, as in circular motion it undergoes a changing velocity and acceleration at any time (t)
Rotation around a given axis deﬁne subgroups of SO(3). Each of these subgroups is isomorphic to U(1). Inﬁnitesimal rotation Since rotations are identiﬁed by a continuous rotation angle, we can con-sider rotations by inﬁnitesimally small angles. The action of an inﬁnitesimal rotation on a vector is given by: Ru(dθ)v = v +dθu ×v. (4.8 we could create a rotation matrix around the z axis as follows: cos ψ -sin ψ 0. sin ψ cos ψ 0. 0 0 1. and for a rotation about the y axis: cosΦ 0 sinΦ. 0 1 0. -sinΦ 0 cosΦ. I believe we just multiply the matrix together to get a single rotation matrix if you have 3 angles of rotation Solution 3: A one-liner, with numpy/scipy functions. We use the following: let a be the unit vector along axis, i.e. a = axis/norm (axis) and A = I × a be the skew-symmetric matrix associated to a, i.e. the cross product of the identity matrix with a. then M = exp (θ A) is the rotation matrix