Struct radians::Angle

source ·
#[repr(transparent)]
pub struct Angle<F: Float, U: Unit<F>>(_, _);
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>

§

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 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<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<Angle<F, U>> for Angle<F, U>

§

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>> Div<F> for Angle<F, U>

§

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

§

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>

§

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) -> Selfwhere Self: Sized,

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

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

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

source§

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

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<F: Float, U: Unit<F>, Rhs: Into<Angle<F, U>>> Sub<Rhs> for Angle<F, U>

§

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> RefUnwindSafe for Angle<F, U>where F: RefUnwindSafe, U: RefUnwindSafe,

§

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 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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.