Struct geod::AccurateDegree [−][src]
The implementation can accurately store either decimal fractions of the degree (with the 10-6 degrees precision) or degree, minute, second (with the 10-2 arcsecond precision).
Implementations
impl AccurateDegree
[src]
pub fn with_dms(
degree: u16,
minutes: u8,
seconds: u8,
centi_seconds: u8
) -> Result<Self, AngleNotInRange>
[src]
degree: u16,
minutes: u8,
seconds: u8,
centi_seconds: u8
) -> Result<Self, AngleNotInRange>
Degree, minute, second, centisecond.
Errors
When some part of the angle is out of scope
(e.g. minutes > 60 or degree > 360), the AngleNotInRange
returned.
pub fn degrees(self) -> u16
[src]
The whole number of degrees in the angle
pub fn deg_fract(self) -> u32
[src]
The microdegrees (10-6 degrees) component of the angle
pub fn arc_minutes(self) -> u8
[src]
The arc minutes component of the angle.
pub fn arc_seconds(self) -> u8
[src]
The arc seconds component of the angle.
pub fn centi_arc_seconds(self) -> u8
[src]
The centi arc seconds (1/100-th of the arc second) component of the angle.
Use with caution! The overflow of 0.999_999
degrees
intentionally handled incorrectly to keep the degrees
value valid.
To get the accurate value in such a boundary condition,
use deg_min_sec_cas
instead.
pub fn deg_min_sec_cas(self) -> (u16, u8, u8, u8)
[src]
Parts of the angle as in the DMS scheme.
There is a corner case when the degree part returned is not the same as the result of degrees()
:
when the angle’s value is too close to a whole degree
in terms of internal representation, but still slightly less than it.
However, in terms of the DMS, it is already represented as a whole degree since the distance is too small to be represented in DMS scheme.
let a = AccurateDegree::try_from(35.999999).unwrap(); assert_eq!(a.degrees(), 35); assert_eq!(a.arc_minutes(), 59); assert_eq!(a.arc_seconds(), 59); assert_eq!(a.centi_arc_seconds(), 99); // the value is closer to 36 than to 35 59'59.99" // and therefore rounds up assert_eq!(a.deg_min_sec_cas(), (36, 0, 0, 0));
pub fn almost_equal(self, rhs: Self) -> bool
[src]
Since the DMS and decimal representation have different granularity, when comparing one with the other we should consider a gap of the half of larger granularity.
Trait Implementations
impl Add<AccurateDegree> for AccurateDegree
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self::Output
[src]
impl Angle for AccurateDegree
[src]
type NumErr = AngleNotInRange
The error that can appear when representing some part of the angle with a number
type ParseErr = ParseAngleError
The error that can appear while parsing the angle from a string
fn obtuse_err() -> Self::NumErr
[src]
fn reflex_err() -> Self::NumErr
[src]
fn turn_err() -> Self::NumErr
[src]
fn complement(self) -> Option<Self>
[src]
fn supplement(self) -> Option<Self>
[src]
fn explement(self) -> Self
[src]
fn abs_diff(self, rhs: Self) -> Self
[src]
fn turn_eq(self, other: Self) -> bool
[src]
fn and_not_obtuse(self) -> Result<Self, Self::NumErr>
[src]
fn and_not_reflex(self) -> Result<Self, Self::NumErr>
[src]
impl AngleNames for AccurateDegree
[src]
fn zero() -> Self
[src]
fn right() -> Self
[src]
fn straight() -> Self
[src]
fn complete() -> Self
[src]
fn is_zero(self) -> bool
[src]
fn is_acute(self) -> bool
[src]
fn is_right(self) -> bool
[src]
fn is_obtuse(self) -> bool
[src]
fn is_straight(self) -> bool
[src]
fn is_reflex(self) -> bool
[src]
fn is_complete(self) -> bool
[src]
impl CheckedAdd for AccurateDegree
[src]
fn checked_add(&self, rhs: &Self) -> Option<Self>
[src]
impl CheckedSub for AccurateDegree
[src]
fn checked_sub(&self, rhs: &Self) -> Option<Self>
[src]
impl Clone for AccurateDegree
[src]
fn clone(&self) -> AccurateDegree
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for AccurateDegree
[src]
impl Debug for AccurateDegree
[src]
impl Default for AccurateDegree
[src]
fn default() -> AccurateDegree
[src]
impl Display for AccurateDegree
[src]
impl Eq for AccurateDegree
[src]
impl FromStr for AccurateDegree
[src]
type Err = ParseAngleError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Into<f64> for AccurateDegree
[src]
impl Ord for AccurateDegree
[src]
fn cmp(&self, other: &AccurateDegree) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<AccurateDegree> for AccurateDegree
[src]
fn eq(&self, other: &AccurateDegree) -> bool
[src]
fn ne(&self, other: &AccurateDegree) -> bool
[src]
impl PartialOrd<AccurateDegree> for AccurateDegree
[src]
fn partial_cmp(&self, other: &AccurateDegree) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for AccurateDegree
[src]
impl StructuralPartialEq for AccurateDegree
[src]
impl Sub<AccurateDegree> for AccurateDegree
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self::Output
[src]
impl TryFrom<[u16; 2]> for AccurateDegree
[src]
type Error = AngleNotInRange
The type returned in the event of a conversion error.
fn try_from(value: [u16; 2]) -> Result<Self, Self::Error>
[src]
impl TryFrom<[u16; 3]> for AccurateDegree
[src]
type Error = AngleNotInRange
The type returned in the event of a conversion error.
fn try_from(value: [u16; 3]) -> Result<Self, Self::Error>
[src]
impl TryFrom<[u16; 4]> for AccurateDegree
[src]
type Error = AngleNotInRange
The type returned in the event of a conversion error.
fn try_from(value: [u16; 4]) -> Result<Self, Self::Error>
[src]
impl TryFrom<(u16, u8, u8, u16)> for AccurateDegree
[src]
type Error = AngleNotInRange
The type returned in the event of a conversion error.
fn try_from(value: (u16, u8, u8, u16)) -> Result<Self, Self::Error>
[src]
impl TryFrom<(u16, u8, u8)> for AccurateDegree
[src]
type Error = AngleNotInRange
The type returned in the event of a conversion error.
fn try_from(value: (u16, u8, u8)) -> Result<Self, Self::Error>
[src]
impl TryFrom<(u16, u8)> for AccurateDegree
[src]
type Error = AngleNotInRange
The type returned in the event of a conversion error.
fn try_from(value: (u16, u8)) -> Result<Self, Self::Error>
[src]
impl TryFrom<f64> for AccurateDegree
[src]
type Error = AngleNotInRange
The type returned in the event of a conversion error.
fn try_from(value: f64) -> Result<Self, Self::Error>
[src]
Use with caution: the floating numbers has bad precision in the fraction part
impl TryFrom<u16> for AccurateDegree
[src]
Auto Trait Implementations
impl RefUnwindSafe for AccurateDegree
impl Send for AccurateDegree
impl Sync for AccurateDegree
impl Unpin for AccurateDegree
impl UnwindSafe for AccurateDegree
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,