Computer Science Canada

Angle

Author:  Flikerator [ Wed Apr 19, 2006 7:15 am ]
Post subject:  Angle

If im given three coordinates how do I find the angle of the three points? (That they make with each other).

Like (2,1) (3,0) (5,7)

At (3,0) the forumula for the angle would be-

Author:  Andy [ Wed Apr 19, 2006 9:59 am ]
Post subject: 

ever heard of cosine law?

this shouldnt be in general programming.

moved

Author:  MysticVegeta [ Wed Apr 19, 2006 1:52 pm ]
Post subject: 

Find distance between them (Math.Distance)
Name the sides, A, B, C;

A^2 = B^2 + C^2 - 2*B*C*cos(A)

plugin, vals, find cos A, use inverse get angle

Author:  codemage [ Thu Apr 20, 2006 9:05 am ]
Post subject: 

That's odd. I distinctly remember the last time I used COS law, and it was thinly sliced cabbage.

Author:  zylum [ Thu Apr 20, 2006 10:42 am ]
Post subject: 

ha ha ha! Eh Doh!

Author:  Flikerator [ Thu Apr 20, 2006 11:39 am ]
Post subject: 

I find point a,b, and c and the distances between them. Then I use the cosine law to find the angle. The only problem is when I have an angle > 180 it takes the reflex of it. I know why, but im not really sure how to fix it ^^;

Posted Image, might have been reduced in size. Click Image to view fullscreen.
http://ic1.deviantart.com/fs10/i/2006/110/4/6/Convex_Polygon___not_so_much_by_Jack_Skellingtin.jpg

Author:  Andy [ Thu Apr 20, 2006 12:04 pm ]
Post subject: 

why dont you check if it's an obtuse angle and if it is just find the reflex of the reflex


: