1

We have some set of point coordinates in lat/long which contribute to a polygon. From this set how do we determine the polygon is clockwise or anticlockwise?

6
  • 1
    Given that there are valid cases where a single polygon can be counter clockwise, there's no real way to tell if a polygon is 'clockwise' or 'counterclockwise' without some level of implied knowledge. However, what you're looking for is the 'envelope angle' of your polygon. If it's greater than 90°, then it's 'counterclockwise', otherwise 'clockwise'. Depending on your platform, there are different ways of finding this out. One way would be to ensure that all your data is stored in a valid format before sending it to the client. Commented Jun 9, 2015 at 12:39
  • 1
    @nagytech No, it is trivial to determine ring orientation -- Calculate the area using the trapezoid rule (or zipper algorithm); negative area is opposite orientation of positive area Commented Jun 9, 2015 at 12:59
  • 1
    Check again, I never said any operation was non-trivial. Regardless, calculating the envelope angle is immensely more efficient than calculating the area of a polygon. Commented Jun 9, 2015 at 13:25
  • You wrote "there's no real way to tell if a polygon is 'clockwise' or 'counterclockwise' without some level of implied knowledge", which is incorrect. Commented Jun 9, 2015 at 18:50
  • Here is a discussion on stack overflow. Commented Jun 9, 2015 at 22:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.