def neighbor_circle(location, pos, shift=False, factor=1.0):
pos = pos % 6
latrad = location[0] * pi / 180
x_un = factor * safety / earth_Rrect / cos(latrad) * 180 / pi
y_un = factor * safety / earth_Rrect * 180 / pi
if not shift:
y_un = y_un * (3.0 ** 0.5) / 2.0 * HEX_R
x_un = x_un * HEX_R * 1.5
yvals = [-2, -1, 1, 2, 1, -1]
xvals = [0, 1, 1, 0, -1, -1]
else:
y_un = y_un * HEX_R * 1.5
x_un = x_un * (3.0 ** 0.5) / 2.0 * HEX_R
yvals = [-1, 0, 1, 1, 0, -1]
xvals = [1, 2, 1, -1, -2, -1]
newlat = location[0] + y_un * yvals[pos]
newlng = ((location[1] + x_un * xvals[pos] + 180) % 360) - 180
return (newlat, newlng)
评论列表
文章目录