Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Angle
Index -> Off Topic
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Flikerator




PostPosted: 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-
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Wed Apr 19, 2006 9:59 am   Post subject: (No subject)

ever heard of cosine law?

this shouldnt be in general programming.

moved
MysticVegeta




PostPosted: Wed Apr 19, 2006 1:52 pm   Post subject: (No 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
codemage




PostPosted: Thu Apr 20, 2006 9:05 am   Post subject: (No subject)

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




PostPosted: Thu Apr 20, 2006 10:42 am   Post subject: (No subject)

ha ha ha! Eh Doh!
Flikerator




PostPosted: Thu Apr 20, 2006 11:39 am   Post subject: (No 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
Andy




PostPosted: Thu Apr 20, 2006 12:04 pm   Post subject: (No subject)

why dont you check if it's an obtuse angle and if it is just find the reflex of the reflex
Display posts from previous:   
   Index -> Off Topic
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: