Beta
Polygon Orientation
21 of 31acraileanu
Loading description...
Algorithms
Geometry
Algebra
Mathematics
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
There are self-interacting polygons in the test cases, which don't have a well-defined orientation. Quoting from Wikipedia:
In fact the author solution and most of the existing solutions can return either orientation depending on the shape (but not the topology) of the self-intersection polygon.
New example added to description, for disambiguation.
That was a very, very nice kata.
I appear to be the only one to have come up with my solution so far, which may not be 100% correct, but passed all tests. :-)
The choice of the point is right if there are no 180 degree angles but the check at the end should be different. So I suggest a test: (0, 0), (1, 1), (2, 3) => CCW.
This comment has been hidden.
This comment has been hidden.
Suggested tests were added, with coordinates a bit farther away, for better visualization, but proportions maintained.
The solution no longer passes the tests after updates.