• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

need some trig help

tynopik

Diamond Member
i have a right triangle that i know the position (x,y) of two points (including the point opposite the hypotenuse) and the length of all the sides but i need to find the the x,y of the third point

i can calculate all the angles, but this doesn't seem to help any

this seems simple but is driving me crazy

diagram for the confused:

(x2,y2)
o-----------------o(x3,y3)
|_|
|
|
|
|
o
(x1,y1)

given x1,y1 and x2,y2 and all the lengths, find x3,y3 (note the triangle may be rotated or flipped in an arbitrary manner)
 
>> Umm...add the length of the top side to x2 to get x3, and use the fact that y2=y3?

> (note the triangle may be rotated or flipped in an arbitrary manner)
 
Off the top of my head, here's one way to solve:

First, slide the triangle so the vertex opposite of the hypotenuse at the origin-- this will make the math a little easier.

Suppose the lengths of the triangle are as you drew them: a, b, and c.

Further suppose that the second vertex you know is now at (d,e). Hence, in this case d = x1 - x2, and e = y1 - y2.

Let's say the vertex you are trying to find (of the just slidden triange) is at (f,g).

Now since (f,g) is exactly b units away from the origin, it must satisfy the equation
f^2 + g^2 = b^2.

Furthermore, since (f,g) is also exactly c units away from (d,e), it must satisfy the equation
(f-d)^2 + (g-e)^2 = c^2.

We have two equations, with two unknowns. Solving for f in the first equation and substituting into the second equation, after much simplification we get the following single equation:

b^2 + d^2 + e^2 - c^2 = 2 sqrt(b^2 - g^2) + 2ge .

If we create a new variable Z, and let it be equal to ( b^2 + d^2 + e^2 - c^2 ) / 2, we can simply the above equation to

Z - ge = +/- sqrt(b^2 - g^2), or
Z^2 + g^2 * e^2 - 2Zge = b^2 - g^2, or
(e^2 + 1) g^2 + (-2Ze)g + (Z^2 - b^2) = 0.

This is a simple quadratic equation, which we can solve for g using the quadratic formula. After a little simplification, we get

g = ( Ze (+/-) sqrt(e^2 b^2 + b^2 - Z^2) ) / ( e^2 + 1)

Now that we know g, we can solve for f since f = b^2 - g^2.

To find (x3, y3) of the original triangle, we now can slide the triangle back to its original position by adding (x2, y2) to (f,g). Hence,

x3 = f + x2
y3 = g + y2
 
holy freaking cow, never would i have guessed it to be that complicated

wow, thanks man! you're a life saver!

now i'm off to implement and verify :-/
 
well stuff came up so i had to put this to the side, but just came back to it and found a couple problems:

> b^2 + d^2 + e^2 - c^2 = 2 sqrt(b^2 - g^2) + 2ge

this should be:
b^2 + d^2 + e^2 - c^2 = 2 d sqrt(b^2 - g^2) + 2ge

carrying through with no simplification i get:
g = (2Ze (+/-) sqrt(4 z^2 - 4(e^2 + d^2)(z^2 - d^2 b^2))) / 2(e^2 + d^2)

also:
> f = b^2 - g^2

should be:
f = (+/-)sqrt(b^2 - g^2)

but still far, far easier to fix the errors than come up with the concept myself, thanks again
 
Back
Top