Crate angular_units [] [src]

Library for representing and manipulating angular quantities. Provides type-safe wrapper types for each unit as well as helper traits for abstracting over the concrete types. Conversions between types is easy and safe, allowing highly flexible manipulation.

Details

Arithmetic

Each angle type defines basic arithmetic operators. Multiplication and division are between an angle and a scalar. Addition and subtraction are between two angles and the two angles do not have to be represented using the same units for example, the following is valid:

let angle = Turns(0.25) + Deg(30.0) - ArcMinutes(15.0);

When combining units like this, the left-hand side type will be the result.

Normalization

For performance, most operations do not normalize the results or inputs automatically. This is mathematically sound, but it is often more convenient to have a single value to represent each angle. Thus, for methods that expect an angle within the standard domain, normalize() should be used to create an equivalent angle that is less than one period.

Structs

ArcMinutes

An angular quantity measured in arc minutes, which are 1/60th of a degree.

ArcSeconds

An angular quantity measured in arc seconds, which are 1/60th of an arc minute.

Deg

An angular quantity measured in degrees.

Rad

An angular quantity measured in degrees.

Turns

An angular quantity measured in "turns", or full rotations.

Traits

Angle

Base functionality for all angle types.

FromAngle

Construct Self from an angle.

Interpolate

A trait for linear interpolation between angles.

IntoAngle

Construct an angle by converting from another type.