
-----------------------------------
Flikerator
Wed Apr 19, 2006 7:15 am

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-

-----------------------------------
Andy
Wed Apr 19, 2006 9:59 am


-----------------------------------
ever heard of cosine law?

this shouldnt be in general programming.

moved

-----------------------------------
MysticVegeta
Wed Apr 19, 2006 1:52 pm


-----------------------------------
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

-----------------------------------
codemage
Thu Apr 20, 2006 9:05 am


-----------------------------------
That's odd.  I distinctly remember the last time I used COS law, and it was thinly sliced cabbage.

-----------------------------------
zylum
Thu Apr 20, 2006 10:42 am


-----------------------------------
ha ha ha!   :eh:  :doh:

-----------------------------------
Flikerator
Thu Apr 20, 2006 11:39 am


-----------------------------------
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 ^^;

http://ic1.deviantart.com/fs10/i/2006/110/4/6/Convex_Polygon___not_so_much_by_Jack_Skellingtin.jpg
http://ic1.deviantart.com/fs10/i/2006/110/4/6/Convex_Polygon___not_so_much_by_Jack_Skellingtin.jpg

-----------------------------------
Andy
Thu Apr 20, 2006 12:04 pm


-----------------------------------
why dont you check if it's an obtuse angle and if it is just find the reflex of the reflex
