Struct firefly_rust::graphics::Angle

source ·
pub struct Angle(/* private fields */);
Expand description

An angle between two vectors.

Used by draw_arc and draw_sector.

Implementations§

source§

impl Angle

source

pub const FULL_CIRCLE: Angle = _

The 360° angle.

source

pub const HALF_CIRCLE: Angle = _

The 180° angle.

source

pub const QUARTER_CIRCLE: Angle = _

The 90° angle.

source

pub const ZERO: Angle = _

The 0° angle.

source

pub fn from_degrees(d: f32) -> Self

An angle in degrees where 360.0 is the full circle.

source

pub fn from_radians(r: f32) -> Self

An angle in radians where TAU (doubled PI) is the full circle.

source

pub fn abs(self) -> Self

Convert the angle to an absolute (non-negative) value.

source

pub fn normalize(self) -> Self

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

source

pub fn to_degrees(self) -> f32

Get the angle value in degrees where 360.0 is the full circle..

source

pub fn to_radians(self) -> f32

Get the angle value in radians where TAU (doubled PI) is the full circle.

source

pub fn sin(&self) -> f32

Approximates sin(x) of the angle with a maximum error of 0.002.

source

pub fn cos(&self) -> f32

Approximates cos(x) of the angle with a maximum error of 0.002.

source

pub fn tan(&self) -> f32

Approximates tan(x) of the angle with a maximum error of 0.6.

Trait Implementations§

source§

impl Add for Angle

§

type Output = Angle

The resulting type after applying the + operator.
source§

fn add(self, other: Angle) -> Self

Performs the + operation. Read more
source§

impl AddAssign for Angle

source§

fn add_assign(&mut self, other: Angle)

Performs the += operation. Read more
source§

impl Clone for Angle

source§

fn clone(&self) -> Angle

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Angle

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Angle

source§

fn default() -> Angle

Returns the “default value” for a type. Read more
source§

impl Neg for Angle

§

type Output = Angle

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl PartialEq for Angle

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Angle

source§

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 · source§

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 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

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

fn ge(&self, other: &Rhs) -> bool

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

impl Sub for Angle

§

type Output = Angle

The resulting type after applying the - operator.
source§

fn sub(self, other: Angle) -> Self

Performs the - operation. Read more
source§

impl SubAssign for Angle

source§

fn sub_assign(&mut self, other: Angle)

Performs the -= operation. Read more
source§

impl Copy for Angle

source§

impl StructuralPartialEq for Angle

Auto Trait Implementations§

§

impl Freeze for Angle

§

impl RefUnwindSafe for Angle

§

impl Send for Angle

§

impl Sync for Angle

§

impl Unpin for Angle

§

impl UnwindSafe for Angle

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

source§

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

source§

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

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,