genR {rotations}R Documentation

Generate rotations

Description

Generate rotations in matrix format using Rodrigues' formula or quaternions.

Usage

genR(r, S = NULL, space = "SO3")

Arguments

r

vector of angles.

S

central orientation.

space

indicates the desired representation: rotation matrix "SO3" or quaternions "Q4."

Details

Given a vector U=(u1,u2,u3)R3U=(u_1,u_2,u_3)^\top\in R^3 of length one and angle of rotation rr, a 3×33\times 3 rotation matrix is formed using Rodrigues' formula

cos(r)I3×3+sin(r)Φ(U)+(1cos(r))UU\cos(r)I_{3\times 3}+\sin(r)\Phi(U)+(1-\cos(r))UU^\top

where I3×3I_{3\times 3} is the 3×33\times 3 identity matrix, Φ(U)\Phi(U) is a 3×33\times 3 skew-symmetric matrix with upper triangular elements u3-u_3, u2u_2 and u1-u_1 in that order.

For the same vector and angle a quaternion is formed according to

q=[cos(θ/2),sin(θ/2)U].q=[cos(\theta/2),sin(\theta/2)U]^\top.

Value

A n×pn\times p matrix where each row is a random rotation matrix (p=9p=9) or quaternion (p=4p=4).

Examples

r <- rvmises(20, kappa = 0.01)
Rs <- genR(r, space = "SO3")
Qs <- genR(r, space = "Q4")

[Package rotations version 1.6.5 Index]