rotationMatrix

rotationMatrix(theta)

rotationMatrix(theta, v)

rotationMatrix(theta, v, format)

Try it yourself:

See also:

rotationMatrix(): Matrix for Geometric Rotation

rotationMatrix() constructs a matrix that rotates coordinates by a specified angle. In two dimensions, multiplying a point by this matrix turns it around the origin without changing its length.

Angles and orientation

Use radians consistently with sin() and cos(). Multiplication order and row-versus-column vector conventions matter; verify one known point before applying a rotation to a full data set.

Apply the result with multiply(), inspect dimensions with size(), and use transpose() when adapting between vector orientations. Rotation preserves distance, so norm() provides a useful check.

Try Rotation Matrix in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions