This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Add-ons / Standard Packages / Geometry  /


Rotations in two dimensions.

The usual mathematical convention is that angles in the plane are measured counterclockwise from the positive axis. RotationMatrix2D gives the matrix needed to change coordinates by a rotation in this direction. This means that if this matrix is used to move vectors, they will be rotated in the clockwise direction. As is the case with all built-in Mathematica

functions, all angles are given in radians.

  • This loads the package.
  • In[1]:= <<Geometry`Rotations`

  • Here is the matrix for rotation by degrees displayed using MatrixForm

  • In[2]:= MatrixForm[RotationMatrix2D[ N[Pi/3]] ]


  • This is a list containing two points in the plane.
  • In[3]:= {a, b} = {{0., 0.}, {0.5, 0.5}}


  • Each point is rotated by degrees about the point {1,

  • In[4]:= {anew, bnew} =
    {Rotate2D[a, N[Pi/3], {1., 1.}],
    Rotate2D[b, N[Pi/3], {1., 1.}]}


  • This shows a line joining the two points before and after the rotation. The point at the center of the rotation is also shown.
  • In[5]:= Show[Graphics[
    {Line[{a, b}], Line[{anew, bnew}],
    {PointSize[.02], Point[{1, 1}]}}],

    Rotations in three dimensions.

    The rotation given by the Euler angles psi, theta, and phi can be decomposed into a sequence of three successive rotations. The first by angle psi about the axis, the second by angle theta about the axis, and the third around the axis (again) by angle phi. The angle theta is restricted to the range to


  • If you give exact arguments, the entries in the matrix are exact.
  • In[6]:= RotationMatrix3D[Pi, Pi/3, Pi/4]


    To rotate an entire three-dimensional graphics object you need to transform all the coordinates specified in the list of primitives for the object. You can do this using the function RotateShape provided in the package Graphics`Shapes`.