pub struct Angle(/* private fields */);Expand description
Angular position.
Implementations§
Source§impl Angle
impl Angle
Sourcepub const QUARTER_TURN: Self
pub const QUARTER_TURN: Self
Angle representing a quarter turn around a full circle.
Sourcepub const MIN: Self
pub const MIN: Self
Smallest value that can be represented by the Angle type.
Equivalent to f64::MIN radians.
Sourcepub const MAX: Self
pub const MAX: Self
Largest value that can be represented by the Angle type.
Equivalent to f64::MAX radians.
Sourcepub const EPSILON: Self
pub const EPSILON: Self
Machine epsilon value for Angle.
Sourcepub const fn from_radians(radians: f64) -> Self
pub const fn from_radians(radians: f64) -> Self
Creates a new Angle from a value in radians.
Sourcepub const fn from_gradians(gradians: f64) -> Self
pub const fn from_gradians(gradians: f64) -> Self
Creates a new Angle from a value in gradians.
Sourcepub const fn from_degrees(degrees: f64) -> Self
pub const fn from_degrees(degrees: f64) -> Self
Creates a new Angle from a value in degrees.
Sourcepub const fn from_turns(turns: f64) -> Self
pub const fn from_turns(turns: f64) -> Self
Creates a new Angle from a value in turns (revolutions).
Sourcepub fn asin(y: f64) -> Self
pub fn asin(y: f64) -> Self
Computes the arcsine of a number. Return value is in the range [-pi/2, pi/2] or NaN if the angle is outside the range [-1, 1].
Sourcepub fn acos(x: f64) -> Self
pub fn acos(x: f64) -> Self
Computes the arccosine of a number. Return value is in the range [0, pi] or NaN if the number is outside the range [-1, 1].
Sourcepub fn atan(tan: f64) -> Self
pub fn atan(tan: f64) -> Self
Computes the arctangent of an angle. Return value is in radians in the range [-pi/2, pi/2];
Sourcepub const fn as_degrees(&self) -> f64
pub const fn as_degrees(&self) -> f64
Returns this angle’s value in degrees.
Sourcepub const fn as_radians(&self) -> f64
pub const fn as_radians(&self) -> f64
Returns this angle’s value in radians.
Sourcepub const fn as_gradians(&self) -> f64
pub const fn as_gradians(&self) -> f64
Returns this angle’s value in gradians.
Sourcepub fn wrapped_positive(&self) -> Self
pub fn wrapped_positive(&self) -> Self
Normalizes an angle to the bounds [0, 2pi].
Sourcepub const fn signum(self) -> f64
pub const fn signum(self) -> f64
Returns a number that represents the sign of self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITY- NaN if the number is NaN
Sourcepub const fn copysign(self, sign: Self) -> Self
pub const fn copysign(self, sign: Self) -> Self
Returns an angle composed of the magnitude of self and the sign of
sign.
Equal to self if the sign of self and sign are the same, otherwise equal to -self.
If self is a NaN, then a NaN with the same payload as self and the sign bit of sign is
returned.
If sign is a NaN, then this operation will still carry over its sign into the result. Note
that IEEE 754 doesn’t assign any meaning to the sign bit in case of a NaN, and as Rust
doesn’t guarantee that the bit pattern of NaNs are conserved over arithmetic operations, the
result of copysign with sign being a NaN might produce an unexpected or non-portable
result. See the specification of NaN bit patterns for more
info.
Sourcepub fn mul_add(self, a: Self, b: Self) -> Self
pub fn mul_add(self, a: Self, b: Self) -> Self
Fused multiply-add. Computes (self * a) + b with only one rounding
error, yielding a more accurate result than an unfused multiply-add.
Using mul_add may be more performant than an unfused multiply-add if
the target architecture has a dedicated fma CPU instruction. However,
this is not always true, and will be heavily dependant on designing
algorithms with specific target hardware in mind.
Sourcepub fn div_euclid(self, rhs: Self) -> Self
pub fn div_euclid(self, rhs: Self) -> Self
Calculates Euclidean division.
Trait Implementations§
Source§impl AddAssign for Angle
impl AddAssign for Angle
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreSource§impl DivAssign<f64> for Angle
impl DivAssign<f64> for Angle
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
/= operation. Read moreSource§impl MulAssign<f64> for Angle
impl MulAssign<f64> for Angle
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
*= operation. Read moreSource§impl SubAssign for Angle
impl SubAssign for Angle
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more