# Visualization of rotation

This animation shows three ways to visualize a rotation:

The central image shows an intuitive visualization of all faces of the cube at least once, which would be nice if you wanted to showcase an object (like a new design for an automobile) in a way that shows it from multiple perspectives.

The visualization on the left is a Lambert projection of the cube’s six unit normals. Once you understand the meaning of a Lambert projection (explained below), it should be fairly easy to perceive the scheme used to rotate the cube so pleasingly.  Each dot in the Lambert projection represents the unit normal of one of the six faces of the cube.  Unit vectors (in this case, unit normals to the cube’s faces) are points on a unit sphere, and the Lambert projection is an “unwrapped” view of the unit sphere. Specifically, the Lambert projection is the following image at the instant it is flat:

Lambert mapping of a sphere to a disk.  The area of each grid cell is constant.

The Lambert projection is somewhat like a view of the sphere looking down the z-axis except that the entire surface of the sphere (not just the visible northern hemisphere) is depicted. The dashed circle in the first rotation animation is the Lambert projection of the equator. The region inside the dashed circle is the “northern hemisphere,” similar to an ordinary view of the sphere seen down the z-axis. Hence, the side of the cube currently pointing upward in the middle image (thus having a unit normal in the z-direction) is depicted as the central point in the Lambert projection. Since the dashed line is the equator, any unit vector perpendicular to the z-axis will map to the dashed line (e.g., the normal pointing in the positive x-direction will show up in the Lambert projection where the dashed line intersects the x-axis). In the Lambert projection, the region falling outside the dashed line is a highly distorted view of the “southern hemisphere”  (i.e., the “dark side” of the sphere that would not be visible when viewing it from the positive z-axis. Any point on the outer ring of the Lambert projection corresponds to a unit normal pointing in the NEGATIVE z-direction on the sphere. As seen in the Lambert animation of the rotation, faces #1 and #6 simply rotate in a circle with their unit normals staying always on the equator of the sphere. Meanwhile, the other faces of the cube change their unit normals to always move in circles around the major diameter of the sphere perpendicular to normals #1 and #6. This gives enough information to assign directions to the 1st, 2nd, and 3rd cube normals, which are the columns of the rotation matrix.

In the top image of this post, where three depictions of rotation are shown, the last depiction is a “nautical” representation for the rotation, in which the arrow represents a sailboat on the surface of a “water world.”  The mast of the sailboat always stays aligned with the 3rd face of the cube. The heading of the sailboat stays always aligned with the 1st face of the cube. The nautical representation hints how to generate uniformly random rotations: you need to create a uniform distribution on the sphere for the “mast” (which, importantly, is NOT achieved by uniformly random spherical coordinate angles), and then the boat’s heading needs to be a uniformly random rotation about the mast.  This strategy results in the following highly efficient Arvo algorithm for uniformly random rotations:

The Mathematica notebook that was used to generate the rotation visualization may be downloaded here: VisualizingRotations_ShowcasingArvoRandomRotation.nb.

The images and source code in this post may be used freely if this website is credited as follows:     Brannon, R.M. (2013) https://csmbrannon.net/2013/11/25/visualization-of-rotation/.  It would be really great if someone would convert this Mathematica notebook to a Wolfram Demonstration.  I don’t have time to do it.