New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contains point #4
Comments
Hi there! Thanks a lot for your kind words. Happy to hear you're enjoying the book. The case you're describing should definitely work; there might be a bug somewhere in the code. Would you be so nice as to include a small snippet of code that reproduces the error you describe? I'm currently out from home without a laptop to work, but as soon as I get back I'll take a look at this. Best, |
Hi, I looked a little more today when time allowed and I was slightly wrong about the square/rectangle issue. The only issue I see is with the way the points of the polygon are listed. In my testing the polygon points were added moving clockwise through the polygon hence the angles always ended up negative which yields a failure as the test case is limited to positive angles. I'm not sure if it is conventional to list the points in counter-clockwise manner or if the algorithm should take that into account by checking the absolute value of the angle sum? I modified the test file slightly to illustrate the case.
The test will fail on polygon_2 which is the same polygon with the points listed in reverse order. |
Hi,
I am working through your book and enjoying it so far. Well written and reminding me of all the things I learnt during my engineering degree. When writing tests for the
contains_point
function for a generic polygon using winding number algorithm the algorithm seems to fail when a square/rectangle is entered as a polygon. Is this to be expected? In my mind it should work but I cant figure out why it doesn't unless an absolute value is generated from the angle sum.The text was updated successfully, but these errors were encountered: