Member of the geometry class.
a = inpolygon(px, py, polyx, polyy)
[a, b] = inpolygon(px, py, polyx, polyy)
Determines whether given points in the plane are inside a specified polygon.
| Name | Description |
| px | Specifies a vector of real numbers that represent the x-coordinates of the given points. |
| py | Specifies a vector of real numbers that represent the y-coordinates of the given points. length(py) must equal length(px). |
| polyx | Specifies a vector of real numbers that represent the x-coordinates of the given points of the polygon. |
| polyy | Specifies a vector of real numbers that represent the y-coordinates of the given points of the polygon. length(polyy) must equal length(polyx). |
| Name | Description |
| a | Returns a vector of logical numbers of the same size as px. If the nth point (px, py) is inside or on the edge of the polygon, the nth element of a is 1. Otherwise, the nth element of a is 0. |
| b | Returns a vector of logical numbers of the same size as px. If the nth point (px, py) is on the edge of the polygon, the nth element of b is 1. Otherwise, the nth element of b is 0. |
Z = 0:pi / 4:2*pi;
Polyx = cos(Z);
Polyy = sin(Z);
Px = 2*rand(500, 1) - 1;
Py = 2*rand(500, 1) - 1;
A = inpolygon(Px, Py, Polyx, Polyy)