dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: atan return value in degrees

  1. #1
    Junior Member
    Join Date
    Jul 2002
    Posts
    1
    hi there,

    i want to calculate the sides of a triangle using the atan function but it return strange values ?!

    the flash help says concerning atan:
    Method; computes and returns the arc tangent for the number specified in the parameter x. The return value is between negative pi divided by 2, and positive pi divided by 2.

    why is that, can somebody help me to compute the value in degrees?

    i know that this might possibly be a stupid question in a math forum but im new to trigonometry and any help is very much appreciated!
    thanks, niko

  2. #2
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    Code:
    y = (y2-y1);
    x = (x2-x1);
    r = Math.atan2(y, x);
    angle = ((r/Math.PI)*180)-90;
    the angle (in degrees) of the line drawn between (x1,y1) and (x2,y2)

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