Struct unit_sphere::Degrees
source · pub struct Degrees(pub f64);Expand description
The Degrees newtype an f64.
Tuple Fields§
§0: f64Implementations§
source§impl Degrees
impl Degrees
sourcepub fn normalise(&self) -> Degrees
pub fn normalise(&self) -> Degrees
Normalise a Degrees into the range: -180 < value <= 180
§Examples
use angle_sc::Degrees;
assert_eq!(0.0, Degrees(-360.0).normalise().0);
assert_eq!(180.0, Degrees(-180.0).normalise().0);
assert_eq!(180.0, Degrees(180.0).normalise().0);
assert_eq!(0.0, Degrees(360.0).normalise().0);Trait Implementations§
source§impl Add for Degrees
impl Add for Degrees
source§impl<'de> Deserialize<'de> for Degrees
impl<'de> Deserialize<'de> for Degrees
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Degrees, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Degrees, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<Degrees> for Angle
impl From<Degrees> for Angle
source§fn from(a: Degrees) -> Angle
fn from(a: Degrees) -> Angle
Construct an Angle from an angle in Degrees.
In order to minimize round-off errors, this function calculates sines
of angles with sine values <= 1 / sqrt(2): see
https://stackoverflow.com/questions/31502120/sin-and-cos-give-unexpected-results-for-well-known-angles
It is based on
GeographicLib::Math::sincosd function.
source§impl PartialEq for Degrees
impl PartialEq for Degrees
source§impl Serialize for Degrees
impl Serialize for Degrees
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl Sub for Degrees
impl Sub for Degrees
impl Copy for Degrees
impl StructuralPartialEq for Degrees
Auto Trait Implementations§
impl RefUnwindSafe for Degrees
impl Send for Degrees
impl Sync for Degrees
impl Unpin for Degrees
impl UnwindSafe for Degrees
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
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§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 moresource§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).source§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.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.