Skip to main content

Angle

Struct Angle 

Source
pub struct Angle(/* private fields */);
Expand description

Angle in radians.

Implementations§

Source§

impl Angle

Source

pub const ZERO: Angle

An angle equal to zero.

Source

pub const PI: Angle

An angle equal to π.

Source

pub const TAU: Angle

An angle equal to τ = 2π.

Source

pub const FRAC_PI_2: Angle

An angle equal to π/2.

Source

pub const FRAC_PI_4: Angle

An angle equal to π/4.

Source

pub const fn new(rad: f64) -> Angle

Creates a new angle from an f64 value in radians.

Source

pub const fn radians(rad: f64) -> Angle

Creates a new angle from an f64 value in radians.

Source

pub const fn radians_normalized(rad: f64) -> Angle

Creates a new angle from an f64 value in radians and normalize the angle to the interval [0.0, 2π).

Source

pub const fn radians_normalized_signed(rad: f64) -> Angle

Creates a new angle from an f64 value in radians and normalize the angle to the interval (-2π, 2π).

Source

pub const fn degrees(deg: f64) -> Angle

Creates a new angle from an f64 value in degrees.

Source

pub const fn from_hms(hours: i64, minutes: u8, seconds: f64) -> Angle

Creates a new angle from hours, minutes, and seconds (HMS notation).

Source

pub const fn degrees_normalized(deg: f64) -> Angle

Creates a new angle from an f64 value in degrees and normalize the angle to the interval [0.0, 2π).

Source

pub const fn degrees_normalized_signed(deg: f64) -> Angle

Creates a new angle from an f64 value in degrees and normalize the angle to the interval (-2π, 2π).

Source

pub const fn arcseconds(asec: f64) -> Angle

Creates a new angle from an f64 value in arcseconds.

Source

pub const fn arcseconds_normalized(asec: f64) -> Angle

Creates a new angle from an f64 value in arcseconds and normalize the angle to the interval [0.0, 2π).

Source

pub const fn arcseconds_normalized_signed(asec: f64) -> Angle

Creates a new angle from an f64 value in arcseconds and normalize the angle to the interval (-2π, 2π).

Source

pub fn is_zero(&self) -> bool

Returns true if the angle is exactly zero.

Source

pub const fn abs(&self) -> Angle

Returns the absolute value of the angle.

Source

pub fn from_asin(value: f64) -> Angle

Creates an angle from the arcsine of a value.

Source

pub fn from_asinh(value: f64) -> Angle

Creates an angle from the inverse hyperbolic sine of a value.

Source

pub fn from_acos(value: f64) -> Angle

Creates an angle from the arccosine of a value.

Source

pub fn from_acosh(value: f64) -> Angle

Creates an angle from the inverse hyperbolic cosine of a value.

Source

pub fn from_atan(value: f64) -> Angle

Creates an angle from the arctangent of a value.

Source

pub fn from_atanh(value: f64) -> Angle

Creates an angle from the inverse hyperbolic tangent of a value.

Source

pub fn from_atan2(y: f64, x: f64) -> Angle

Creates an angle from the two-argument arctangent of y and x.

Source

pub fn cos(&self) -> f64

Returns the cosine of the angle.

Source

pub fn cosh(&self) -> f64

Returns the hyperbolic cosine of the angle.

Source

pub fn sin(&self) -> f64

Returns the sine of the angle.

Source

pub fn sinh(&self) -> f64

Returns the hyperbolic sine of the angle.

Source

pub fn sin_cos(&self) -> (f64, f64)

Returns sine and cosine of the angle.

Source

pub fn tan(&self) -> f64

Returns the tangent of the angle.

Source

pub fn tanh(&self) -> f64

Returns the hyperbolic tangent of the angle.

Source

pub const fn mod_two_pi(&self) -> Angle

Returns a new angle that is normalized to the interval [0.0, 2π).

Source

pub const fn mod_two_pi_signed(&self) -> Angle

Returns a new angle that is normalized to the interval (-2π, 2π).

Source

pub const fn normalize_two_pi(&self, center: Angle) -> Angle

Returns a new angle that is normalized to a (-π, π) interval centered around center.

Source

pub const fn as_f64(&self) -> f64

Returns the value of the angle in radians.

Source

pub const fn to_radians(&self) -> f64

Returns the value of the angle in radians.

Source

pub const fn to_degrees(&self) -> f64

Returns the value of the angle in degrees.

Source

pub const fn to_arcseconds(&self) -> f64

Returns the value of the angle in arcseconds.

Source

pub fn rotation_x(&self) -> DMat3

Returns the 3×3 rotation matrix for a rotation about the X axis.

Source

pub fn rotation_y(&self) -> DMat3

Returns the 3×3 rotation matrix for a rotation about the Y axis.

Source

pub fn rotation_z(&self) -> DMat3

Returns the 3×3 rotation matrix for a rotation about the Z axis.

Trait Implementations§

Source§

impl Add for Angle

Source§

type Output = Angle

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Angle) -> <Angle as Add>::Output

Performs the + operation. Read more
Source§

impl AddAssign for Angle

Source§

fn add_assign(&mut self, rhs: Angle)

Performs the += operation. Read more
Source§

impl ApproxEq for Angle

Source§

fn approx_eq(&self, rhs: &Angle, atol: f64, rtol: f64) -> ApproxEqResults

Compares self with rhs for approximate equality. Read more
Source§

impl Clone for Angle

Source§

fn clone(&self) -> Angle

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 Debug for Angle

Source§

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

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

impl Default for Angle

Source§

fn default() -> Angle

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

impl Display for Angle

Source§

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

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

impl Neg for Angle

Source§

type Output = Angle

The resulting type after applying the - operator.
Source§

fn neg(self) -> <Angle as Neg>::Output

Performs the unary - operation. Read more
Source§

impl PartialEq for Angle

Source§

fn eq(&self, other: &Angle) -> 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 PartialOrd for Angle

Source§

fn partial_cmp(&self, other: &Angle) -> 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 Sub for Angle

Source§

type Output = Angle

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign for Angle

Source§

fn sub_assign(&mut self, rhs: Angle)

Performs the -= operation. Read more
Source§

impl Copy for Angle

Source§

impl StructuralPartialEq for Angle

Auto Trait Implementations§

§

impl Freeze for Angle

§

impl RefUnwindSafe for Angle

§

impl Send for Angle

§

impl Sync for Angle

§

impl Unpin for Angle

§

impl UnsafeUnpin for Angle

§

impl UnwindSafe for Angle

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

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

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,