Struct GeodesicLine

Source
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

Source

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 automatically
    • caps |= LONGITUDE for the longitude lon2
    • caps |= AZIMUTH for the azimuth azi2; this is added automatically
    • caps |= DISTANCE for the distance s12
    • caps |= REDUCEDLENGTH for the reduced length m12
    • caps |= GEODESICSCALE for the geodesic scales M12 and M21
    • caps |= AREA for the area S12
    • caps |= 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 length
    • caps |= ALL for all of the above
  • salp1 - sine of initial azimuth
  • calp1 - cosine of initial azimuth
Source

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 lat2
    • outmask |= LONGITUDE for the longitude lon2
    • outmask |= AZIMUTH for the azimuth azi2
    • outmask |= DISTANCE for the distance s12
    • outmask |= REDUCEDLENGTH for the reduced length m12
    • outmask |= GEODESICSCALE for the geodesic scales M12 and M21
    • outmask |= ALL for all of the above
    • outmask |= 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);
Source

pub fn Position(&self, s12: f64, outmask: Option<u64>) -> HashMap<String, f64>

Trait Implementations§

Source§

impl Clone for GeodesicLine

Source§

fn clone(&self) -> GeodesicLine

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GeodesicLine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for GeodesicLine

Source§

fn eq(&self, other: &GeodesicLine) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for GeodesicLine

Source§

fn partial_cmp(&self, other: &GeodesicLine) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for GeodesicLine

Source§

impl StructuralPartialEq for GeodesicLine

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.