垂直于从给定的点的线

2023-09-07 12:24:00 作者:淑女路线我不走

我怎么能画上一个线段垂直从给定的点?我的线段被定义为(X1,Y1),(X2,Y2),如果我画一个垂直的从一个点(X3,Y3),并应当符合行点(X4,Y4)。我想找出这个(X4,Y4)。

How can I draw a perpendicular on a line segment from a given point? My line segment is defined as (x1, y1), (x2, y2), If I draw a perpendicular from a point (x3,y3) and it meets to line on point (x4,y4). I want to find out this (x4,y4).

Thankx。

推荐答案

我解决了这个方程你:

k = ((y2-y1) * (x3-x1) - (x2-x1) * (y3-y1)) / ((y2-y1)^2 + (x2-x1)^2)
x4 = x3 - k * (y2-y1)
y4 = y3 + k * (x2-x1)

在哪里^ 2均方

Where ^2 means squared

相关推荐
 
精彩推荐
图片推荐