inShape

Tests whether points lie inside an alpha shape.

Category: Mathematics > Computational Geometry

Syntax

tf = inShape(shp, xq, yq)

Tests 2-D query points against a 2-D alpha shape.

tf = inShape(shp, xq, yq, zq)

Tests 3-D query points against a 3-D alpha shape.

tf = inShape(shp, Q)

Query points as the rows of Q.

Description

A point is inside when it falls in one of the triangles (tetrahedra) that make up the shape at the current Alpha. Changing Alpha changes the answer for points near concavities and for points in gaps between regions.

Input arguments

shp
An alphaShape object.
xq, yq, zq
Coordinates of the query points, arrays of the same size.

Output arguments

tf
Logical array: true for points inside the shape.

Example

Points in and out

x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
shp = alphaShape(x, y, 1);
tf = inShape(shp, [0.5 2], [0.2 2])
Output
tf = 1×2 logical array

   1   0

See also

alphaShape inpolygon isinterior pointLocation