Struct geod_types::DecimalDegree [−][src]
pub struct DecimalDegree { /* fields omitted */ }
High-precision (10-7 degrees) and compact (32 bits) angular type.
The length of the Earth’s equator arc second is roughly 30m, so we need smaller units to represent smaller things.
The current precision (10-7 degrees) can represent things about 11 mm on the equator. https://en.wikipedia.org/wiki/Decimal_degrees#Precision
Implementations
impl DecimalDegree
[src]
impl DecimalDegree
[src]pub fn with_dms(
degree: u16,
minutes: u8,
seconds: u8,
milli_seconds: u16
) -> Result<Self, AngleNotInRange>
[src]
degree: u16,
minutes: u8,
seconds: u8,
milli_seconds: u16
) -> 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 const fn deg_fract(self) -> u32
[src]
The fractional part of the angle represented in the small units (10-7 degrees)
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 milli_arc_seconds(self) -> u16
[src]
The milli arc seconds (1/1000-th of the arc second) component of the angle.
Use with caution! The overflow of 0.999_999_9
degrees
intentionally handled incorrectly to keep the degrees
value valid.
To get the accurate value in such a boundary condition,
use deg_min_sec_mas
instead.
pub fn deg_min_sec_mas(self) -> (u16, u8, u8, u16)
[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 = DecimalDegree::try_from(35.9999999).unwrap(); assert_eq!(a.degrees(), 35); assert_eq!(a.arc_minutes(), 59); assert_eq!(a.arc_seconds(), 59); assert_eq!(a.milli_arc_seconds(), 999); // the value is closer to 36 than to 35 59'59.999" // and therefore rounds up assert_eq!(a.deg_min_sec_mas(), (36, 0, 0, 0));
pub fn almost_equal(self, rhs: Self) -> bool
[src]
As the decimal representation is 2.777 times more precise, a gap may appear when converting to the DMS representation
Trait Implementations
impl Add<DecimalDegree> for DecimalDegree
[src]
impl Add<DecimalDegree> for DecimalDegree
[src]impl Angle for DecimalDegree
[src]
impl Angle for DecimalDegree
[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 DecimalDegree
[src]
impl AngleNames for DecimalDegree
[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 DecimalDegree
[src]
impl CheckedAdd for DecimalDegree
[src]fn checked_add(&self, rhs: &Self) -> Option<Self>
[src]
impl CheckedSub for DecimalDegree
[src]
impl CheckedSub for DecimalDegree
[src]fn checked_sub(&self, rhs: &Self) -> Option<Self>
[src]
impl Clone for DecimalDegree
[src]
impl Clone for DecimalDegree
[src]fn clone(&self) -> DecimalDegree
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for DecimalDegree
[src]
impl Copy for DecimalDegree
[src]impl Default for DecimalDegree
[src]
impl Default for DecimalDegree
[src]fn default() -> DecimalDegree
[src]
impl Eq for DecimalDegree
[src]
impl Eq for DecimalDegree
[src]impl FromStr for DecimalDegree
[src]
impl FromStr for DecimalDegree
[src]impl Ord for DecimalDegree
[src]
impl Ord for DecimalDegree
[src]impl PartialEq<DecimalDegree> for DecimalDegree
[src]
impl PartialEq<DecimalDegree> for DecimalDegree
[src]fn eq(&self, other: &DecimalDegree) -> bool
[src]
fn ne(&self, other: &DecimalDegree) -> bool
[src]
impl PartialOrd<DecimalDegree> for DecimalDegree
[src]
impl PartialOrd<DecimalDegree> for DecimalDegree
[src]fn partial_cmp(&self, other: &DecimalDegree) -> 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 DecimalDegree
[src]
impl StructuralEq for DecimalDegree
[src]impl StructuralPartialEq for DecimalDegree
[src]
impl StructuralPartialEq for DecimalDegree
[src]impl Sub<DecimalDegree> for DecimalDegree
[src]
impl Sub<DecimalDegree> for DecimalDegree
[src]impl TryFrom<f64> for DecimalDegree
[src]
impl TryFrom<f64> for DecimalDegree
[src]Auto Trait Implementations
impl RefUnwindSafe for DecimalDegree
impl RefUnwindSafe for DecimalDegree
impl Send for DecimalDegree
impl Send for DecimalDegree
impl Sync for DecimalDegree
impl Sync for DecimalDegree
impl Unpin for DecimalDegree
impl Unpin for DecimalDegree
impl UnwindSafe for DecimalDegree
impl UnwindSafe for DecimalDegree