Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm writing a few functions for a JavaScript game engine. Is it possible to calculate the length of the legs of a right triangle given ONLY the length of the hypotenuse and an angle?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Well, yes, I believe so. Use the sin formula: $$c=\dfrac{b}{\sin B}=\dfrac{a}{\sin A}\\ \implies b=c\sin B,\quad a=c\sin A$$ Given $\angle A\text{ or }\angle B $ we can calculate the other angle (right triangle).

share|improve this answer
    
Gotta love the good ol' ASA. Thanks for the memory jog! –  Jesse Millar Apr 16 at 1:07
    
@JesseMillar Yes, well, I was teaching some basic trig. to my friends, and so this popped up to my mind immediately! –  SDevalapurkar Apr 16 at 1:08

Two words for you: sine and cosine

enter image description here

share|improve this answer
    
As nice as it would be if this worked, I don't believe it will in the programming sphere. For example, Math.sin(45) in JavaScript returns 0.8509035245341184. Unless there's some way to break that decimal into the opposite and adjacent values, it won't do me any good. –  Jesse Millar Apr 16 at 1:04
    
Hmm, then I think you should specify that in the question, because then you would get answers like these. –  Panda Bear Apr 16 at 1:06
    
Three words? sine, and, cosine! :-) –  SDevalapurkar Apr 16 at 1:08
1  
@PandaBear This was the first question I've ever asked on Stack. Thanks for the tip. :) –  Jesse Millar Apr 16 at 1:08
1  
@SanathDevalapurkar sine and cosine are in bold, mind you! ;-) –  Panda Bear Apr 16 at 1:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.