Learn R Programming

Rknots (version 1.3.1)

rMatrix: Rotation matrix along the $z$ axis

Description

Compute the rotation matrix by an angle $\theta$ along the $z$ axis

Usage

rMatrix(theta)

Arguments

theta
The rotation angle, in radians

Value

  • A 3 x 3 matrix

Details

The counterclockwise 3 x 3 rotation matrix by an angle $\theta$ along the $z$ axis is defined as: $$\left[ \begin{array}{ccc} \cos \theta & -\sin \theta & 0 \ \sin \theta & \cos \theta & 0 \ 0 & 0 & 1 \ \end{array} \right]$$

References

Weisstein, Eric W. "Rotation Matrix." From MathWorld--A Wolfram Web Resource, http://mathworld.wolfram.com/RotationMatrix.html

Examples

Run this code
##Rotation matrix by theta = 45 degrees
rMatrix(pi/4)

##to rotate clockwise by 45 degrees
rMatrix(-pi/4)

Run the code above in your browser using DataLab