pairdistsph: Pairwise Distances Between Points on a Sphere

View source: R/pairdistsph.R

pairdist.sphR Documentation

Pairwise Distances Between Points on a Sphere

Description

Computes the matrix of distances between all pairs of points on a sphere.

Usage

pairdistsph(X, rad = 1)

Arguments

X

Locations of points. An object of class sp2 or sp3, or a 2 column matrix, with locations in spherical coordinates, or a 3 column matrix, with locations in Cartesian coordinates.

rad

Optional. The radius of the sphere, default value 1. Not required if X is an object of class sp2 or sp3.

Details

Given a dataset (representing a point pattern on a sphere, or a subset of a sphere) pairdistsph computes the minimum great circle distance between each pair of points in the dataset, and returns a matrix containing these distances.

If X is an object of class sp2 or sp3, then its radius will be used rather than that specified in rad.

Value

A square matrix whose [i,j] entry is the distance between the points numbered i and j.

Note

This function is the analogue for point processes on the sphere of the function pairdist in spatstat, which is the corresponding function for point processes in R^2. Hence elements of this help page have been taken from pairdist with the permission of A. J. Baddeley. This enables the information on this help page to be consistent with that for pairdist. It is hoped that this will minimise or remove any confusion for users of both spatstat and spherstat.

Author(s)

Tom Lawrence <email: tjlawrence@bigpond.com>

See Also

nndistsph (nearest neighbour distances), gcdist (great circle distance between two points), bdist.sphwin (boundary distances), pairdist

Examples

sph <- sphwin(type="sphere")
rps <- rpoispp.sphwin(win=sph, lambda=1)
pairdistsph(rps)

baddstats/spherstat documentation built on Feb. 6, 2023, 1:45 a.m.