pub struct Latitude(/* private fields */);Expand description
A geographic latitude value, constrained to −90 ≤ degrees ≤ 90.
Positive values are north of the equator; negative values are south.
§Construction
Use Latitude::new to construct from degrees, minutes, and seconds, or
TryFrom<inner::Float> if you already have a decimal-degree value.
§Examples
use lat_long::{Angle, Latitude};
let lat = Latitude::new(45, 30, 0.0).unwrap();
assert!(lat.is_northern());
let equator = Latitude::new(0, 0, 0.0).unwrap();
assert!(equator.is_on_equator());Implementations§
Source§impl Latitude
impl Latitude
Sourcepub fn is_on_equator(&self) -> bool
pub fn is_on_equator(&self) -> bool
Returns true if this latitude is exactly on the equator (0°).
Sourcepub fn is_northern(&self) -> bool
pub fn is_northern(&self) -> bool
Returns true if this latitude is in the northern hemisphere (> 0°).
Sourcepub fn is_southern(&self) -> bool
pub fn is_southern(&self) -> bool
Returns true if this latitude is in the southern hemisphere (< 0°).
Sourcepub fn is_arctic(&self) -> bool
pub fn is_arctic(&self) -> bool
Returns true if this latitude is within the Arctic region (≥ ARCTIC_CIRCLE, i.e. ≥ 66.5° N).
Sourcepub fn is_antarctic(&self) -> bool
pub fn is_antarctic(&self) -> bool
Returns true if this latitude is within the Antarctic region (≤ ANTARCTIC_CIRCLE, i.e. ≤ 66.5° S).
Sourcepub fn is_tropic_of_cancer(&self) -> bool
pub fn is_tropic_of_cancer(&self) -> bool
Returns true if this latitude is at or north of the TROPIC_OF_CANCER (≥ 23.5° N).
Together with is_tropic_of_capricorn this is used to
identify locations within the tropical band.
Sourcepub fn is_tropic_of_capricorn(&self) -> bool
pub fn is_tropic_of_capricorn(&self) -> bool
Returns true if this latitude is at or south of the TROPIC_OF_CAPRICORN (≤ 23.5° S).
Sourcepub fn is_tropical(&self) -> bool
pub fn is_tropical(&self) -> bool
Returns true if this latitude lies within the tropical band (between the
TROPIC_OF_CANCER and TROPIC_OF_CAPRICORN, i.e. within ±23.5°).
Note: this returns true for latitudes outside the tropical band that
are ≥ TROPIC_OF_CANCER in the north or ≤ TROPIC_OF_CAPRICORN in
the south — see individual methods for precise semantics.
Sourcepub fn is_polar(&self) -> bool
pub fn is_polar(&self) -> bool
Returns true if this latitude is within either polar region
(at or beyond ARCTIC_CIRCLE north or ANTARCTIC_CIRCLE south).
Trait Implementations§
Source§impl Angle for Latitude
impl Angle for Latitude
const MIN: Self
const MAX: Self
Source§fn new(degrees: i32, minutes: u32, seconds: f32) -> Result<Self, Error>
fn new(degrees: i32, minutes: u32, seconds: f32) -> Result<Self, Error>
fn as_float(&self) -> OrderedFloat<f64>
Source§fn is_nonzero_positive(&self) -> bool
fn is_nonzero_positive(&self) -> bool
true if the angle is positive and non-zero.Source§fn is_nonzero_negative(&self) -> bool
fn is_nonzero_negative(&self) -> bool
true if the angle is negative and non-zero.