# Thread: calculating the angle between 3 points

1. Senior Member
Join Date
Aug 2010
Posts
127
Rep Power
0

## calculating the angle between 3 points

I have 3 points: A, B and C. These are just pairs of doubles defining their x and y values. Now I need to calculate the angle between the lines AB and BC. Is there a methode in the standard java library that does this? I thought there was one in the Math class, but I was wrong.

2. Originally Posted by imorio
I have 3 points: A, B and C. These are just pairs of doubles defining their x and y values. Now I need to calculate the angle between the lines AB and BC. Is there a methode in the standard java library that does this? I thought there was one in the Math class, but I was wrong.
The dot product of two vectors AB and BC is defined as |AB|*|BC|* cos(a) where |x| is the length of vector x and a is the angle between the vectors AB and BC. The dot product also is AB_x*BC_x+AB_y*BC_y; do your math.

kind regards,

Jos

#### Posting Permissions

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