# Average distance between nearest neighbors for randomly placed points in a unit square?

The answers I found were generally about the distance between any two points in a square. I'm trying to find the average distance between nearest neighbors.

Background on this is I'm processing 3D point cloud data. Generally the points define a surface in 3D space, and the linear spacing between the points is important to me. I can easily find there are, say, about 30 points per square inch, and what I'm trying to calculate is the average distance between nearest neighbors. I could do this empirically but wanted to understand it better.

I found this: How to compute the expected distance to a nearest neighbor in an array of random vectors? But unsure how to interpret this for points.

• The link you give does the expected value of the "distance" to the nearest neighghbor; you would just say that all the vectors are based at the origin, and the endpoints of the random vectors are your random points. However, in that link, the "distance" function studied is the manhattan distance; for example, the distance between$(0,0)$ and $(3,4)$ would be $3+4 = 7$ rather than $\sqrt{3^2+4^2} = 5$. So that answer is presumedly not what you want. – Mark Fischler Jan 27 '16 at 20:13
• Thanks- and yes it would be the Euclidean distance that's of interest. – James Creasy Jan 27 '16 at 20:32