alloy::math

Trait Angle

source
pub trait Angle:
    Copy
    + Trig
    + FromUnit
    + ToUnit
    + Mul<f32, Output = Self>
    + Div<f32, Output = Self> {
    // Provided methods
    fn to_angle<A: Angle>(self) -> A { ... }
    fn from_angle<A: Angle>(angle: A) -> Self { ... }
}
Expand description

A closed trait used to represent various angular units.

Types that implement this inherit all basic trigonometric functions and enable easy conversion between angular units.

Provided Methods§

source

fn to_angle<A: Angle>(self) -> A

Converts this Angle to any other generic Angle by converting to Unit as an intermediate value.

Note: This function will often be less-optimized than calling the specific to_radians, to_degrees, etc functions.

source

fn from_angle<A: Angle>(angle: A) -> Self

Constructs this angle from any other Angle unit value

Note: This function will often be less-optimized than calling the specific to_radians, to_degrees, etc functions.

§Parameters
  • angle - the angle to construct from

Object Safety§

This trait is not object safe.

Implementors§