rotate_manip_space: Performs a rotation on the manipulation space of the given...

View source: R/1_manual_tour.r

rotate_manip_spaceR Documentation

Performs a rotation on the manipulation space of the given manip var.

Description

A specific R3 rotation of the manipulation space for a 2D tour. Typically called by manual_tour(). The first 2 columns are x and y in the projection plane. The 3rd column extends "in the z-direction" orthogonal to the projection plane.

Usage

rotate_manip_space(manip_space, theta, phi)

Arguments

manip_space

A (p, d+1) dim matrix (manipulation space) to be rotated.

theta

Angle (radians) of "in-projection-plane" rotation (ie. on xy- of the projection). Typically set by the manip_type argument in proj_data().

phi

Angle (radians) of "out-of-projection-plane" rotation (ie. into the z-direction of the manipulation space. Effectively changes the norm of the manip_var in the projection plane.

Value

A (p, d+1) orthonormal matrix of the rotated (manipulation) space. The first 2 columns are x and y in the projection plane. The 3rd column extends "in the z-direction" orthogonal to the projection plane.

See Also

Other manual tour adjacent functions: create_manip_space(), interpolate_manual_tour(), manip_var_of(), manual_tour()

Examples

library(spinifex)
dat <- scale_sd(wine[, 2:6])
bas <- basis_pca(dat)
mv  <- manip_var_of(bas)
msp <- create_manip_space(basis = bas, manip_var = mv)
rotate_manip_space(msp, theta = runif(1, max = 2 * pi),
                   phi = runif(1, max = 2 * pi))

## d = 1 case
bas1d <- basis_pca(dat, d = 1)
mv    <- manip_var_of(bas1d)
msp   <- create_manip_space(bas1d, mv)
rotate_manip_space(msp, theta = 0, phi = runif(1, max = 2 * pi))

nspyrison/spinifex documentation built on Feb. 7, 2024, 1:10 p.m.