|
-
How to find points "clockwise" relative to origin?
I have a collection of points that defines a polygon. For example, let's say the blue square bounded by these points: 20 x -30, 70 x -30, 70 x 20, 20 x 20:

I want to find the two points in the polygon that define its edges relative to an observer at the origin. That is, if you were standing at 0,0 which two points would you say were the most clockwise and the most counter-clockwise?
I'm having a hard time thinking of a clean solution that handles all cases, such as the blue square where some of its points have a negative angle relative to origin and some have a positive angle.
- This is for a shadow casting algorithm.
- The origin is not expected to fall within the polygon.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|