Expand description
An angle represented by its sine and cosine.
The cosine and sine of angle θ can be viewed as x and y coordinates with
θ measured anti-clockwise from the x axis.
They form a unit circle, see Figure 1.
![]()
Figure 1 Unit circle formed by sin θ and cos θ
The Angle on the opposite side of the unit circle is calculated by simply
negating the sin and cos of Angle.
Angle addition and subtraction are performed using
angle sum and difference identities.
Angle double uses the double-angle formulae
and half uses the
half-angle formulae.
The Angle < operator compares whether an Angle is clockwise of the other
Angle on the unit circle.
The sin and cos fields of Angle are UnitNegRanges:,
a newtype
with values in the range -1.0 to +1.0 inclusive.
The Degrees and Radians newtypes are used to convert to and from Angles.
The Validate trait is used to check that Angles and UnitNegRanges are valid.
The library is declared no_std so it can be used in embedded applications.
Modules§
- The
trigmodule contains theUnitNegRangenewtype struct and trigonometric functions which use it.
Structs§
- An angle represented by it’s sine and cosine as
UnitNegRanges. - The Degrees newtype an f64.
- The Radians newtype an f64.
Traits§
- The Validate trait.
Functions§
- Clamp a value to lie in the range min, max inclusive.
- Check whether value <= tolerance.
- Check whether a value is within tolerance of a reference value.
- Return the maximum of a or b.
- Return the minimum of a or b.