Struct unit_sphere::Radians
source · pub struct Radians(pub f64);
Expand description
The Radians newtype an f64.
Tuple Fields§
§0: f64
Implementations§
source§impl Radians
impl Radians
sourcepub fn normalise(&self) -> Radians
pub fn normalise(&self) -> Radians
Normalise a Radians into the range:
-PI
< value <= PI
§Examples
use angle_sc::Radians;
assert_eq!(0.0, Radians(-core::f64::consts::TAU).normalise().0);
assert_eq!(core::f64::consts::PI, Radians(-core::f64::consts::PI).normalise().0);
assert_eq!(core::f64::consts::PI, Radians(core::f64::consts::PI).normalise().0);
assert_eq!(0.0, Radians(core::f64::consts::TAU).normalise().0);
Trait Implementations§
source§impl Add for Radians
impl Add for Radians
source§fn add(self, other: Radians) -> Radians
fn add(self, other: Radians) -> Radians
Add a pair of angles in Radians, wraps around +/-PI.
§Examples
use angle_sc::{Radians, is_within_tolerance};
let angle_120 = Radians(2.0 * core::f64::consts::FRAC_PI_3);
let result = angle_120 + angle_120;
assert!(is_within_tolerance(-2.0 * core::f64::consts::FRAC_PI_3, result.0, 4.0 * core::f64::EPSILON));
source§impl Neg for Radians
impl Neg for Radians
source§impl PartialEq for Radians
impl PartialEq for Radians
source§impl PartialOrd for Radians
impl PartialOrd for Radians
1.0.0 · source§fn 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 moresource§impl Sub for Radians
impl Sub for Radians
source§fn sub(self, other: Radians) -> Radians
fn sub(self, other: Radians) -> Radians
Subtract a pair of angles in Radians, wraps around +/-PI.
§Examples
use angle_sc::{Radians, is_within_tolerance};
let angle_120 = Radians(2.0 * core::f64::consts::FRAC_PI_3);
let angle_m120 = -angle_120;
let result = angle_m120 - angle_120;
assert!(is_within_tolerance(angle_120.0, result.0, 4.0 * core::f64::EPSILON));
impl Copy for Radians
impl StructuralPartialEq for Radians
Auto Trait Implementations§
impl RefUnwindSafe for Radians
impl Send for Radians
impl Sync for Radians
impl Unpin for Radians
impl UnwindSafe for Radians
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.