Altitudes of Triangle

174 Views Asked by At

I have a triangle defined as 3 lines, each defined by two coordinate points A and B. I have the area of the triangle but need to calculate the 3 altitudes and their respective sides A and B points. I understand how to calculate these altitudes length, but I do not see how that could help me. What formula would you reccomend I use to find the altitudes? Thanks.

1

There are 1 best solutions below

0
On

For the first line, let's call the points defining it $A_1$ and $B_1$. Similarly, the second line is defined by $A_2$ and $B_2$, etc. Each line is then parameterized as $$ L_i(t_i) = A_i + (B_i-A_i)t_i $$ for real numbers $t_{1,2,3}$. The intersection points are such that $L_1(t_1) = L_2(t_2)$ and so on. This produces three vector equations: $$ A_i-A_j + (B_i-A_i)t_i - (B_j-A_j)t_j = 0 $$ which you can solve by crossing against one of the coefficients of the $t$'s: $$ (B_i-A_i)\times [A_i-A_j + (B_i-A_i)t_i - (B_j-A_j)t_j] = \\(B_i-A_i)\times (A_i-A_j) - (B_i-A_i)\times (B_j-A_j)t_j = 0 $$ So for example, $$ t_j = \frac{(B_i-A_i)\times (A_i-A_j)}{(B_i-A_i)\times (B_j-A_j)} $$ where the cross product is taken in the scalar sense (3-dimensionally, keep just the $z$ component). So, if you do this to solve for all three $t_j$'s, you will have the vertices of the triangle by plugging them back into the equations of the lines, call them $V_{1,2,3}$.

With the vertices, all you have to do is find the points on the line defining the opposite side that is closest to the vertex. I'm going to reuse the symbols $t_{1,2,3}$ for the parameters of these closest points now. We want the displacement vector $d_{ij} = V_i - L_j(t_j)$ from vertex $i$ to line $j\ne i$ to be minimum, so you can work out $d_{ij}\cdot d_{ij}$ (dot it with itself), then set the derivative with respect to $t_j$ equal to zero to solve for it. Plugging back into the expression for $d_{ij}$ gives you the altitude vector whose length is easy to compute.