Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thank you :)
yeah, that's a point.
with the test cases generated it shouldn't be any problem.
i also looked through all the tests and it's looking good :) i can approve now.
Ah, I've read the article on Wikipedia. Well, I think that if other users implement an easier algorithm, there should not be issues in the test suite.
Could you give a link to the standard algorithm, please? Because I was pretty sure, that algorithm implemented by me is standard.
As a note, you're right, that in ideal case this algorithm requires several additional checks, so as not to fail. However, generating an ideal test suite for this problem seems very difficult and lengthy to me, so I decided to only leave the check, that the randomly generated point is not too close to polygon.
More than that, precision of
1e-9
is very rarely needed, in practice. In my previous job, I've used the same algorithm to validate, if client's home is in delivery zones of restaurant, where delivery zones were given as a list of geolocation coordinates. Even a precision of1e-5
or1e-6
already gives you a precision up to a corner of the house, so here's that.Your approach to the problem of the ray intersecting with a polygon vertex is interesting.
If i were nit-picky, you could construct a tiny polygon with vertices every
10^-9
distance units, to make your algorithm run in an endless loop.Wikipedia states the following to this problem
If the intersection point is a vertex of a tested polygon side, then the intersection counts only if the second vertex of the side lies below the ray.
Perhaps with this approach, the solution could be simpler? And easier to verify the correctnes for reviewers ;)
Don't get me wrong, it's an interesting solution and probably works correctly, it would just be easier to review if you implemented a standard algorithm.
Also, i want take a look at your generated polygons, but i don't have so much time right now.
allright, fair enough.
I prefer not to enforce visualization and leave it up to user. The method is preloaded in initial solution, either way.
thanks for the translation. still need to take a deeper look to approve.
one thing i noticed right away