I am given a pivot point (by the integer coordinates) and a line that goes through that point and makes an x degree with the horizontal. The line makes a 360 degrees clockwise rotation around the pivot point with speed s= 0.001 degree per second. I am now given N points (with integer coordinates) and I have to sort these points in the order in which the line touches these points. How can i compute this? Thank you in advance.
2 Answers
3
votes
You need to do something equivalent to the following:
- Translate everything so that the pivot point is at the origin
- Convert each point to polar coordinates.
- Subtract
xfrom each point's angle component, modulo 360 degrees (2pi radians). - Sort the angle components in ascending order.