cir_coord_conv function

Transforming between polar and Cartesian coordinates

Transforming between polar and Cartesian coordinates

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

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π)[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 S1S^{1}. Must not contain NA's.

Returns

  • 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))))
  • Maintainer: Eduardo García-Portugués
  • License: GPL-3
  • Last published: 2024-05-24