Function selectPairIndices

Description

Out of a list of locations given by their Cartesian coordinates, selects pairs of locations with a distance as a criterion.

Usage

1
selectPairIndices(locations, maxDistance = NULL, numberOfPairs = NULL)

Arguments

locations

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.

See Also

pairCoordinates

Examples

1
2
(locations<-cbind(rep(1:4,5),rep(1:5,each=4)))
selectPairIndices(locations, maxDistance = 1.5)