垂直于从给定的点的线段

垂直于从给定的点的线段

本文介绍了垂直于从给定的点的线段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要计算在给定的行是垂直从给定的点的点。

I want to calculate a point on a given line that is perpendicular from a given point.

我有一个线段AB,并有外线段中的C点。我想计算的AB点D,使得CD垂直于AB。

I have a line segment AB and have a point C outside line segment. I want to calculate a point D on AB such that CD is perpendicular to AB.

我得找点D.

这非常类似于this,但我要考虑到Z坐标也因为它没有正确地在三维空间中显示出来。

It quite similar to this, but I want to consider to Z coordinate also as it does not show up correctly in 3D space.

推荐答案

证明:点D是CD线垂直于AB在,当然D属于另外一个AB型。写下两个向量CD.AB = 0的点积和EX preSS的事实D属于另外一个AB为D = A + T(BA)。

Proof:Point D is on a line CD perpendicular to AB, and of course D belongs to AB.Write down the Dot product of the two vectors CD.AB = 0, and express the fact D belongs to AB as D=A+t(B-A).

我们结束了3公式:

 Dx=Ax+t(Bx-Ax)
 Dy=Ay+t(By-Ay)
(Dx-Cx)(Bx-Ax)+(Dy-Cy)(By-Ay)=0

Subtitute前两个方程中的第三个给出:

Subtitute the first two equations in the third one gives:

(Ax+t(Bx-Ax)-Cx)(Bx-Ax)+(Ay+t(By-Ay)-Cy)(By-Ay)=0

分发解决在t给出了:

Distributing to solve for t gives:

(Ax-Cx)(Bx-Ax)+t(Bx-Ax)(Bx-Ax)+(Ay-Cy)(By-Ay)+t(By-Ay)(By-Ay)=0

这给:

t= -[(Ax-Cx)(Bx-Ax)+(Ay-Cy)(By-Ay)]/[(Bx-Ax)^2+(By-Ay)^2]

摆脱了负号:

getting rid of the negative signs:

t=[(Cx-Ax)(Bx-Ax)+(Cy-Ay)(By-Ay)]/[(Bx-Ax)^2+(By-Ay)^2]

一旦你有了T,你可以从第一两个方程计算出的D中的坐标。

Once you have t, you can figure out the coordinates for D from the first two equations.

 Dx=Ax+t(Bx-Ax)
 Dy=Ay+t(By-Ay)

这篇关于垂直于从给定的点的线段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 06:38