Struct ring360::Ring360

source ·
pub struct Ring360(pub f64);
Expand description

Ring360 is a tuple struct encapsulating an f64

Tuple Fields§

§0: f64

Implementations§

source§

impl Ring360

Methods

source

pub const BASE: f64 = 360f64

The base is 360.0. All degree values will be modulated by this number

source

pub fn from_gis(lng180: f64) -> Ring360

Alternative constructor if the source degree uses the ±180º GIS system This will not affect the degree conversion, but only the initial rotations value, e.g. (-20).

source

pub fn degrees(&self) -> f64

Degrees as 64-bit floats on the 0º to 360º scale around a circle Use value() for the intrinsic value that may extend beyond this range

source

pub fn to_f64(&self) -> f64

Alias for for .degrees(), but is the default f64 conversion

source

pub fn to_gis(&self) -> f64

Convert the internal 0-360º scale back to the -180º to +180º GIS scale

source

pub fn rotations(&self) -> i64

Get the number of rotations. If the total is less than base of 360

source

pub fn progress(&self) -> f64

Get the intrinsic raw value as a decimal fraction of rotations e.g. 180.0 translates to 0.5 and 450.0 to 1.25

source

pub fn value(&self) -> f64

Returns the raw internal f64 value on a 0-360º scale. Values under 0 or over 360 represent negative or positive rotations

source

pub fn half_turn() -> f64

source

pub fn minus_half_turn() -> f64

source

pub fn as_tuple(&self) -> (f64, i64)

Return a simple tuple pair with the 360º degree value and the number of rotations (turns)

source

pub fn multiply(self, multiple: f64) -> Self

Multiply a Ring360 value by a normal f64 value

source

pub fn divide(self, divisor: f64) -> Self

Divide a Ring360 by a normal f64 value

source

pub fn angle_f64(&self, other_value: f64) -> f64

Calculate the shortest distance in degrees between a Ring360 value and a float64 representing a degree A positive value represents clockwise movement between the first and second longitude

source

pub fn angle_f64_abs(&self, other_value: f64) -> f64

Calculate the absolute angle with another 64-bit float in the 0 to 360º system only in a clockwise direction with the 180º to 359.999º representing half to a full turn

source

pub fn angle(&self, other_value: Ring360) -> f64

Calculate the shortest distance in degrees between two a Ring360 values

source

pub fn angle_abs(&self, other_value: Ring360) -> f64

Calculate the absolute angle with another Ring360 degree only in a clockwise direction with the 180º to 359.999º representing half to a full turn

source

pub fn to_radians(&self) -> f64

Convert to radians for use with cos(), sin(), tan(), atan() etc.

source

pub fn sin(&self) -> f64

Calculate sine in the 360º system without explicity converting to radians

source

pub fn cos(&self) -> f64

Calculate cosine in the 360º system without explicity converting to radians

source

pub fn tan(&self) -> f64

Calculate tangent in the 360º system without explicity converting to radians

source

pub fn asin(&self) -> f64

Calculate inverse cosine in the 360º system without explicity converting to and from radians

source

pub fn acos(&self) -> f64

Calculate inverse cosine in the 360º system without explicity converting to and from radians

source

pub fn atan(&self) -> f64

Calculate inverse tangent (arctan, aatan) in the 360º system without explicity converting to radians

Trait Implementations§

source§

impl Add for Ring360

Implement + (addition) operator with two Ring30 values

source§

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

Implement + for Ring360

§

type Output = Ring360

The resulting type after applying the + operator.
source§

impl Clone for Ring360

source§

fn clone(&self) -> Ring360

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 Ring360

source§

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

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

impl Display for Ring360

Implement default display for Ring360 as the degree value

source§

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

By default display the circular degree value

source§

impl Sub for Ring360

Implement - (subtraction) operator with two Ring30 values

source§

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

Implement - for Ring360

§

type Output = Ring360

The resulting type after applying the - operator.
source§

impl Copy for Ring360

Auto Trait Implementations§

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> 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.