isinterior
Tests whether points lie inside a polyshape.
Category: Mathematics > Computational Geometry
Syntax
TF = isinterior(pshape, xq, yq)
true for each query point inside or on the polyshape.
TF = isinterior(pshape, Q)
Query points as the rows of a two-column matrix.
Description
The test accounts for all regions and holes of the polyshape, which makes it more convenient than inpolygon for shapes with several boundaries. A point on an edge counts as inside.
Input arguments
pshape- A
polyshapeobject. xq, yq- Coordinates of the query points, arrays of the same size.
Output arguments
TF- Logical array of the size of the query:
truewhere the point is in the shape. Points inside a hole are not inside.
Example
Points relative to a rectangle with a hole
P = polyshape([0 4 4 0], [0 0 3 3]);
H = polyshape([1 2 2 1], [1 1 2 2]);
D = subtract(P, H);
TF = isinterior(D, [0.5 1.5 5], [0.5 1.5 1])
Output
TF = 3×1 logical array
1
0
0