How to calculate coordinates of the intersection between the altitude and the base in a triangle.

577 Views Asked by At

Given a triangle with vertices $A, B \;\text{and}\; C.$ The coordinates of these points are known upfront. Suppose we construct an altitude through $C$ and perpendicular to the line $AB.$ We will call the intersection point $D.$
Is there a formula with which I can calculate the coordinates of this point $D?$

EDIT: I need to program this somehow, so it would be handy if the formula only involved coordinates if possible.

Thanks in advance.

2

There are 2 best solutions below

1
On BEST ANSWER

The slope of the altitude is opposite reciprocal of the slope of $AB$

You can find the equation of $CD$ using point slope formula and find the intersection of $AB$ and $CD$

0
On

formula only involved coordinates :

$xD=xC-ΔyAB·Delta/AB^2$

$yD=yC+ΔxAB·Delta/AB^2$

where:

$Delta=\left\Vert \begin{array}{} xA & yA & 1 \\ xB & yB & 1 \\ xC & yC & 1 \\ \end{array} \right\Vert $

$ΔxAB=xA-xB$

$ΔyAB=yA-yB$

$AB=\sqrt{(xA-xB)^2+(yA-yB)^2}$

formula deduced from (foot perpendicular):

$(h-p)/a=(k-q)/b=-(a·p+b·q+c)/(a^2+b^2)$