A $d$ x 2 matrix containing the Cartesian coordinates of $d$ points in the plane.
maxDistance
Pairs of locations with distance not larger than maxDistance will be selected. If NULL, then the selection is made based on numberOfPairs.
numberOfPairs
The number of pairs that will be selected, taking distance as a criterion, with closer pairs being selected. It will return more pairs if there are several equidistant locations.
Value
A matrix with q rows and 2 columns, where q denotes the number of pairs selected. Each row contains the indices of the corresponding pair of selected locations in the input argument locations.