NNDIST Nearest-neighbor distances of each point in a set.

   DISTS = nndist(POINTS)
   Returns the distance to the nearest neighbor of each point in an array
   of points.
   POINTS is an array of points, NP-by-ND.
   DISTS is a NP-by-1 array containing the distances to the nearest
   neighbor.

   This functions first computes the Delaunay triangulation of the set of
   points, then search for nearest distance in the set of each vertex
   neighbors. This reduces the overall complexity, but difference was
   noticed only for large sets (>10000 points)

   Example
     % Display Stienen diagram of a set of random points in unit square
     pts = rand(100, 2);
     [dists, inds] = nndist(pts);
     figure; drawPoint(pts, 'k.');
     hold on; drawCircle([pts dists/2], 'b');
     axis equal; axis([-.1 1.1 -.1 1.1]);
     % also display edges
     drawEdge([pts pts(inds, :)], 'b');

   See also
     points2d, distancePoints, minDistancePoints, findPoint

Package: matgeom