# calculating the angle between 3 points

• 12-24-2010, 01:05 AM
imorio
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.
• 12-24-2010, 01:36 AM
Eranga
Do you know the basic maths about how to calculate the angle between three points?
• 12-24-2010, 09:49 AM
JosAH
Quote:

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