Trait glamour::AngleConsts

source ·
pub trait AngleConsts {
    const PI: Self;
    const TAU: Self;
    const FRAG_1_PI: Self;
    const FRAG_2_PI: Self;
    const FRAG_PI_2: Self;
    const FRAG_PI_3: Self;
    const FRAG_PI_4: Self;
    const FRAG_PI_6: Self;
    const FRAG_PI_8: Self;
}
Expand description

Strongly typed angle constants.

These allow common constants used as angles to be strongly typed (so it’s possible to write Angle::<f32>::PI instead of Angle::radians(core::f32::PI)).

Note that this is also the most convenient way to get these constants in a const context. Since Angle is a generic type, the Angle::from_radians() constructor cannot be invoked in a const context. This is also why num_traits::FloatConst is not good enough.

Required Associated Constants§

source

const PI: Self

π

source

const TAU: Self

τ = 2π

source

const FRAG_1_PI: Self

1.0 / π

source

const FRAG_2_PI: Self

2.0 / π

source

const FRAG_PI_2: Self

π / 2.0

source

const FRAG_PI_3: Self

π / 3.0

source

const FRAG_PI_4: Self

π / 4.0

source

const FRAG_PI_6: Self

π / 6.0

source

const FRAG_PI_8: Self

π / 8.0

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AngleConsts for f32

source§

const PI: Self = 3.14159274f32

source§

const TAU: Self = 6.28318548f32

source§

const FRAG_1_PI: Self = 0.318309873f32

source§

const FRAG_2_PI: Self = 0.636619746f32

source§

const FRAG_PI_2: Self = 1.57079637f32

source§

const FRAG_PI_3: Self = 1.04719758f32

source§

const FRAG_PI_4: Self = 0.785398185f32

source§

const FRAG_PI_6: Self = 0.52359879f32

source§

const FRAG_PI_8: Self = 0.392699093f32

source§

impl AngleConsts for f64

source§

const PI: Self = 3.1415926535897931f64

source§

const TAU: Self = 6.2831853071795862f64

source§

const FRAG_1_PI: Self = 0.31830988618379069f64

source§

const FRAG_2_PI: Self = 0.63661977236758138f64

source§

const FRAG_PI_2: Self = 1.5707963267948966f64

source§

const FRAG_PI_3: Self = 1.0471975511965976f64

source§

const FRAG_PI_4: Self = 0.78539816339744828f64

source§

const FRAG_PI_6: Self = 0.52359877559829882f64

source§

const FRAG_PI_8: Self = 0.39269908169872414f64

Implementors§

source§

impl<T: AngleConsts> AngleConsts for Angle<T>

source§

const PI: Self = _

source§

const TAU: Self = _

source§

const FRAG_1_PI: Self = _

source§

const FRAG_2_PI: Self = _

source§

const FRAG_PI_2: Self = _

source§

const FRAG_PI_3: Self = _

source§

const FRAG_PI_4: Self = _

source§

const FRAG_PI_6: Self = _

source§

const FRAG_PI_8: Self = _