5.1.1. nvector.objects.delta_E¶
-
delta_E
(point_a, point_b)[source]¶ Returns cartesian delta vector from positions a to b decomposed in E.
- Parameters
- point_a, point_b: Nvector, GeoPoint or ECEFvector objects
position a and b, decomposed in E.
- Returns
- p_ab_E: ECEFvector
Cartesian position vector(s) from a to b, decomposed in E.
See also
n_EA_E_and_p_AB_E2n_EB_E
p_EB_E2n_EB_E
n_EB_E2p_EB_E.
Notes
The calculation is exact, taking the ellipsity of the Earth into account. It is also non-singular as both n-vector and p-vector are non-singular (except for the center of the Earth).
Examples
Example 1: “A and B to delta”
Given two positions, A and B as latitudes, longitudes and depths relative to Earth, E.
Find the exact vector between the two positions, given in meters north, east, and down, and find the direction (azimuth) to B, relative to north. Assume WGS-84 ellipsoid. The given depths are from the ellipsoid surface. Use position A to define north, east, and down directions. (Due to the curvature of Earth and different directions to the North Pole, the north, east, and down directions will change (relative to Earth) for different places. A must be outside the poles for the north and east directions to be defined.)
- Solution:
>>> import numpy as np >>> import nvector as nv >>> wgs84 = nv.FrameE(name='WGS84') >>> pointA = wgs84.GeoPoint(latitude=1, longitude=2, z=3, degrees=True) >>> pointB = wgs84.GeoPoint(latitude=4, longitude=5, z=6, degrees=True)
- Step1: Find p_AB_N (delta decomposed in N).
>>> p_AB_N = pointA.delta_to(pointB) >>> x, y, z = p_AB_N.pvector.ravel() >>> valtxt = '{0:8.2f}, {1:8.2f}, {2:8.2f}'.format(x, y, z) >>> 'Ex1: delta north, east, down = {}'.format(valtxt) 'Ex1: delta north, east, down = 331730.23, 332997.87, 17404.27'
- Step2: Also find the direction (azimuth) to B, relative to north:
>>> azimuth = p_AB_N.azimuth_deg >>> 'azimuth = {0:4.2f} deg'.format(azimuth) 'azimuth = 45.11 deg'