Struct euclid::Angle

source ·
pub struct Angle<T> {
    pub radians: T,
}
Expand description

An angle in radians

Fields§

§radians: T

Implementations§

source§

impl<T> Angle<T>

source

pub fn radians(radians: T) -> Self

source

pub fn get(self) -> T

source§

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

source

pub fn degrees(deg: T) -> Self

source

pub fn to_degrees(self) -> T

source§

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

source

pub fn positive(&self) -> Self

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

source

pub fn signed(&self) -> Self

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

source§

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

source

pub fn angle_to(&self, to: Self) -> Self

Returns the shortest signed angle between two angles.

Takes wrapping and signs into account.

source

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

Linear interpolation between two angles, using the shortest path.

source§

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

source

pub fn is_finite(self) -> bool

Returns true if the angle is a finite number.

source§

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

source

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

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

source§

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

source

pub fn zero() -> Self

source§

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

source

pub fn pi() -> Self

source

pub fn two_pi() -> Self

source

pub fn frac_pi_2() -> Self

source

pub fn frac_pi_3() -> Self

source

pub fn frac_pi_4() -> Self

source§

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

source

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

Cast from one numeric representation to another.

source

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

Fallible cast from one numeric representation to another.

source

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

Cast angle to f32.

source

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

Cast angle f64.

Trait Implementations§

source§

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

§

type Output = Angle<T>

The resulting type after applying the + operator.
source§

fn add(self, other: &Self) -> Self

Performs the + operation. Read more
source§

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

§

type Output = Angle<T>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

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

source§

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

Performs the += operation. Read more
source§

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

source§

fn approx_epsilon() -> T

Default epsilon value
source§

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

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

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

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

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

source§

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
source§

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

source§

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

Formats the value using the given formatter. Read more
source§

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

source§

fn default() -> Angle<T>

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

impl<'de, T> Deserialize<'de> for Angle<T>where T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

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

§

type Output = Angle<T>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

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

§

type Output = T

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

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

source§

fn div_assign(&mut self, factor: T)

Performs the /= operation. Read more
source§

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

source§

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

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
source§

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

§

type Output = Angle<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

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

source§

fn mul_assign(&mut self, factor: T)

Performs the *= operation. Read more
source§

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

§

type Output = Angle<T>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

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

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

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

source§

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

This method 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

This method 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

This method 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

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

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

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

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

§

type Output = Angle<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

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

source§

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

Performs the -= operation. Read more
source§

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

source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

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

source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

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

source§

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

source§

impl<T> StructuralEq for Angle<T>

source§

impl<T> StructuralPartialEq for Angle<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,