Solving triangle angles

Sidle up to the bar (Lightly Moderated)

Moderator: Dictators in Training

Post Reply
KaiineTN
NT Patron
NT Patron
Posts: 3629
Joined: Tue Mar 09, 2004 2:21 pm

Solving triangle angles

Post 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
User avatar
Phlegm
Nappy Headed Ho
Nappy Headed Ho
Posts: 6258
Joined: Tue Aug 03, 2004 5:50 pm

Post by Phlegm »

sin A = a/c
cos A = b/c
tan A = a/b

where:
A = angleA
a = sideA
b = sideB
c = sideC
Gaazy
NT Deity
NT Deity
Posts: 5837
Joined: Fri Mar 12, 2004 8:32 am
Location: West by god Virginia

Post by Gaazy »

a squared + b squared = c squared? i dunno. Whatever Phlegm said~
KaiineTN
NT Patron
NT Patron
Posts: 3629
Joined: Tue Mar 09, 2004 2:21 pm

Post 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.
Snero
NT Disciple
NT Disciple
Posts: 761
Joined: Mon Mar 08, 2004 1:53 am

Post by Snero »

most calculators have a function sin^-1, you would do 5/7 and use that function after. (the inverse function of sin)
AndyM
NT Bixie
NT Bixie
Posts: 4
Joined: Thu Dec 28, 2006 7:54 pm

Post 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
Snero
NT Disciple
NT Disciple
Posts: 761
Joined: Mon Mar 08, 2004 1:53 am

Post 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
KaiineTN
NT Patron
NT Patron
Posts: 3629
Joined: Tue Mar 09, 2004 2:21 pm

Post 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.
Image
Post Reply