in_poly/3
Checks if a given point's coordinates are inside a given polygon
in_poly(X,Y,polygon) -(i,i,i)
This predicate succeeds if the point with coordinates X and Y (arg.1, arg.2)
is inside the polygon (arg.3). If the first two arguments X and Y are lists of
numbers (of equal length), they are treated like lists of X- and Y- coordinates,
so that the same predicate can test of a list of points is inside a polygon.
Finally, instead of lists, the first two arguments could also be "binaries".
Compatibility: Exclusively in G.I.S. Prolog.
Remarks:
1) A "polygon" in G.I.S. Prolog is defined by four parameters:
poly(NumberOfpoints,BytesPerCoordinate,X_Coordinates,Y_Coordinates)
2) The internal representation of a polygon (in G.I.S. Prolog) uses Visual Prolog
"binaries" for arguments 3 and 4, to improve the efficiency of operation. However,
when polygons are "listed" (using listing/0, listing/1, or listing/2), these
binaries are (instantaneously) translated into number-lists.
3) There are two kinds of polygons in G.I.S. Prolog:
(a) 8-byte (or 64-bit) polygons, which conform to G.I.S. standards, and
(b) 4-byte (or 32-bit) polygons, which correspond to Visual Prolog graphics, as
expressed e.g. by the "PNT" and "PNTLIST" domains, used by Visual Prolog's
built-in drawing predicates such as "draw_polygon" and "draw_rect".
The distinction between these two kinds of polygons is expressed by the second
argument of a polygon-object, which is 8 for 8-byte coordinates, or 4 for
4-byte coordinates.
4) This predicate does not exist in very early versions of G.I.S. Prolog (before v1.02).
Examples:
in_poly(100,110,poly(5,8,[1,4,5,99,200],[4,6,88,999,1200]).