我想知道如何获得2个GPS点之间的距离和方位.我研究了半胱氨酸配方.有人告诉我,我也可以使用相同的数据找到轴承.
一切都运转良好,但轴承还没有正常工作.轴承输出负值但应在0 - 360度之间.设定数据应该是水平方位,96.02166666666666
并且是:
Start point: 53.32055555555556 , -1.7297222222222221
Bearing: 96.02166666666666
Distance: 2 km
Destination point: 53.31861111111111, -1.6997222222222223
Final bearing: 96.04555555555555
Run Code Online (Sandbox Code Playgroud)
这是我的新代码:
from math import *
Aaltitude = 2000
Oppsite = 20000
lat1 = 53.32055555555556
lat2 = 53.31861111111111
lon1 = -1.7297222222222221
lon2 = -1.6997222222222223
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * …Run Code Online (Sandbox Code Playgroud) 我在单位球面上有几个点,它们根据https://www.cmu.edu/biolphys/deserno/pdf/sphere_equi.pdf 中描述的算法分布(并在下面的代码中实现)。在这些点中的每一个上,我都有一个值,在我的特定情况下,它表示 1 减去一个小错误。[0, 0.1]如果这很重要,则错误在,所以我的值在[0.9, 1].
可悲的是,计算错误是一个代价高昂的过程,我无法根据需要计算尽可能多的点。不过,我希望我的情节看起来像我在绘制“连续”的东西。所以我想为我的数据拟合一个插值函数,以便能够根据需要采样尽可能多的点。
经过一点研究,我发现scipy.interpolate.SmoothSphereBivariateSpline似乎完全符合我的要求。但我不能让它正常工作。
问题:我可以用什么来插值(样条、线性插值,目前什么都可以)我在单位球体上的数据?答案可以是“您误用了scipy.interpolation,这是执行此操作的正确方法”或“此其他功能更适合您的问题”。
应该可以执行numpy并scipy安装的示例代码:
import typing as ty
import numpy
import scipy.interpolate
def get_equidistant_points(N: int) -> ty.List[numpy.ndarray]:
"""Generate approximately n points evenly distributed accros the 3-d sphere.
This function tries to find approximately n points (might be a little less
or more) that are evenly distributed accros the 3-dimensional unit sphere.
The algorithm used is described in
https://www.cmu.edu/biolphys/deserno/pdf/sphere_equi.pdf.
""" …Run Code Online (Sandbox Code Playgroud)