[−][src]Enum ang::Angle
An angle.
Might be a value in degrees or in radians.
Variants
The angle value in radians.
The angle value in degrees.
Implementations
impl<T: Copy + NumCast> Angle<T>[src]
pub fn in_radians(self) -> T[src]
Yield the value encoded in radians.
pub fn in_degrees(self) -> T[src]
Yield the value encoded in degrees.
pub fn eighth() -> Angle<T>[src]
An angle of 45°.
pub fn quarter() -> Angle<T>[src]
An angle of 90° (right angle).
pub fn half() -> Angle<T>[src]
An angle of 180° (straight).
pub fn full() -> Angle<T>[src]
An angle of 360° (perigon).
impl<T: Copy + Num + NumCast + PartialOrd> Angle<T>[src]
pub fn normalized(self) -> Self[src]
Create a new angle by normalizing the value into the range of [0, 2π) rad.
Examples
let alpha = Degrees(-90.0f64).normalized(); assert!((alpha.in_degrees() - 270.0).abs() < 1.0e-10); let beta = Radians(2.0 * PI).normalized(); assert!((beta.in_radians() - 0.0).abs() < 1.0e-10);
impl<T: Float> Angle<T>[src]
pub fn min_dist(self, other: Angle<T>) -> Angle<T>[src]
Computes the minimal unsigned distance between two normalized angles. Returns an angle in the range of [0, π] rad.
let distance = Degrees(345.0).min_dist(Degrees(15.0)); assert!((distance.in_degrees() - 30.0) < 1.0e-10);
impl<T: Signed> Angle<T>[src]
pub fn abs(&self) -> Self[src]
Compute the absolute angle.
pub fn signum(&self) -> Self[src]
Returns a number that represents the sign of self.
1.0if the number is positive,+0.0orFloat::infinity()-1.0if the number is negative,-0.0orFloat::neg_infinity()Float::nan()if the number isFloat::nan()
pub fn is_positive(&self) -> bool[src]
Returns true if the number is positive and false if the number is zero or negative
pub fn is_negative(&self) -> bool[src]
Returns true if the number is negative and false if the number is zero or positive.
impl<T: Float + NumCast> Angle<T>[src]
pub fn sin(self) -> T[src]
Compute the sine of the angle.
pub fn cos(self) -> T[src]
Compute the cosine of the angle.
pub fn tan(self) -> T[src]
Compute the tangent of the angle.
pub fn sin_cos(self) -> (T, T)[src]
Simultaneously compute the sine and cosine of the number, x.
Return (sin(x), cos(x)).
Trait Implementations
impl<T: AbsDiffEq + Copy + NumCast> AbsDiffEq<Angle<T>> for Angle<T>[src]
type Epsilon = T::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> Self::Epsilon[src]
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool[src]
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool[src]
impl<T: Add + Copy + NumCast> Add<Angle<T>> for Angle<T>[src]
type Output = Angle<T::Output>
The resulting type after applying the + operator.
fn add(self, rhs: Angle<T>) -> Self::Output[src]
impl<T: AddAssign + Copy + NumCast> AddAssign<Angle<T>> for Angle<T>[src]
fn add_assign(&mut self, rhs: Angle<T>)[src]
impl<T: Clone> Clone for Angle<T>[src]
impl<T: Copy> Copy for Angle<T>[src]
impl<T: Debug> Debug for Angle<T>[src]
impl<T: Display> Display for Angle<T>[src]
impl Div<Angle<f32>> for f32[src]
type Output = Angle<f32>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<f32>) -> Self::Output[src]
impl Div<Angle<f64>> for f64[src]
type Output = Angle<f64>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<f64>) -> Self::Output[src]
impl Div<Angle<i16>> for i16[src]
type Output = Angle<i16>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<i16>) -> Self::Output[src]
impl Div<Angle<i32>> for i32[src]
type Output = Angle<i32>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<i32>) -> Self::Output[src]
impl Div<Angle<i64>> for i64[src]
type Output = Angle<i64>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<i64>) -> Self::Output[src]
impl Div<Angle<i8>> for i8[src]
type Output = Angle<i8>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<i8>) -> Self::Output[src]
impl Div<Angle<isize>> for isize[src]
type Output = Angle<isize>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<isize>) -> Self::Output[src]
impl Div<Angle<u16>> for u16[src]
type Output = Angle<u16>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<u16>) -> Self::Output[src]
impl Div<Angle<u32>> for u32[src]
type Output = Angle<u32>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<u32>) -> Self::Output[src]
impl Div<Angle<u64>> for u64[src]
type Output = Angle<u64>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<u64>) -> Self::Output[src]
impl Div<Angle<u8>> for u8[src]
type Output = Angle<u8>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<u8>) -> Self::Output[src]
impl Div<Angle<usize>> for usize[src]
type Output = Angle<usize>
The resulting type after applying the / operator.
fn div(self, rhs: Angle<usize>) -> Self::Output[src]
impl<T: Div + Copy> Div<T> for Angle<T>[src]
type Output = Angle<T::Output>
The resulting type after applying the / operator.
fn div(self, rhs: T) -> Self::Output[src]
impl<T: DivAssign> DivAssign<T> for Angle<T>[src]
fn div_assign(&mut self, rhs: T)[src]
impl<T: Copy + Eq + NumCast> Eq for Angle<T>[src]
impl<T: Hash> Hash for Angle<T>[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Mul<Angle<f32>> for f32[src]
type Output = Angle<f32>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<f32>) -> Self::Output[src]
impl Mul<Angle<f64>> for f64[src]
type Output = Angle<f64>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<f64>) -> Self::Output[src]
impl Mul<Angle<i16>> for i16[src]
type Output = Angle<i16>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<i16>) -> Self::Output[src]
impl Mul<Angle<i32>> for i32[src]
type Output = Angle<i32>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<i32>) -> Self::Output[src]
impl Mul<Angle<i64>> for i64[src]
type Output = Angle<i64>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<i64>) -> Self::Output[src]
impl Mul<Angle<i8>> for i8[src]
type Output = Angle<i8>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<i8>) -> Self::Output[src]
impl Mul<Angle<isize>> for isize[src]
type Output = Angle<isize>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<isize>) -> Self::Output[src]
impl Mul<Angle<u16>> for u16[src]
type Output = Angle<u16>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<u16>) -> Self::Output[src]
impl Mul<Angle<u32>> for u32[src]
type Output = Angle<u32>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<u32>) -> Self::Output[src]
impl Mul<Angle<u64>> for u64[src]
type Output = Angle<u64>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<u64>) -> Self::Output[src]
impl Mul<Angle<u8>> for u8[src]
type Output = Angle<u8>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<u8>) -> Self::Output[src]
impl Mul<Angle<usize>> for usize[src]
type Output = Angle<usize>
The resulting type after applying the * operator.
fn mul(self, rhs: Angle<usize>) -> Self::Output[src]
impl<T: Mul + Copy> Mul<T> for Angle<T>[src]
type Output = Angle<T::Output>
The resulting type after applying the * operator.
fn mul(self, rhs: T) -> Self::Output[src]
impl<T: MulAssign> MulAssign<T> for Angle<T>[src]
fn mul_assign(&mut self, rhs: T)[src]
impl<T: Neg> Neg for Angle<T>[src]
type Output = Angle<T::Output>
The resulting type after applying the - operator.
fn neg(self) -> Self::Output[src]
impl<T: Ord + Eq + Copy + NumCast> Ord for Angle<T>[src]
fn cmp(&self, other: &Self) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl<T: Copy + NumCast + PartialEq> PartialEq<Angle<T>> for Angle<T>[src]
impl<T: PartialOrd + Copy + NumCast> PartialOrd<Angle<T>> for Angle<T>[src]
fn partial_cmp(&self, other: &Angle<T>) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<T: RelativeEq + Copy + NumCast> RelativeEq<Angle<T>> for Angle<T>[src]
fn default_max_relative() -> Self::Epsilon[src]
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<T: Send> Send for Angle<T>[src]
impl<T: Sub + Copy + NumCast> Sub<Angle<T>> for Angle<T>[src]
type Output = Angle<T::Output>
The resulting type after applying the - operator.
fn sub(self, rhs: Angle<T>) -> Self::Output[src]
impl<T: SubAssign + Copy + NumCast> SubAssign<Angle<T>> for Angle<T>[src]
fn sub_assign(&mut self, rhs: Angle<T>)[src]
impl<T: UlpsEq + Copy + NumCast> UlpsEq<Angle<T>> for Angle<T>[src]
fn default_max_ulps() -> u32[src]
fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool[src]
fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool[src]
impl<T: Zero + Copy + NumCast> Zero for Angle<T>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Angle<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Sync for Angle<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Angle<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Angle<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,