cir_coord_conv: Transforming between polar and Cartesian coordinates

cir_coord_convR Documentation

Transforming between polar and Cartesian coordinates

Description

Transformation between a matrix Theta containing M circular samples of size n on [0, 2\pi) and an array X containing the associated Cartesian coordinates on S^1:=\{{\bf x}\in R^2:||{\bf x}||=1\}.

Usage

Theta_to_X(Theta)

X_to_Theta(X)

Arguments

Theta

a matrix of size c(n, M) with M samples of size n of circular data on [0, 2\pi). Must not contain NA's.

X

an array of size c(n, 2, M) containing the Cartesian coordinates of M samples of size n of directions on S^{1}. Must not contain NA's.

Value

  • Theta_to_X: the corresponding X.

  • X_to_Theta: the corresponding Theta.

Examples

# Sample
Theta <- r_unif_cir(n = 10, M = 2)
X <- r_unif_sph(n = 10, p = 2, M = 2)

# Check equality
sum(abs(X - Theta_to_X(X_to_Theta(X))))
sum(abs(Theta - X_to_Theta(Theta_to_X(Theta))))

sphunif documentation built on May 29, 2024, 4:19 a.m.