Extend positions with getters to retrieve lat/lon in radians

This commit is contained in:
Admar Schoonen 2022-02-18 20:09:34 +01:00
parent 5cd2b56176
commit fd0725be5c
1 changed files with 10 additions and 0 deletions

View File

@ -55,6 +55,16 @@ impl Position {
pub(crate) fn lon_as_str(&self, precision: usize) -> String {
format!("{:.*}", precision, self.lon)
}
/// Returns the latitude in radians
fn lat_as_rad(&self) -> f64 {
self.lat * PI / 180.0
}
/// Returns the longitude in radians
fn lon_as_rad(&self) -> f64 {
self.lon * PI / 180.0
}
}
impl From<&Point<f64>> for Position {