Angle

Struct Angle 

Source
pub struct Angle<F: Float, U: Unit<F>>(/* private fields */);
Expand description

An angle backed by a floating-point number.

Implementations§

Source§

impl<F: Float, U: Unit<F>> Angle<F, U>

Source

pub const ZERO: Self

Zero angle, additive identity.

Source

pub const QUARTER_TURN: Self

Quarter turn around a circle. Equal to π/2 radians or 90°.

Source

pub const HALF_TURN: Self

Half turn around a circle. Equal to π radians or 180°.

Source

pub const FULL_TURN: Self

Full turn around a circle. Equal to 2π radians or 360°.

Source

pub const MIN: Self

Minimum finite angle.

Source

pub const MAX: Self

Maximum finite angle.

Source

pub fn new(val: F) -> Self

Create a new angle from a raw value.

§Panics

If the value is non-finite (debug mode).

Source

pub const unsafe fn unchecked(val: F) -> Self

§Safety

Ensure that the value is neither infinite nor NaN.

Source

pub const fn val(self) -> F

Gets the value of this angle.

Source

pub fn wrap(self) -> Wrap<F, U>

Source

pub fn mag(self) -> Self

Returns the magnitude (absolute value) of this angle.

Source§

impl<F: Float, U: Unit<F>> Angle<F, U>

Source

pub fn sin(self) -> F

Computes the sine of this angle.

Source

pub fn cos(self) -> F

Computes the cosine of this angle.

Source

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

Computes both the sine and cosine of this angle.

Source

pub fn tan(self) -> F

Computes the tangent of this angle.

Source

pub fn asin(y: F) -> Self

Computes the arc-sine of the specified value.

Source

pub fn acos(x: F) -> Self

Computes the arc-cosine of the specified value.

Source

pub fn atan(tan: F) -> Self

Computes the arc-tangent of the specified value.

Source

pub fn atan2(y: F, x: F) -> Self

Computes the four-quadrant arc-tangent of the specified fraction.

Source§

impl<F: Float> Angle<F, Radians>

Source

pub fn deg(self) -> Deg<F>

Converts this angle to degrees.

Source§

impl<F: Float> Angle<F, Degrees>

Source

pub fn rad(self) -> Rad<F>

Converts this angle to radians.

Trait Implementations§

Source§

impl<F: Float, U: Unit<F>, Rhs: Into<Angle<F, U>>> Add<Rhs> for Angle<F, U>

Source§

type Output = Angle<F, U>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Rhs) -> Self

Performs the + operation. Read more
Source§

impl<F: Float, U: Unit<F>, Rhs: Into<Angle<F, U>>> AddAssign<Rhs> for Angle<F, U>

Source§

fn add_assign(&mut self, rhs: Rhs)

Performs the += operation. Read more
Source§

impl<F: Float, U: Unit<F>> Clone for Angle<F, U>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<F: Float + Debug, U: Unit<F>> Debug for Angle<F, U>

Source§

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

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

impl<F: Float, U: Unit<F>> Default for Angle<F, U>

Source§

fn default() -> Self

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

impl<F: Float + Display, U: Unit<F>> Display for Angle<F, U>

Source§

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

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

impl<F: Float, U: Unit<F>> Div<F> for Angle<F, U>

Source§

type Output = Angle<F, U>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: F) -> Self

Performs the / operation. Read more
Source§

impl<F: Float, U: Unit<F>> Div for Angle<F, U>

Source§

type Output = F

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> F

Performs the / operation. Read more
Source§

impl<F: Float, U: Unit<F>> DivAssign<F> for Angle<F, U>

Source§

fn div_assign(&mut self, rhs: F)

Performs the /= operation. Read more
Source§

impl<F: Float, U: Unit<F>> From<Finite<F>> for Angle<F, U>

Source§

fn from(f: Finite<F>) -> Self

Converts to this type from the input type.
Source§

impl<F: Float, U: Unit<F>> From<Wrap<F, U>> for Angle<F, U>

Source§

fn from(val: Wrap<F, U>) -> Self

Converts to this type from the input type.
Source§

impl<F: Float, U: Unit<F>> Mul<F> for Angle<F, U>

Source§

type Output = Angle<F, U>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F) -> Self

Performs the * operation. Read more
Source§

impl<F: Float, U: Unit<F>> MulAssign<F> for Angle<F, U>

Source§

fn mul_assign(&mut self, rhs: F)

Performs the *= operation. Read more
Source§

impl<F: Float, U: Unit<F>> Neg for Angle<F, U>

Source§

type Output = Angle<F, U>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<F: Float, U: Unit<F>> Ord for Angle<F, U>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<F: Float, U: Unit<F>> PartialEq for Angle<F, U>

Source§

fn eq(&self, rhs: &Self) -> 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<F: Float, U: Unit<F>> PartialOrd for Angle<F, U>

Source§

fn partial_cmp(&self, other: &Self) -> 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<F: Float, U: Unit<F>, Rhs: Into<Angle<F, U>>> Sub<Rhs> for Angle<F, U>

Source§

type Output = Angle<F, U>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Rhs) -> Self

Performs the - operation. Read more
Source§

impl<F: Float, U: Unit<F>, Rhs: Into<Angle<F, U>>> SubAssign<Rhs> for Angle<F, U>

Source§

fn sub_assign(&mut self, rhs: Rhs)

Performs the -= operation. Read more
Source§

impl<F: Float, U: Unit<F>> Copy for Angle<F, U>

Source§

impl<F: Float, U: Unit<F>> Eq for Angle<F, U>

Auto Trait Implementations§

§

impl<F, U> Freeze for Angle<F, U>
where F: Freeze,

§

impl<F, U> RefUnwindSafe for Angle<F, U>

§

impl<F, U> Send for Angle<F, U>
where F: Send, U: Send,

§

impl<F, U> Sync for Angle<F, U>
where F: Sync, U: Sync,

§

impl<F, U> Unpin for Angle<F, U>
where F: Unpin, U: Unpin,

§

impl<F, U> UnwindSafe for Angle<F, U>
where F: UnwindSafe, U: 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> 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.