Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

detz

macrumors 65816
Original poster
Jun 29, 2007
1,051
0
OK, I have a circle and there is a point in the center. Given two locations on the circle I need to find the angle that is formed in the center. I know this can be done but I'm having trouble making this into an algorithm for a program...here is a diagram to help make my point.

The first point is the green one, now if the second point is any one of those purple points how can I find the new angle for the center?
 

Attachments

  • trig.jpg
    trig.jpg
    580.3 KB · Views: 158
The answer depends on the coordinate system you are using.
If you are using cartesians, you can shift your circle so that its center is at the origin. Then you can get the angles from the x-axis to each point through simple trigonometry. Add the results, and you have the angle you are looking for.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.