pub struct GeodesicLine { /* private fields */ }
Expand description
A geodesic line.
Facilitates the determination of a series of points on a single geodesic.
Implementations§
Source§impl GeodesicLine
impl GeodesicLine
Sourcepub fn new(
geod: &Geodesic,
lat1: f64,
lon1: f64,
azi1: f64,
caps: Option<u64>,
salp1: Option<f64>,
calp1: Option<f64>,
) -> Self
pub fn new( geod: &Geodesic, lat1: f64, lon1: f64, azi1: f64, caps: Option<u64>, salp1: Option<f64>, calp1: Option<f64>, ) -> Self
Create a new geodesic line from an initial point and azimuth.
§Arguments
- geod - geodesic parameters
- lat1 - initial latitude (degrees)
- lon1 - initial longitude (degrees)
- azi1 - initial azimuth (degrees)
- caps - bitor’ed combination of capabilities; defaults to
STANDARD | DISTANCE_IN
caps |= LATITUDE
for the latitude lat2; this is added automaticallycaps |= LONGITUDE
for the longitude lon2caps |= AZIMUTH
for the azimuth azi2; this is added automaticallycaps |= DISTANCE
for the distance s12caps |= REDUCEDLENGTH
for the reduced length m12caps |= GEODESICSCALE
for the geodesic scales M12 and M21caps |= AREA
for the area S12caps |= DISTANCE_IN
permits the length of the geodesic to be given in terms of s12; without this capability the length can only be specified in terms of arc lengthcaps |= ALL
for all of the above
- salp1 - sine of initial azimuth
- calp1 - cosine of initial azimuth
Sourcepub fn _gen_position(
&self,
arcmode: bool,
s12_a12: f64,
outmask: u64,
) -> (f64, f64, f64, f64, f64, f64, f64, f64, f64)
pub fn _gen_position( &self, arcmode: bool, s12_a12: f64, outmask: u64, ) -> (f64, f64, f64, f64, f64, f64, f64, f64, f64)
Place a point at a given distance along this line.
§Arguments
- arcmode - Indicates if s12_a12 is an arc length (true) or distance (false)
- s12_a12 - Distance to point (meters) or arc length (degrees); can be negative
- outmask - bitor’ed combination of capabilities defining which values to return
outmask |= LATITUDE
for the latitude lat2outmask |= LONGITUDE
for the longitude lon2outmask |= AZIMUTH
for the azimuth azi2outmask |= DISTANCE
for the distance s12outmask |= REDUCEDLENGTH
for the reduced length m12outmask |= GEODESICSCALE
for the geodesic scales M12 and M21outmask |= ALL
for all of the aboveoutmask |= LONG_UNROLL
to unroll lon2 (instead of reducing it to the range [−180°, 180°])
§Returns
Values are f64::NAN if not supported by the specified capabilities.
- a12 arc length between point 1 and point 2 (degrees)
- lat2 latitude of point 2 (degrees)
- lon2 longitude of point 2 (degrees)
- azi2 (forward) azimuth at point 2 (degrees)
- s12 distance between point 1 and point 2 (meters)
- 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)
§Example
use geographiclib_rs::{Geodesic, GeodesicLine, geodesic_capability as caps};
let g = Geodesic::wgs84();
let outmask = caps::LATITUDE | caps::LONGITUDE | caps::AZIMUTH | caps::DISTANCE_IN;
let line = GeodesicLine::new(&g, -11.95887, -116.94513, 92.712619830452549, Some(outmask), None, None);
let (_, lat2, lon2, azi2, _, _, _, _, _) = line._gen_position(false, 13834722.5801401374, outmask);
use approx::assert_relative_eq;
assert_relative_eq!(lat2, 4.57352, epsilon=1e-13);
assert_relative_eq!(lon2, 7.16501, epsilon=1e-13);
assert_relative_eq!(azi2, 78.64960934409585, epsilon=1e-13);
pub fn Position(&self, s12: f64, outmask: Option<u64>) -> HashMap<String, f64>
Trait Implementations§
Source§impl Clone for GeodesicLine
impl Clone for GeodesicLine
Source§fn clone(&self) -> GeodesicLine
fn clone(&self) -> GeodesicLine
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for GeodesicLine
impl Debug for GeodesicLine
Source§impl PartialEq for GeodesicLine
impl PartialEq for GeodesicLine
Source§impl PartialOrd for GeodesicLine
impl PartialOrd for GeodesicLine
impl Copy for GeodesicLine
impl StructuralPartialEq for GeodesicLine
Auto Trait Implementations§
impl Freeze for GeodesicLine
impl RefUnwindSafe for GeodesicLine
impl Send for GeodesicLine
impl Sync for GeodesicLine
impl Unpin for GeodesicLine
impl UnwindSafe for GeodesicLine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more