Issue
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. Let P1=(x1,y1)
, P2=(x2,y2)
and P3=(x3,y3)
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).
Any tips appreciated, thanks!
Solution
Try using the norm function from numpy.linalg
d = norm(np.cross(p2-p1, p1-p3))/norm(p2-p1)
Answered By - DotPi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.