Mathematics.Angles (Package)


Angles, unlike most other numeric, are of an actual dimension. However even more so, they are unlike other dimensions in that they are constrained to a relatively small range. They also exhibit wrap-around (modular) behavior, but the exact range and modulus varies, and so this package exists to greatly simplify working with angles.



This is a sized type allowing a tradeoff between memory use and precision. The exact implementation details are allowed to vary, but must accurately convert between Degrees, Gradians, Radians, and Turns. This type is almost always what you actually want to use.


All other types are units of the angular dimension, and primarily exist as a means of specifying angles. Functions to construct angles, and functions to get the angle back in the specified unit, both exist. As well, math can be carried out purely in the unit, although this is not advised.


The actual implementation of these types, as with all dimensions and units, has to be a packed record of only a single value. The compiler should easily recognize these as single values and not produce bloated code. This is done to hide problematic intrinsic, since multiplication and division of two angles does not result in another angle. For this reason, exponentiation will never be defined.