# Rotating a Cube Using Quaternions

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

A quaternion can represent both a rotation axis and the angle of rotation about this axis (a vector and a scalar). Instead of turning an object through a series of successive rotations with rotation matrices, quaternions are used to rotate an object more smoothly around an arbitrary axis (here ) and at any angle. This program uses the quaternion rotation formula: with (a pure quaternion), , and for a unit quaternion , such that if , . A derivation of these formulas is given in [1].

Contributed by: Gerard Balmens (February 2016)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

Reference

[1] Wikipedia. "Quaternions and Spatial Rotation." (Feb 9, 2016) en.wikipedia.org/wiki/Quaternions_and_spatial _rotation.

## Permanent Citation

"Rotating a Cube Using Quaternions"

http://demonstrations.wolfram.com/RotatingACubeUsingQuaternions/

Wolfram Demonstrations Project

Published: February 15 2016