Trait geographiclib_rs::DirectGeodesic
source · pub trait DirectGeodesic<T> {
// Required method
fn direct(&self, lat1: f64, lon1: f64, azi1: f64, s12: f64) -> T;
}
Expand description
Place a second point, given the first point, an azimuth, and a distance.
§Arguments
- lat1 - Latitude of 1st point [degrees] [-90.,90.]
- lon1 - Longitude of 1st point [degrees] [-180., 180.]
- azi1 - Azimuth at 1st point [degrees] [-180., 180.]
- s12 - Distance from 1st to 2nd point [meters] Value may be negative
§Returns
There are a variety of outputs associated with this calculation. We save computation by only calculating the outputs you need. See the following impls which return different subsets of the following outputs:
- lat2 latitude of point 2 (degrees).
- lon2 longitude of point 2 (degrees).
- azi2 (forward) azimuth at point 2 (degrees).
- m12 reduced length of geodesic (meters).
- M12 geodesic scale of point 2 relative to point 1 (dimensionless).
- M21 geodesic scale of point 1 relative to point 2 (dimensionless).
- S12 area under the geodesic (meters2).
- a12 arc length of between point 1 and point 2 (degrees).
If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+. An arc length greater that 180° signifies a geodesic which is not a shortest path. (For a prolate ellipsoid, an additional condition is necessary for a shortest path: the longitudinal extent must not exceed of 180°.)
// Example, determine the point 10000 km NE of JFK:
use geographiclib_rs::{Geodesic, DirectGeodesic};
let g = Geodesic::wgs84();
let (lat, lon, az) = g.direct(40.64, -73.78, 45.0, 10e6);
use approx::assert_relative_eq;
assert_relative_eq!(lat, 32.621100463725796);
assert_relative_eq!(lon, 49.052487092959836);
assert_relative_eq!(az, 140.4059858768007);