I = nearestNeighbor(shp,qx,qy),
for a 2-D alpha shape shp, returns the indices of points on
the boundary of shp closest to the query points.
I is the array of nearest neighbor indices where each
index corresponds to the row index in shp.Points. The
qx and qy query coordinates must be
the same size.
I = nearestNeighbor(shp,qx,qy,qz),
for a 3-D alpha shape, returns the indices of the boundary points of
shp closest to (qx,qy,qz) and
corresponds to the row indices in shp.Points. The
qx, qy, and qz
query coordinates must be the same size.
I = nearestNeighbor(shp,QP)
specifies the query points as a matrix QP. For a 2-D alpha
shape, QP is a matrix with two columns representing the
qx and qy coordinates. For a 3-D alpha
shape, QP has three columns representing the
qx, qy, and qz
coordinates.
I = nearestNeighbor(___,RegionID)
returns the index of the nearest point that lies on the boundary of the region
specified by RegionID, where 1 ≤
RegionID ≤ numRegions(shp). You can
include any of the input arguments in the previous syntaxes.
[I,D] =
nearestNeighbor(___)
additionally returns the Euclidean distance between the query point and its
nearest neighbor. D has the same size as
I.
Alpha shape, specified as an alphaShape object.
For more information, see alphaShape.
Example: shp = alphaShape(x,y) creates a 2-D alphaShape object
from the (x,y) point coordinates.
qx — Query point x-coordinates numeric array
Query point x-coordinates, specified as a numeric array.
Data Types: double
qy — Query point y-coordinates numeric array
Query point y-coordinates, specified as a numeric array.
Data Types: double
qz — Query point z-coordinates numeric array
Query point z-coordinates, specified as a numeric array.
Data Types: double
QP — Query point coordinates two-column matrix | three-column matrix
Query point coordinates, specified as a two-column matrix or a
three-column matrix.
For 2-D, the columns of P represent
qx and qy coordinates,
respectively.
For 3-D, the columns of P represent
qx, qy, and
qz coordinates, respectively.
Data Types: double
RegionID — ID number for a region in the alpha shape positive integer scalar
ID number for region in alpha shape, specified as a positive
integer scalar between 1 and numRegions(shp).
An alpha shape can contain several smaller regions, depending
on the point set and parameters. Each of these smaller regions is
assigned a unique RegionID, which numbers the regions
from the largest area or volume to the smallest. For example, consider
a 3-D alpha shape with two regions. The region with the largest volume
has a RegionID of 1, and the smaller region has
a RegionID of 2.
Example: shp.RegionThreshold = area(shp,numRegions(shp)-2); suppresses
the two smallest regions in 2-D alpha shape shp.
Nearest neighbor indices, returned as an integer-valued array. The indices
correspond to the row index of shp.Points and indicate
the points on the boundary of shp that are closest to the
given query points.
D — Distance from query points to nearest neighbors numeric array
Distance from query points to nearest neighbors, returned as a numeric
array. D is the 2-D or 3-D Euclidean distance and is the
same size as I.