FUNCTION REFERENCE

inpolygon

Test whether points lie inside or on polygon boundaries.

Test whether points lie inside or on polygon boundaries.

Syntax

IN = inpolygon(X, Y, XV, YV); [IN, ON] = inpolygon(X, Y, XV, YV)

Returns logical arrays. Boundary points count as inside; ON identifies those points. Scalar point coordinates expand. NaN-separated polygon loops use nonzero winding: reverse an inner loop to make a hole. NaN query points are outside.

Example

inpolygon([0.5 2 1], [0.5 2 0.5], [0 1 1 0], [0 0 1 1])   % [true false true]

Differences from MATLAB: Point-edge work is bounded to 2^32 pairs.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.