To correctly sort the point cloud, information about the relative distances between every point are used. Acquired points are randomly indexed and the corresponding matrix
of distances is created. A matrix of distances gathers the information of the distances between all the point in the cloud (see equation 3). In fact, the value of the element dij of the matrix, positioned on the the ith row and the jth column corresponds to the distance between the ith and the jth points of the cloud.