# [−][src]Module nannou::math

A mathematical foundation for nannou including point and vector types and a range of helper/utility functions.

## Re-exports

`pub use approx;` |

`pub use cgmath;` |

`pub use self::cgmath::num_traits;` |

## Modules

prelude | This module contains the most common traits used in |

## Structs

Basis2 | A two-dimensional rotation matrix. |

Basis3 | A three-dimensional rotation matrix. |

Decomposed | A generic transformation consisting of a rotation, displacement vector and scale amount. |

Deg | An angle, in degrees. |

Euler | A set of Euler angles representing a rotation in three-dimensional space. |

Matrix2 | A 2 x 2, column major matrix |

Matrix3 | A 3 x 3, column major matrix |

Matrix4 | A 4 x 4, column major matrix |

Ortho | An orthographic projection with arbitrary left/right/bottom/top distances |

Perspective | A perspective projection with arbitrary left/right/bottom/top distances |

PerspectiveFov | A perspective projection based on a vertical field-of-view angle. |

Quaternion | A quaternion in scalar/vector form. |

Rad | An angle, in radians. |

## Traits

Angle | Angles and their associated trigonometric functions. |

Array | An array containing elements of type |

BaseFloat | Base floating point types |

BaseNum | Base numeric types with partial ordering |

Bounded | Numbers which have upper and lower bounds |

ElementWise | Element-wise arithmetic operations. These are supplied for pragmatic reasons, but will usually fall outside of traditional algebraic properties. |

EuclideanSpace | Points in a Euclidean space with an associated space of displacement vectors. |

Float | Generic trait for floating point numbers |

InnerSpace | |

Matrix | A column-major matrix of arbitrary dimensions. |

MetricSpace | A type with a distance function between values. |

NumCast | An interface for casting between machine scalars. |

One | Defines a multiplicative identity element for |

Rotation | A trait for a generic rotation. A rotation is a transformation that creates a circular motion, and preserves at least one point in the space. |

Rotation2 | A two-dimensional rotation. |

Rotation3 | A three-dimensional rotation. |

SquareMatrix | A column-major major matrix where the rows and column vectors are of the same dimensions. |

Transform | A trait representing an affine transformation that can be applied to points or vectors. An affine transformation is one which |

Transform2 | |

Transform3 | |

VectorSpace | Vectors that can be added together and multiplied by scalars. |

Zero | Defines an additive identity element for |

## Functions

clamp | Clamp a value between some range. |

deg_to_rad | Convert the given angle in degrees to the same angle in radians. |

fmod | Models the C++ fmod function. |

map_range | Map a value from a given range to a new given range. |

partial_max | The max between two partially ordered values. |

partial_min | The min between two partially ordered values. |

rad_to_deg | Convert the given angle in radians to the same angle in degrees. |

rad_to_turns | Convert the given value in radians to the equivalent value as a number of turns. |

turns_to_rad | Convert the given value as a number of "turns" into the equivalent angle in radians. |

two |