This function will check, whether a given point is inside the given source polygon or outside. Optionally it may also draw the point with given inside/outside colors respectivly.
SYNTAX:
pip% = PointInPolygon% (chkX%, chkY%, srcPolyX%(), srcPolyY%(), ic&&, oc&&)
INPUTS:
chkX%, chkY% (INTEGERs)
- The x/y coordinates of the point to check.
srcPolyX%(), srcPolyY%() (INTEGER arrays)
- These are 1-dimensional arrays containing the x/y coordinates of the source polygon's corners. Start with the first corner in the lowest array index, end with last corner in the highest index, ie. you must not return to the first corner. Obviously the arrays must match and must have exactly "number of corners" elements. The corners may be traced in either direction (clockwise or counter-clockwise).
ic&&, oc&& (_INTEGER64s)
- Optional the inside/outside color numbers for drawing on a palette based screen, or the _RGB32/_RGBA32 color value on 32-bit screens. Any negative number will disable drawing for the respective case(s), hence make sure your 32-bit colors are defined as unsigned values.
RESULT:
pip% (INTEGER)
- This flag is true (-1), if the checked point is inside the given source polygon or false (0), if the checked point is outside.