Enum angular::Angle
[−]
[src]
pub enum Angle<T = f64> { Radians(T), Degrees(T), }
An angle.
Might be a value in degrees or in radians.
Variants
Radians(T)
Degrees(T)
Methods
impl<T: NumCast> Angle<T>
[src]
fn in_radians(self) -> T
Yield the value encoded in radians.
fn in_degrees(self) -> T
Yield the value encoded in degrees.
fn eighth() -> Angle<T>
An angle of 45°.
fn quarter() -> Angle<T>
An angle of 90° (right angle).
fn half() -> Angle<T>
An angle of 180° (straight).
fn full() -> Angle<T>
An angle of 360° (perigon).
impl<T: Copy + Num + NumCast + PartialOrd> Angle<T>
[src]
fn normalized(self) -> Self
Create a new angle by normalizing the value into the range of [0, 2π) rad.
impl<T: Float> Angle<T>
[src]
fn min_dist(self, other: Angle<T>) -> Angle<T>
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]
fn abs(self) -> Self
Compute the absolute angle.
impl<T: Float + NumCast> Angle<T>
[src]
fn sin(self) -> T
Compute the sine of the angle.
fn cos(self) -> T
Compute the cosine of the angle.
fn tan(self) -> T
Compute the tangent of the angle.
fn sin_cos(self) -> (T, T)
Simultaneously compute the sine and cosine of the number, x
.
Return (sin(x), cos(x))
.
Trait Implementations
impl<T: Copy> Copy for Angle<T>
[src]
impl<T: Clone> Clone for Angle<T>
[src]
fn clone(&self) -> Angle<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for Angle<T>
[src]
impl<T: Zero + Copy + NumCast> Zero for Angle<T>
[src]
fn zero() -> Self
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl<T: PartialEq + Copy + NumCast> PartialEq for Angle<T>
[src]
fn eq(&self, other: &Angle<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<T: Add + Copy + NumCast> Add for Angle<T>
[src]
type Output = Angle<T::Output>
The resulting type after applying the +
operator
fn add(self, rhs: Angle<T>) -> Self::Output
The method for the +
operator
impl<T: Sub + Copy + NumCast> Sub for Angle<T>
[src]
type Output = Angle<T::Output>
The resulting type after applying the -
operator
fn sub(self, rhs: Angle<T>) -> Self::Output
The method for the -
operator
impl<T: Mul> 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
The method for the *
operator
impl<T: Div> 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
The method for the /
operator
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
The method for the unary -
operator
impl<T: Display> Display for Angle<T>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more