coordinates2: Coordinate Transformations

coordinates2R Documentation

Coordinate Transformations

Description

Converts vector between Cartesian and spherical coordinate systems

Usage

cartesian_to_spherical(n)

spherical_to_cartesian(p)

spherical_to_geographical(p)

Arguments

n

Cartesian coordinates (x, y, z) as three-column vector

p

Spherical coordinates (colatitude, azimuth) as two-column vector

Value

Functions return a (2- or 3-dimensional) vector representing a point in the requested coordinate system.

See Also

cartesian_to_geographical() and geographical_to_cartesian() for conversions to geographical coordinates

Examples

n <- c(1, -2, 3)
cartesian_to_spherical(n) # 36.699, -63.435
p <- c(50, 10)
spherical_to_cartesian(p) # 0.75, 0.13, 0.64

tectonicr documentation built on Dec. 12, 2025, 9:06 a.m.