Skip to content

Commit

Permalink
include example
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkirk committed Jan 16, 2024
1 parent 766915d commit 36c00d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: script/download-test-data.sh
- run: cargo build --all-targets
- run: cargo test
- run: cargo test --no-default-features
- run: cargo test --features test_full
Expand Down
16 changes: 16 additions & 0 deletions examples/direct.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use geographiclib_rs::{DirectGeodesic, Geodesic};
fn main() {
let g = Geodesic::wgs84();
let jfk_lat = 40.64;
let jfk_lon = -73.78;
let northeast_azimuth = 45.0;

let (lat, lon, az) = g.direct(jfk_lat, jfk_lon, northeast_azimuth, 10e6);

use approx::assert_relative_eq;
assert_relative_eq!(lat, 32.621100463725796);
assert_relative_eq!(lon, 49.05248709295982, epsilon = 1e-13);
assert_relative_eq!(az, 140.4059858768007);

println!("lat: {lat}, lon: {lon}, az: {az}");
}

0 comments on commit 36c00d9

Please sign in to comment.