Determine if point is inside alpha shape
tf = inShape(shp,qx,qy)
tf = inShape(shp,qx,qy,qz)
tf = inShape(shp,QP)
tf = inShape(___,RegionID)
[tf,ID] = inShape(___)
Create a set of 2-D points.
th = (pi/12:pi/12:2*pi)'; x1 = [reshape(cos(th)*(1:5), numel(cos(th)*(1:5)),1); 0]; y1 = [reshape(sin(th)*(1:5), numel(sin(th)*(1:5)),1); 0]; x = [x1; x1+15;]; y = [y1; y1];
Create and plot an alpha shape using an alpha radius of 2.5.
shp = alphaShape(x,y,2.5); plot(shp)
Create a Cartesian grid of query points near the alpha shape.
[qx, qy] = meshgrid(-10:2:25, -10:2:10);
Check if the query points are inside of the alpha shape, and if so, plot them red. Plot the query points that lie outside of the alpha shape in blue.
in = inShape(shp,qx,qy); plot(shp) hold on plot(qx(in),qy(in),'r.') plot(qx(~in),qy(~in),'b.')
qx— Query point x-coordinates
Query point x-coordinates, specified as a numeric array.
qy— Query point y-coordinates
Query point y-coordinates, specified as a numeric array.
qz— Query point z-coordinates
Query point z-coordinates, specified as a numeric array.
QP— Query point coordinates
Query point coordinates, specified as a matrix with two columns (2-D) or a matrix with three columns (3-D).
For 2-D, the columns of
For 3-D, the columns of
z coordinates, respectively.
tf— Containment status of query points
Status of the query points, returned as a logical array. The size of
tf is equal to the size of the inputs that specify
the query points (
inShape returns logical
true) values for points that are within the alpha
shape or exactly on the boundary.
ID— IDs of the regions containing the query points
IDs of regions containing query points, returned as a numeric array.
ID is the same size as