4 ms·
It might be off-topic but it's worth to mention, there's a Path2d API which allows you to create a path and apply it to a canvas or check whether a specified po
by fatih-erikli 5y ago
It might be off-topic but it's worth to mention, there's a Path2d API which allows you to create a path and apply it to a canvas or check whether a specified point inside that path or not. It's useful when you want to do a collision detection. Point in polygon is a well-known problem and it might be a good idea to move it to the browser's context and trust.
https://developer.mozilla.org/en-US/docs/Web/API/Path2D https://developer.mozilla.org/en-US/docs/Web/API/Path2D
https://en.wikipedia.org/wiki/Point_in_polygon https://en.wikipedia.org/wiki/Point_in_polygon