polygonContainsPt
Function: polygonContainsPt()
Returns True if the point is contained in the polygon.
Syntax
polygonContainsPt(polyX, polyY, pointX, pointY, decimalPlaces)
Argument | Type | Description |
---|---|---|
polyX | Array | Array of x coordinates of the polygon (only integer part is used). |
polyY | Array | Array of y coordinates of the polygon (only integer part is used) |
pointX | Integer | X coordinate of a point to be tested. |
pointY | Integer | Y coordinate of a point to be tested. |
decimalPlaces | Integer | The number of decimal places to use in the geometry calculations. Defaults to 0 if not provided. Can also take negative values e.g. -1 uses geometry to the nearest 10. |
Examples
polygonContainsPt([10,20,20,10],[10,10,20,20],15,15)
Returns 1
polygonContainsPt([10,20,20,10],[10,10,20,20],21,15)
Returns 0
Note that when the point to be tested is on the boundary, the result is not predictable:
polygonContainsPt([10,20,20,10],[10,10,20,20],10,15)
Returns 1
polygonContainsPt([10,20,20,10],[10,10,20,20],10,10)
Returns 1
polygonContainsPt([10,20,20,10],[10,10,20,20],20,20)
Returns 0