Struct Turns

Source
#[repr(transparent)]
pub struct Turns<T>(pub T);
Expand description

An angular quantity measured in “turns”, or full rotations.

Turns are uniquely defined from 0..1.

Tuple Fields§

§0: T

Trait Implementations§

Source§

impl<T: Float + AbsDiffEq> AbsDiffEq for Turns<T>
where T::Epsilon: Clone,

Source§

type Epsilon = <T as AbsDiffEq>::Epsilon

Used for specifying relative comparisons.
Source§

fn default_epsilon() -> Self::Epsilon

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

fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
Source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of ApproxEq::abs_diff_eq.
Source§

impl<U, T> Add<U> for Turns<T>
where T: Float + Add<T, Output = T>, U: IntoAngle<Turns<T>, OutputScalar = T>,

Source§

type Output = Turns<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: U) -> Turns<T>

Performs the + operation. Read more
Source§

impl<U, T> AddAssign<U> for Turns<T>
where T: Float + AddAssign<T>, U: IntoAngle<Turns<T>, OutputScalar = T>,

Source§

fn add_assign(&mut self, rhs: U)

Performs the += operation. Read more
Source§

impl<T: Float> Angle for Turns<T>

Source§

type Scalar = T

Internal type storing the angle value.
Source§

fn new(value: T) -> Turns<T>

Construct a new angle. Read more
Source§

fn period() -> T

The length of a full rotation.
Source§

fn scalar(&self) -> T

Return the scalar (unitless) value. Read more
Source§

fn set_scalar(&mut self, value: T)

Set the internal scalar value of the angle.
Source§

fn is_normalized(&self) -> bool

Whether the angle is in the standard domain.
Source§

fn normalize(self) -> Turns<T>

Normalize the angle, wrapping it back into the standard domain. Read more
Source§

fn sin(self) -> T

Compute the sine of an angle.
Source§

fn cos(self) -> T

Compute the cosine of an angle.
Source§

fn tan(self) -> T

Compute the tangent of an angle.
Source§

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

Simultaneously compute sine and cosine.
Source§

fn asin(value: T) -> Turns<T>

Compute the arcsine of a value, returning an angle.
Source§

fn acos(value: T) -> Turns<T>

Compute the arccosine of a value, returning an angle.
Source§

fn atan(value: T) -> Turns<T>

Compute the arctangent of a value, returning an angle.
Source§

fn atan2(y: T, x: T) -> Turns<T>

Compute the arctangent of a value, using information from the numerator and denominator in order to increase the domain.
Source§

fn full_turn() -> Self

Return one full rotation in some unit. Read more
Source§

fn half_turn() -> Self

Return one half of a full rotation in some unit.
Source§

fn quarter_turn() -> Self

Return one quarter of a full rotation in some unit.
Source§

fn invert(self) -> Self

Return the inverse of an angle. Read more
Source§

fn reflect_x(self) -> Self

Return the reflection of an angle over the x axis. Read more
Source§

impl<T: Clone> Clone for Turns<T>

Source§

fn clone(&self) -> Turns<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 Turns<T>

Source§

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

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

impl<T: Zero> Default for Turns<T>

Source§

fn default() -> Turns<T>

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

impl<T: Display> Display for Turns<T>

Source§

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

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

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

Source§

type Output = Turns<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Turns<T>

Performs the / operation. Read more
Source§

impl<T: DivAssign<T>> DivAssign<T> for Turns<T>

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T: Float> From<Deg<T>> for Turns<T>

Source§

fn from(from: Deg<T>) -> Turns<T>

Converts to this type from the input type.
Source§

impl<T: Float> From<Gon<T>> for Turns<T>

Source§

fn from(from: Gon<T>) -> Turns<T>

Converts to this type from the input type.
Source§

impl<T: Float> From<Rad<T>> for Turns<T>

Source§

fn from(from: Rad<T>) -> Turns<T>

Converts to this type from the input type.
Source§

impl<T: Float> From<Turns<T>> for Deg<T>

Source§

fn from(from: Turns<T>) -> Deg<T>

Converts to this type from the input type.
Source§

impl<T: Float> From<Turns<T>> for Gon<T>

Source§

fn from(from: Turns<T>) -> Gon<T>

Converts to this type from the input type.
Source§

impl<T: Float> From<Turns<T>> for Rad<T>

Source§

fn from(from: Turns<T>) -> Rad<T>

Converts to this type from the input type.
Source§

impl<T, U> FromAngle<U> for Turns<T>
where U: Angle<Scalar = T>, T: Float,

Source§

fn from_angle(from: U) -> Turns<T>

Construct Self by converting a T.
Source§

impl<T: Hash> Hash for Turns<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: Float> Interpolate for Turns<T>

Source§

fn interpolate<U>(&self, right: &U, pos: Self::Scalar) -> Self
where U: Clone + IntoAngle<Self, OutputScalar = Self::Scalar>,

Perform a linear interpolation between two angles. Read more
Source§

fn interpolate_forward<U>(&self, right: &U, pos: Self::Scalar) -> Self
where U: Clone + IntoAngle<Self, OutputScalar = Self::Scalar>,

Perform a linear interpolation between two angles, going forward from self to right. Read more
Source§

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

Source§

type Output = Turns<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Turns<T>

Performs the * operation. Read more
Source§

impl<T: MulAssign<T>> MulAssign<T> for Turns<T>

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

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

Source§

type Output = Turns<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Turns<T>

Performs the unary - operation. Read more
Source§

impl<T: PartialEq> PartialEq for Turns<T>

Source§

fn eq(&self, other: &Turns<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.
Source§

impl<T: PartialOrd> PartialOrd for Turns<T>

Source§

fn partial_cmp(&self, other: &Turns<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
Source§

impl<T: Float + RelativeEq> RelativeEq for Turns<T>
where T::Epsilon: Clone,

Source§

fn default_max_relative() -> Self::Epsilon

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

fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

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

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool

The inverse of ApproxEq::relative_eq.
Source§

impl<T: Rem<T, Output = T>> Rem for Turns<T>

Source§

type Output = Turns<T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Turns<T>) -> Turns<T>

Performs the % operation. Read more
Source§

impl<T: RemAssign> RemAssign for Turns<T>

Source§

fn rem_assign(&mut self, rhs: Turns<T>)

Performs the %= operation. Read more
Source§

impl<U, T> Sub<U> for Turns<T>
where T: Float + Sub<T, Output = T>, U: IntoAngle<Turns<T>, OutputScalar = T>,

Source§

type Output = Turns<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: U) -> Turns<T>

Performs the - operation. Read more
Source§

impl<U, T> SubAssign<U> for Turns<T>
where T: Float + SubAssign<T>, U: IntoAngle<Turns<T>, OutputScalar = T>,

Source§

fn sub_assign(&mut self, rhs: U)

Performs the -= operation. Read more
Source§

impl<T: Float + UlpsEq> UlpsEq for Turns<T>
where T::Epsilon: Clone,

Source§

fn default_max_ulps() -> u32

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

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

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

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of ApproxEq::ulps_eq.
Source§

impl<T: Float> Zero for Turns<T>

Source§

fn zero() -> Turns<T>

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

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<T: Copy> Copy for Turns<T>

Source§

impl<T> StructuralPartialEq for Turns<T>

Auto Trait Implementations§

§

impl<T> Freeze for Turns<T>
where T: Freeze,

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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, U> IntoAngle<U> for T
where U: Angle<Scalar = <T as Angle>::Scalar> + FromAngle<T>, T: Angle,

Source§

type OutputScalar = <T as Angle>::Scalar

Source§

fn into_angle(self) -> U

Construct an angle from self.
Source§

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

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,