pub struct Angle(f64);
Expand description
An angle, stored in radians.
Tuple Fields
0: f64
Implementations
sourceimpl Angle
impl Angle
pub const ZERO: Angle = Angle(0.0)
pub(crate) fn invert_y(self) -> Angle
sourcepub fn rotate_degs(self, degrees: f64) -> Angle
pub fn rotate_degs(self, degrees: f64) -> Angle
Rotates this angle by some degrees.
sourcepub fn normalized_radians(self) -> f64
pub fn normalized_radians(self) -> f64
Returns [0, 2pi)
sourcepub fn normalized_degrees(self) -> f64
pub fn normalized_degrees(self) -> f64
Returns [0, 360)
sourcepub fn simple_shortest_rotation_towards(self, other: Angle) -> f64
pub fn simple_shortest_rotation_towards(self, other: Angle) -> f64
Returns [-180, 180]
sourcepub fn shortest_rotation_towards(self, other: Angle) -> Angle
pub fn shortest_rotation_towards(self, other: Angle) -> Angle
Logically this returns [-180, 180], but keep in mind when we print this angle, it’ll normalize to be [0, 360].
sourcepub fn approx_eq(self, other: Angle, within_degrees: f64) -> bool
pub fn approx_eq(self, other: Angle, within_degrees: f64) -> bool
True if this angle is within some degrees of another, accounting for rotation
sourcepub fn approx_parallel(self, other: Angle, within_degrees: f64) -> bool
pub fn approx_parallel(self, other: Angle, within_degrees: f64) -> bool
True if this angle is within some degrees of another, accounting for rotation and allowing two angles that point in opposite directions
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Angle
impl<'de> Deserialize<'de> for Angle
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialOrd<Angle> for Angle
impl PartialOrd<Angle> for Angle
sourcefn partial_cmp(&self, other: &Angle) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
impl Copy for Angle
impl StructuralPartialEq for Angle
Auto Trait Implementations
impl RefUnwindSafe for Angle
impl Send for Angle
impl Sync for Angle
impl Unpin for Angle
impl UnwindSafe for Angle
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more