Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Excerpt
hiddentrue

polygonContainsPt(polyX, polyY, pointX, pointY) Returns True if the point is contained in the polygon.


Function: polygonContainsPt()

...

ArgumentTypeDescription
polyXArrayArray of x coordinates of the polygon (only integer part is used).
polyYArrayArray of y coordinates of the polygon (only integer part is used)
pointXIntegerX coordinate of a point to be tested.
pointYIntegerY coordinate of a point to be tested.

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

See Also