This is the fifteen post of the series of programming job interview challenge, 37 readers provided an answer to job interview challenge #14. As you can understand from the title, I have a little announcement to make, but lets first head on to last weeks question answers.
This time, Omar was the first one to provide an efficient and correct detailed answer:
Draw a line from the single point (any direction will do).
Count the number of times that this line intersects with lines of the polygon.
An even count (including zero) indicates that the point is outside of the polygon.
An odd count indicates that the point is inside the polygon.
Here is a nice image taken from Jon von Gillern blog post
We pay for user submitted tutorials and articles that we publish. Anyone can send in a contribution
Learn More