geoDist: Geodesic distance on the unit sphere

Description Usage Arguments Value Examples

View source: R/Geometry.R

Description

Get geodesic distance between points on the unit sphere

Usage

1
geoDist(p1, p2, include.names = FALSE)

Arguments

p1

A data.frame with rows specifying numeric points located on the unit sphere. It should have columns labelled x,y,z for Cartesian or theta, phi for spherical colatitude and longitude respectively.

p2

Same as p1.

include.names

Boolean. If TRUE then the row and column names of the returned matrix will be taken from the points in p1 and p2 (see examples below).

Value

Let n denote the number of rows of p1 and let m denote the number of rows of p2. Then the returned object is an n by m matrix whose entry in position ij is the geodesic distance from the ith row of p1 to the jth row of p2.

Examples

1
2
3
4
5
6
p1 <- data.frame(diag(3))
colnames(p1) <- c("x", "y", "z")
p1
p2 <- data.frame(x=c(1,0), y=c(0,3/5), z=c(0,4/5))
p2
geoDist(p1, p2, include.names = FALSE)

rcosmo documentation built on Dec. 11, 2021, 9:29 a.m.