Distance between point and a line (from two points)

后端 未结 8 2345
梦谈多话
梦谈多话 2020-11-28 07:30

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 perpend

8条回答
  •  执笔经年
    2020-11-28 07:56

    Try using the norm function from numpy.linalg

    d = norm(np.cross(p2-p1, p1-p3))/norm(p2-p1)
    

提交回复
热议问题