# [−][src]Module micromath::quaternion

Quaternions are a number system that extends the complex numbers which can be used for efficiently computing spatial rotations.

The `quaternion`

Cargo feature must be enabled to use this functionality.

Quaternions are computed as the quotient of two directed lines in a three-dimensional space, or equivalently as the quotient of two vectors.

For given real numbers `a`

, `b`

, `c`

, and `d`

, they take the form:

`a + bi + cj + dk`

where `i`

, `j`

, and `k`

are the fundamental quaternion units:

`i² = j² = k² = i*j*k = -1`

Quaternion multiplication is noncommutative:

x | 1 | i | j | k |
---|---|---|---|---|

1 | 1 | i | j | k |

i | i | -1 | k | -j |

j | j | -k | -1 | i |

k | k | j | -i | -1 |

## Structs

Quaternion | Quaternion |