Skip to contents

Computes pairwise vectors of a 2d or 3d point pattern. Returns circular- or spherical coordinates, depending on the dimension.

Usage

pairwise_vectors(x, from, to, asMatrix = FALSE, as.xyz = FALSE)

Arguments

x

matrix of coordinates.

from

Indices from which to compute

to

Indices to which to compute

asMatrix

return n x n matrices

as.xyz

return as xyz-coordinates instead of polar/spherical

Details

Default is to return the upper triangle (without diagonal) of pairwise distance and angle matrices.

Result will have 2 or 3 columns, where first is the distance and 2(:3) are angle(s).