A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Angle between three points

  1. #1
    Junior Member
    Join Date
    Feb 2006
    Posts
    10

    Angle between three points

    I've been mucking around with different ways of doing this but what I've been able to come up with seems needlessly complicated.

    I have three dynamic movable points A, B and C each with their own known x,y coordinates.

    What is the best way to find the angle between the lines AB and BC?

    Thanks

  2. #2
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    First you need to calculate length of each line (length would be ab, ac and bc). Then you can find cos of the angle:
    cosang=(ab*ab+bc*bc-ac*ac)/(2*ab*bc)
    And then you can use Math.acos to find the angle.

  3. #3
    Senior Member ozmic66's Avatar
    Join Date
    Oct 2005
    Posts
    472
    pretty much boils down to finding the vector of each line and taking the dot product, but tonypa simplified it nicely

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