Enum ang::Angle [] [src]

pub enum Angle<T = f64> {
    Radians(T),
    Degrees(T),
}

An angle.

Might be a value in degrees or in radians.

Variants

Methods

impl<T: NumCast> Angle<T>
[src]

Yield the value encoded in radians.

Yield the value encoded in degrees.

An angle of 45°.

An angle of 90° (right angle).

An angle of 180° (straight).

An angle of 360° (perigon).

impl<T: Copy + Num + NumCast + PartialOrd> Angle<T>
[src]

Create a new angle by normalizing the value into the range of [0, 2π) rad.

Examples

let alpha = Degrees(-90.0f64).normalized();
assert!((alpha.in_degrees() - 270.0).abs() < 1.0e-10);

let beta = Radians(2.0 * PI).normalized();
assert!((beta.in_radians() - 0.0).abs() < 1.0e-10);

impl<T: Float> Angle<T>
[src]

Computes the minimal unsigned distance between two normalized angles. Returns an angle in the range of [0, π] rad.

let distance = Degrees(345.0).min_dist(Degrees(15.0));
assert!((distance.in_degrees() - 30.0) < 1.0e-10);

impl<T: Signed> Angle<T>
[src]

Compute the absolute angle.

impl<T: Float + NumCast> Angle<T>
[src]

Compute the sine of the angle.

Compute the cosine of the angle.

Compute the tangent of the angle.

Simultaneously compute the sine and cosine of the number, x. Return (sin(x), cos(x)).

Trait Implementations

impl<T: Copy> Copy for Angle<T>
[src]

impl<T: Clone> Clone for Angle<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug> Debug for Angle<T>
[src]

Formats the value using the given formatter.

impl<T: Hash> Hash for Angle<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: Zero + Copy + NumCast> Zero for Angle<T>
[src]

Returns the additive identity element of Self, 0. Read more

Returns true if self is equal to the additive identity.

impl<T: PartialEq + Copy + NumCast> PartialEq for Angle<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Eq + Copy + NumCast> Eq for Angle<T>
[src]

impl<T: ApproxEq + Copy + NumCast> ApproxEq for Angle<T> where
    T::Epsilon: Copy
[src]

Used for specifying relative comparisons.

The default tolerance to use when testing values that are close together. Read more

The default relative tolerance for testing values that are far-apart. Read more

The default ULPs to tolerate when testing values that are far-apart. Read more

A test for equality that uses a relative comparison if the values are far apart.

A test for equality that uses units in the last place (ULP) if the values are far apart.

The inverse of ApproxEq::relative_eq.

The inverse of ApproxEq::ulps_eq.

impl<T: Add + Copy + NumCast> Add for Angle<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<T: AddAssign + Copy + NumCast> AddAssign for Angle<T>
[src]

The method for the += operator

impl<T: Sub + Copy + NumCast> Sub for Angle<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<T: SubAssign + Copy + NumCast> SubAssign for Angle<T>
[src]

The method for the -= operator

impl<T: Mul + Copy> Mul<T> for Angle<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<T: MulAssign> MulAssign<T> for Angle<T>
[src]

The method for the *= operator

impl<T: Div + Copy> Div<T> for Angle<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<T: DivAssign> DivAssign<T> for Angle<T>
[src]

The method for the /= operator

impl<T: Neg> Neg for Angle<T>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<T: PartialOrd + Copy + NumCast> PartialOrd<Angle<T>> for Angle<T>
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Ord + Eq + Copy + NumCast> Ord for Angle<T>
[src]

This method returns an Ordering between self and other. Read more

impl<T: Display> Display for Angle<T>
[src]

Formats the value using the given formatter. Read more

impl<T: Send> Send for Angle<T>
[src]