Skip to content

Instantly share code, notes, and snippets.

@denysvitali
Created April 11, 2018 09:24
Show Gist options
  • Save denysvitali/191f3a116043cd650040d7bfad1b8cbf to your computer and use it in GitHub Desktop.
Save denysvitali/191f3a116043cd650040d7bfad1b8cbf to your computer and use it in GitHub Desktop.
fn deg2meter_lng(lng: f64) -> f64 { // X: E - W
111412.84 * lng.cos() - 93.5 * (3.0 * lng).cos() + 0.118 * (5.0 * lng).cos()
}
fn deg2meter_lat(lat: f64) -> f64 { // Y: N - S
111132.92 - 559.82 * (2.0 *lat).cos() + 1.175 * (4.0 *lat).cos() - 0.0023 * (6.0 *lat).cos()
}
// Orange
p1.lng = c2.lng + r2 * 1.0/deg2meter_lng(c2.lng);
p1.lat = c2.lat + r2 * 1.0/deg2meter_lat(c2.lat);
p2.lng = c1.lng - r1 * 1.0/deg2meter_lng(c1.lng);
p2.lat = c1.lat - r1 * 1.0/deg2meter_lat(c1.lat);
println!("C2");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment