Query nearest `polyshape`

vertex

`[`

finds the vertex of a scalar `vertexid`

,`boundaryid`

,`ind`

] = nearestvertex(`polyin`

,`x,y`

)`polyshape`

object that is nearest to
each 2-D query point. The coordinates of the query points are specified in
`x`

and `y`

. The output contains three vectors:

`vertexid`

contains the row number in`polyin.Vertices`

corresponding to the nearest vertex for each query point.`boundaryid`

contains the boundary index of`polyin`

corresponding to the nearest vertex for each query point.`ind`

contains the nearest vertex index in the boundary`boundaryid`

for each query point.

`[`

specifies the query points as a 2-column matrix `vertexid`

,`boundaryid`

,`ind`

] = nearestvertex(`polyin`

,`P`

)`P`

whose first
column contains the *x*-coordinates and whose second column
contains the corresponding *y*-coordinates.