Page 1 of 1

Solving triangle angles

Posted: Tue Jan 16, 2007 7:49 pm
by KaiineTN
I completely forgot how to do this crap. Do any of you remember? I'm working on a program that needs to solve angles of a triangle. I'm messing around with the Math.Sin/Cos/Tan functions and they're always giving me numbers that are way off what they should be. I must be doing something wrong.

Basically, it's for a right triangle, so all I need is to solve for angleA.

In other words, say you have a right triangle with sides 5, 5, and 7 (7.07 to be more specific). Obviously, that's going to be 45 degrees, 45 degrees, and 90 degrees, but how would you find that out mathematically from using the lengths of the sides?

the part of the program in a nutshell:

have the variables: sideA, sideB, and sideC

angleA = <insert help here>
angleB = 180 - (90 + angleA)
angleC = 90

Posted: Tue Jan 16, 2007 8:04 pm
by Phlegm
sin A = a/c
cos A = b/c
tan A = a/b

where:
A = angleA
a = sideA
b = sideB
c = sideC

Posted: Tue Jan 16, 2007 8:21 pm
by Gaazy
a squared + b squared = c squared? i dunno. Whatever Phlegm said~

Posted: Tue Jan 16, 2007 10:38 pm
by KaiineTN
Phlegm wrote:sin A = a/c
cos A = b/c
tan A = a/b

where:
A = angleA
a = sideA
b = sideB
c = sideC


How does that help me know what angle A is? So I have Sin A = 5/7. I need to know the process/explanation so I know how to put it into programming.

Posted: Wed Jan 17, 2007 6:49 am
by Snero
most calculators have a function sin^-1, you would do 5/7 and use that function after. (the inverse function of sin)

Posted: Wed Jan 17, 2007 12:05 pm
by AndyM
Law of Cosines.

Given a triangle of three sides of known length ( a, b, c ), and three unknown opposite angles (alpha, beta, gamma) then:

gamma = arccos [( a^2 + b^2 - c^2)/(2*a*b)]

Andy

Posted: Wed Jan 17, 2007 12:17 pm
by Snero
thats overcomplicating things for a right triangle though, you can just use your basic trig functions

the way i was taught to remember was SOH CAH TOA, Sin=Opposite/Hypotenuse, Cos=Adjacent/Hypotenuse, and Tan=Opposite/Adjacent

those work just fine when you have a right triangle. If you don't, then you have to use the law of cosines or law of sines to find it

Posted: Wed Jan 17, 2007 12:22 pm
by KaiineTN
I think I figured out why it's not working properly. I think I need to convert to radians for programming, then have the answer converted back to degrees. I'll give it a shot later.