Struct geom::angle::Angle[][src]

pub struct Angle(f64);

An angle, stored in radians.

Implementations

impl Angle[src]

pub const ZERO: Angle[src]

pub fn new_rads(rads: f64) -> Angle[src]

Create an angle in radians.

pub fn degrees(degs: f64) -> Angle[src]

Create an angle in degrees.

pub fn opposite(self) -> Angle[src]

Invert the direction of this angle.

pub(crate) fn invert_y(self) -> Angle[src]

pub fn rotate_degs(self, degrees: f64) -> Angle[src]

Rotates this angle by some degrees.

pub fn normalized_radians(self) -> f64[src]

Returns [0, 2pi)

pub fn normalized_degrees(self) -> f64[src]

Returns [0, 360)

pub fn simple_shortest_rotation_towards(self, other: Angle) -> f64[src]

Returns [-180, 180]

pub fn shortest_rotation_towards(self, other: Angle) -> Angle[src]

Logically this returns [-180, 180], but keep in mind when we print this angle, it’ll normalize to be [0, 360].

pub fn approx_eq(self, other: Angle, within_degrees: f64) -> bool[src]

True if this angle is within some degrees of another, accounting for rotation

pub fn reorient(self) -> Angle[src]

I don’t know how to describe what this does. Use for rotating labels in map-space and making sure the text is never upside-down.

pub fn average(input: Vec<Angle>) -> Angle[src]

Calculates the average of some angles.

Trait Implementations

impl Add<Angle> for Angle[src]

type Output = Angle

The resulting type after applying the + operator.

impl Clone for Angle[src]

impl Copy for Angle[src]

impl Debug for Angle[src]

impl<'de> Deserialize<'de> for Angle[src]

impl Display for Angle[src]

impl Neg for Angle[src]

type Output = Angle

The resulting type after applying the - operator.

impl PartialEq<Angle> for Angle[src]

impl PartialOrd<Angle> for Angle[src]

impl Serialize for Angle[src]

impl StructuralPartialEq for Angle[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.