PDA

View Full Version : Quick geometry question AS3


tomrshl
12-07-2009, 09:07 PM
Using AS3: How do I find the opposite and adjacent sides of a triangle given the hypotenuse and one angle?

I tried this:

var hypotenuse:Number = 40;
var angle:Number = 8;
var opposite:Number = (hypotenuse*(Math.sin(angle)));
var adjacent:Number = (hypotenuse*(Math.cos(angle))); (these are just example values)

But I'm not sure if the numbers are correct, sometimes I get a negative number. To be honest, I haven't done maths for a while. I tried looking up the equations but I got confused. Could someone let me know if I'm doing it right?

Thanks

eu4ria
12-08-2009, 07:59 PM
Its been a while since I did high school maths, but if you have the hypotenuse and one angle, then the other angle should be:

180 (degrees in a triangle) - 90 (its a right angle triangle) - known_angle

I think you may be mixing up the calculations for lengths and angles.