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.

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

## Setup
dat_std <- scale_sd(wine[, 2:6])
bas <- basis_pca(dat_std)
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))
#>                   PC1         PC2   manip_sp
#> Alcohol    0.07391006  0.42687920  0.6053606
#> Malic      0.44697134  0.08265683 -0.4375485
#> Ash        0.66518242  0.35583984 -0.2692922
#> Alcalinity 0.55517959 -0.71014139  0.4329836
#> Magnesium  0.20990924  0.42428671  0.4267280

## d = 1 case 
bas1d <- basis_pca(dat_std, 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))
#>                   PC1   manip_sp
#> Alcohol    -0.0515941 -0.1116500
#> Malic      -0.2368538 -0.5125534
#> Ash         0.9077634 -0.4194825
#> Alcalinity -0.3195583 -0.6915267
#> Magnesium  -0.1228267 -0.2657980