<p>据我所知,这是你的问题:</p>
<ul>
<li>你有两个点,<code>start</code>和<code>next</code>你走在</li>
<li>你想找到第三个点的坐标,<code>New</code>,它应该是从<code>start</code>到<code>next</code>的距离和方位,因为你已经面对从<code>start</code>到<code>next</code>。</li>
</ul>
<p>我的解决方案是:</p>
<ul>
<li>创建从<code>start</code>到<code>next</code>的规范化向量</li>
<li>按给定方向旋转规范化向量</li>
<li>将标准化的旋转矢量乘以距离,然后将其添加到<code>start</code></li>
<li>把<code>start</code>当作向量,加法的结果就是新的点</li>
</ul>
<p>因为逆时针旋转(“左”从当前点)被认为是正的,所以需要反转<code>bearing</code>,使端口与负相关联,右舷与正相关联。</p>
<p><strong>代码</strong></p>
<pre><code>import math
origX = 95485
origY = 729380
nextX = 95241
nextY = 729215
distance = 2000.0
bearing = 45
origVec = origX, origY
nextVec = nextX, nextY
#Euclidean distance between vectors (L2 norm)
dist = math.sqrt((nextVec[0] - origVec[0])**2 + (nextVec[1] - origVec[1])**2)
#Get a normalized difference vector
diffVec = (nextVec[0] - origVec[0])/dist, (nextVec[1] - origVec[1])/dist
#rotate our vector by bearing to get a vector from orig towards new point
#also, multiply by distance to get new value
#invert bearing, because +45 in math is counter-clockwise (left), not starboard
angle = math.radians(-bearing)
newVec = origVec[0]+(diffVec[0]*math.cos(angle) - diffVec[1]*math.sin(angle))*distance, \
origVec[1]+(diffVec[0]*math.sin(angle) + diffVec[1]*math.cos(angle))*distance
print newVec
</code></pre>
<p><strong>输出:</strong></p>
<blockquote>
<p>(93521.29597031244, 729759.2973553676)</p>
</blockquote>