-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#![allow(unused)] | ||
|
||
pub mod jgd { | ||
pub struct Tokyo; | ||
impl Tokyo { | ||
pub fn new(degrees: LatLon) -> Self { | ||
todo!() | ||
} | ||
pub fn to_jgd2000(&self) -> Jgd2000 { | ||
todo!() | ||
} | ||
} | ||
|
||
pub struct Jgd2000; | ||
impl Jgd2000 { | ||
pub fn degrees(&self) -> LatLon { | ||
todo!() | ||
} | ||
} | ||
|
||
pub struct LatLon(pub f64, pub f64); | ||
impl LatLon { | ||
pub fn as_array(&self) -> [f64; 2] { | ||
todo!() | ||
} | ||
} | ||
impl From<[f64; 2]> for LatLon { | ||
fn from(value: [f64; 2]) -> Self { | ||
todo!() | ||
} | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
pub fn usage() { | ||
use jgd::{LatLon, Tokyo}; | ||
|
||
let LatLon(lat, lon) = Tokyo::new(LatLon(1., 2.)).to_jgd2000().degrees(); | ||
|
||
// もうちょっと | ||
let (x, y) = (2, 1); | ||
let yx = [y, x].map(|x| f64::from(x) * 3_600_000.); | ||
let yx = Tokyo::new(yx.into()) | ||
.to_jgd2000() | ||
.degrees() | ||
.as_array() | ||
.map(|x| (x / 3_600_000.).floor() as i32); | ||
} |