convert2: Convert Between Spherical and Cartesian Coordinates

View source: R/convert2.R

convertspherCartR Documentation

Convert Between Spherical and Cartesian Coordinates

Description

convert2 converts from Cartesian to spherical coordinates, whereas convert3 converts from spherical to Cartesian coordinates.

Usage

convert2(points, rad = 1)
convert3(points, rad = 1)

Arguments

points

The coordinates of the points to be converted. See Details.

rad

The radius of the sphere, by default set to 1. Not required if points is an object of class sp2 or sp3.

Details

For convert2, points must contain locations of a point or points in Cartesian coordinates. This can be an object of class sp3 or a length 3 vector or a 3 column matrix.

For convert3, points must contain locations of a point or points in spherical coordinates. This can be an object of class sp2 or a length 2 vector or a 2 column matrix.

Value

The output of convert2 is either an object of class sp2 (if points is an object of class sp2), or a 2 column matrix giving the locations of points in spherical coordinates. The output of convert2 is either an object of class sp2 (if points is an object of class sp3), or a 3 column matrix giving the locations of points in Cartesian coordinates.

Author(s)

Tom Lawrence <email: tjlawrence@bigpond.com>

See Also

convert.globe, convert.sphereplot

Examples

sphere <- sphwin(type="sphere")
X <- rpoispp.sphwin(sphere, lambda=20)
Y <- convert3(X)

i3 <- matrix(c(1,0,0,0,1,0,0,0,1), nrow=3, ncol=3, byrow=TRUE)
convert2(i3)

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