def getPointsBtwnVertices(v1, v2, dx):
"""
accepts:
v1: the position of one vertex
v2: the position of the other vertex
dx: stride length
returns:
points: ordered list of points between v1 and v2 at which to take a photo
"""
points = []
v1x, v2x = v1[0], v2[0]
v1y, v2y = v1[1], v2[1]
if np.isclose(v1x, v2x):
return getPointsonVerticalLine(v1x, v1y, v2y, dx)
if v2x-v1x<0: dx = -dx
xPoints = int((v2x - v1x) / dx)
dy = (v2y - v1y) / (v2x - v1x) * dx
x, y = v1x, v1y
for pointNo in range(xPoints):
points.append((x, y))
x += dx
y += dy
return points
navigationAlgoCode.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录