Find x and y coordinates where a perpendicular point crosses a straight line [closed]

不打扰是莪最后的温柔 提交于 2019-12-25 01:25:33

问题


This is a follow-up question to this question.

Taking the following image as an example:

What I know:

  • x and y coordinates of points D, E, and P.
  • Therefore, I also know slope and intercept of D-E line

What I want to know:

  • x and y coordinates of point Q. (This is the point which crosses the D-E line).

回答1:


Notation P=[px,py], D=[dx,dy], E=[ex,ey], Q=[qx,qy]

First:

R=P-D=[px-dx, py-dy]=[rx,ry]

K=E-D=[ex-dx, ey-dy]=[kx, ky]

Then

z=dot(R,K)/dot(K,K)=(rx*kx+ry*ky) / (kx*kx+ky*ky)

Finally

Q=D+z*K=[dx+z*kx, dy+z*ky]

The R is vector which start on point D and ends on point K, the K is vector which start on point D and ends on point E. Using this we made scalar projection to calculate result Q. More info about concept here



来源:https://stackoverflow.com/questions/55217300/find-x-and-y-coordinates-where-a-perpendicular-point-crosses-a-straight-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!