#' Transform the angular values to be on principal interval
#'
#' \code{on.torus()} transforms data to be on \eqn{[-\pi, \pi)^2}.
#'
#' @param x Matrix-formed numeric data which has 2 columns.
#' @export
#' @examples
#' \dontrun{
#' x <- matrix(c(10/3 * pi, -5/4 * pi), ncol = 2, byrow = TRUE)
#'
#' on.torus(x)
#' }
on.torus <- function(x){
y <- x - 2 * pi * floor(x/2/pi + 1/2)
# y <- x
# y[,1] <- x[,1] - 2*pi*floor(x[,1]/2/pi)
# y[,2] <- x[,2] - 2*pi*floor(x[,2]/2/pi)
return(y)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.