Distance between point and a line (from two points)
<p>I'm using Python+Numpy (can maybe also use Scipy) and have three 2D points (P1, P2, P3); I am trying to get the distance from P3 perpendicular to a line drawn between P1 and P2. Call P1 (x1,y1), P2 (x2,y2) and P3 (x3,y3)</p>

<p>In vector notation this would be pretty easy, but I'm fairly new to python/numpy and can't get anythng that works (or even close).</p>

<p>Any tips appreciated, thanks!</p>

<p>Try using the <em>norm</em> function from <code>numpy.linalg</code></p>

<pre><code>d = norm(np.cross(p2-p1, p1-p3))/norm(p2-p1)
</code></pre>

python numpy vector scipy point