-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|168|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Collisions and Physics


 
Pakz
Created : 02 November 2019
 
Language : Monkey2

Point versus Polygon Collision

Check if a point is inside a polygon

Latest Update

I am still looking to learn how to do polygon vs polygon collision. Today I figured out how to find collision with a polygon versus a point

The method here is done with line collisions. You take a random point somewhere away of the polygon and then check collision with the to be checked point versus the lines of the polygon. If the point is inside the polygon then there wil be a uneven amount of collisions. If it is outside then a even amount of collisions.

The original description said to use rays to check it, but I used lines since this seemed this would do the trick also.

 

Comments


Saturday, 02 November 2019, 22:24
Pakz
I just noticed there was already a snippet for this here. Though there was no description and it was in another language.