-
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
-
Senior Member
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.
-
Senior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|