dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: calculate angles in right triangles - urgent

  1. #1
    Junior Member
    Join Date
    May 2003
    Location
    lisboa, portugal
    Posts
    18

    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..
    Last edited by steph2; 03-16-2005 at 06:40 AM.

  2. #2
    Junior Member
    Join Date
    May 2003
    Location
    lisboa, portugal
    Posts
    18
    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. #3
    Senior Member
    Join Date
    May 2005
    Posts
    324
    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?
    "great scott!"

    "I know, this is heavy!"

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center