Struct embedded_graphics::geometry::Angle[][src]

pub struct Angle(_);
Expand description

Angle.

Angle is used to define the value of an angle.

Examples

Create an Angle from a value

use embedded_graphics::geometry::{Angle, AngleUnit};
use core::f32::consts::PI;

// Create an angle using the `from_degrees` constructor method
let angle_a = Angle::from_degrees(10.0);
let angle_b = Angle::from_radians(PI);

// Angles can also be created using the [AngleUnit](./trait.AngleUnit.html) trait
let angle_c = 30.0.deg();
let angle_d = PI.rad();

Implementations

impl Angle[src]

pub fn from_degrees(angle: f32) -> Self[src]

Creates an angle defined in degrees.

pub fn from_radians(angle: f32) -> Self[src]

Creates an angle defined in radians.

pub fn zero() -> Self[src]

Creates a zero degree angle.

pub fn abs(self) -> Self[src]

Compute the absolute value of the angle.

pub fn normalize(self) -> Self[src]

Normalize the angle to less than one full rotation (ie. in the range 0..360).

pub fn to_degrees(self) -> f32[src]

Return numerical value of the angle in degree

pub fn to_radians(self) -> f32[src]

Return numerical value of the angle in radian

Trait Implementations

impl Add<Angle> for Angle[src]

type Output = Angle

The resulting type after applying the + operator.

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

Performs the + operation. Read more

impl AddAssign<Angle> for Angle[src]

fn add_assign(&mut self, other: Angle)[src]

Performs the += operation. Read more

impl Clone for Angle[src]

fn clone(&self) -> Angle[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Angle[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Neg for Angle[src]

type Output = Angle

The resulting type after applying the - operator.

fn neg(self) -> Angle[src]

Performs the unary - operation. Read more

impl PartialEq<Angle> for Angle[src]

fn eq(&self, other: &Angle) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Angle) -> bool[src]

This method tests for !=.

impl PartialOrd<Angle> for Angle[src]

fn partial_cmp(&self, other: &Angle) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Sub<Angle> for Angle[src]

type Output = Angle

The resulting type after applying the - operator.

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

Performs the - operation. Read more

impl SubAssign<Angle> for Angle[src]

fn sub_assign(&mut self, other: Angle)[src]

Performs the -= operation. Read more

impl Copy 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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<Src, Dst> LosslessTryInto<Dst> for Src where
    Dst: LosslessTryFrom<Src>, 
[src]

pub fn lossless_try_into(self) -> Option<Dst>[src]

Performs the conversion.

impl<Src, Dst> LossyInto<Dst> for Src where
    Dst: LossyFrom<Src>, 
[src]

pub fn lossy_into(self) -> Dst[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Debug + Any
[src]

pub fn inlined_clone(&self) -> T[src]

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

fn is<T>() -> bool where
    T: Scalar
[src]

Tests if Self the same as the type T Read more

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

pub fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

pub fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).

pub fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

pub fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T, Right> ClosedAdd<Right> for T where
    T: Add<Right, Output = T> + AddAssign<Right>, 

impl<T> ClosedNeg for T where
    T: Neg<Output = T>, 

impl<T, Right> ClosedSub<Right> for T where
    T: Sub<Right, Output = T> + SubAssign<Right>,