A Flash Developer Resource Site

Thread: calculate angles in right triangles - urgent

1. calculate angles in right triangles - urgent

I can't figure how to do this with AS.

lets say I have two sides of a right triangle, for this example the opposite side and the adjacent side (cause I want to use cosinus).

in ABC triangle, where angleA is the right angle, I want to calculate angleB, using cosinus.

the formula is:

cos angleB = AB / BC

therefor:

angleB = (AB / BC) / cos

lets say AB/BC = 0,4.
then, on a calculator its like 0,4 / cos-¹

but how do I do that in actionscript? passing the cosinus to the other side of the equation...

edit: I guess in other words, what Im looking for, is a method the inverse of the cosinus..

2. got it... acos

angle = Math.acos(0.4)

and then I convert it to radians

angle = angle / (Math.PI/180)

luckily there's a real programmer in my agency that could help me on this very basic trigonometry question. from now on I won't leave that poor guy alone

3. this formulae only gets to 180 and then returns, what if i need an object to rotate according to position, thus use the full 360?

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap

Click Here to Expand Forum to Full Width