1 Reply Latest reply on Jun 8, 2006 12:29 AM by a¿ex

    Atan2

    EdwardST
      I need a way to be able to find the angle between 2 points, and as far as i know the formula requires the Atan2 function. As far as i know, director doesnt come with an Atan2 function, but does come with an Atan which is still unsuitable.
        • 1. Re: Atan2
          a¿ex Level 1
          I am not exactly sure, what you mean with "the angle between 2 points"
          I suspect, that you mean the angle between the vector described by two points and a horizontal line

          In any case you can use directors arcustangens function, as atan() accepts two values.

          on getangle p1, p2
          vec = p2 - p1
          radians = atan(float(vec[2]), float(vec[1]))
          angle = radians * 180 / pi()
          return angle
          end