Type Alias Angle

pub type Angle = Angle<f32>;
Available on crate feature geometry only.
Expand description

An angle in radians (f32).

Aliased Type§

struct Angle {
    pub radians: f32,
}

Fields§

§radians: f32

Implementations

§

impl<T> Angle<T>

pub fn radians(radians: T) -> Angle<T>

pub fn get(self) -> T

§

impl<T> Angle<T>
where T: Rem<Output = T> + Sub<Output = T> + Add<Output = T> + Mul<Output = T> + One + FloatConst + Copy,

pub fn angle_to(&self, to: Angle<T>) -> Angle<T>

Returns the shortest signed angle between two angles.

Takes wrapping and signs into account.

pub fn lerp(&self, other: Angle<T>, t: T) -> Angle<T>

Linear interpolation between two angles, using the shortest path.

§

impl<T> Angle<T>
where T: Sub<Output = T> + Rem<Output = T> + Add<Output = T> + Zero + FloatConst + PartialOrd + Copy,

pub fn positive(&self) -> Angle<T>

Returns this angle in the [0..2*PI[ range.

pub fn signed(&self) -> Angle<T>

Returns this angle in the ]-PI..PI] range.

§

impl<T> Angle<T>
where T: NumCast + Copy,

pub fn cast<NewT>(&self) -> Angle<NewT>
where NewT: NumCast,

Cast from one numeric representation to another.

pub fn try_cast<NewT>(&self) -> Option<Angle<NewT>>
where NewT: NumCast,

Fallible cast from one numeric representation to another.

pub fn to_f32(&self) -> Angle<f32>

Cast angle to f32.

pub fn to_f64(&self) -> Angle<f64>

Cast angle f64.

§

impl<T> Angle<T>
where T: Float,

pub fn is_finite(self) -> bool

Returns true if the angle is a finite number.

§

impl<T> Angle<T>
where T: FloatConst + Add<Output = T>,

pub fn pi() -> Angle<T>

pub fn two_pi() -> Angle<T>

pub fn frac_pi_2() -> Angle<T>

pub fn frac_pi_3() -> Angle<T>

pub fn frac_pi_4() -> Angle<T>

§

impl<T> Angle<T>
where T: Zero,

pub fn zero() -> Angle<T>

§

impl<T> Angle<T>
where T: Real,

pub fn sin_cos(self) -> (T, T)

Returns (sin(self), cos(self)).

§

impl<T> Angle<T>
where T: Trig,

pub fn degrees(deg: T) -> Angle<T>

pub fn to_degrees(self) -> T

Trait Implementations

§

impl<T> Add<&Angle<T>> for Angle<T>
where T: Copy + Add<Output = T>,

§

type Output = Angle<T>

The resulting type after applying the + operator.
§

fn add(self, other: &Angle<T>) -> Angle<T>

Performs the + operation. Read more
§

impl<T> Add for Angle<T>
where T: Add<Output = T>,

§

type Output = Angle<T>

The resulting type after applying the + operator.
§

fn add(self, other: Angle<T>) -> Angle<T>

Performs the + operation. Read more
§

impl<T> AddAssign for Angle<T>
where T: AddAssign,

§

fn add_assign(&mut self, other: Angle<T>)

Performs the += operation. Read more
§

impl<T> ApproxEq<T> for Angle<T>
where T: ApproxEq<T>,

§

fn approx_epsilon() -> T

Default epsilon value
§

fn approx_eq_eps(&self, other: &Angle<T>, approx_epsilon: &T) -> bool

Returns true if this object is approximately equal to the other one, using a provided epsilon value.
§

fn approx_eq(&self, other: &Self) -> bool

Returns true if this object is approximately equal to the other one, using the approx_epsilon epsilon value.
§

impl<T> Clone for Angle<T>
where T: Clone,

§

fn clone(&self) -> Angle<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for Angle<T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Default for Angle<T>
where T: Default,

§

fn default() -> Angle<T>

Returns the “default value” for a type. Read more
§

impl<T> Div<T> for Angle<T>
where T: Div<Output = T>,

§

type Output = Angle<T>

The resulting type after applying the / operator.
§

fn div(self, factor: T) -> Angle<T>

Performs the / operation. Read more
§

impl<T> Div for Angle<T>
where T: Div<Output = T>,

§

type Output = T

The resulting type after applying the / operator.
§

fn div(self, other: Angle<T>) -> T

Performs the / operation. Read more
§

impl<T> DivAssign<T> for Angle<T>
where T: DivAssign,

§

fn div_assign(&mut self, factor: T)

Performs the /= operation. Read more
§

impl<T> Hash for Angle<T>
where T: Hash,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

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

impl<T> Mul<T> for Angle<T>
where T: Mul<Output = T>,

§

type Output = Angle<T>

The resulting type after applying the * operator.
§

fn mul(self, factor: T) -> Angle<T>

Performs the * operation. Read more
§

impl<T> MulAssign<T> for Angle<T>
where T: MulAssign,

§

fn mul_assign(&mut self, factor: T)

Performs the *= operation. Read more
§

impl<T> Neg for Angle<T>
where T: Neg<Output = T>,

§

type Output = Angle<T>

The resulting type after applying the - operator.
§

fn neg(self) -> Angle<T>

Performs the unary - operation. Read more
§

impl<T> PartialEq for Angle<T>
where T: PartialEq,

§

fn eq(&self, other: &Angle<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T> PartialOrd for Angle<T>
where T: PartialOrd,

§

fn partial_cmp(&self, other: &Angle<T>) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

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

impl<T> Sub for Angle<T>
where T: Sub<Output = T>,

§

type Output = Angle<T>

The resulting type after applying the - operator.
§

fn sub(self, other: Angle<T>) -> <Angle<T> as Sub>::Output

Performs the - operation. Read more
§

impl<T> SubAssign for Angle<T>
where T: SubAssign,

§

fn sub_assign(&mut self, other: Angle<T>)

Performs the -= operation. Read more
§

impl<'a, T> Sum<&'a Angle<T>> for Angle<T>
where T: 'a + Add + Copy + Zero,

§

fn sum<I>(iter: I) -> Angle<T>
where I: Iterator<Item = &'a Angle<T>>,

Takes an iterator and generates Self from the elements by “summing up” the items.
§

impl<T> Sum for Angle<T>
where T: Add + Zero,

§

fn sum<I>(iter: I) -> Angle<T>
where I: Iterator<Item = Angle<T>>,

Takes an iterator and generates Self from the elements by “summing up” the items.
§

impl<T> Copy for Angle<T>
where T: Copy,

§

impl<T> Eq for Angle<T>
where T: Eq,

§

impl<T> StructuralPartialEq for Angle<T>