Learn R Programming

rotations (version 1.6.5)

rot.dist: Rotational distance

Description

Calculate the extrinsic or intrinsic distance between two rotations.

Usage

rot.dist(x, ...)

# S3 method for SO3 rot.dist(x, R2 = id.SO3, method = "extrinsic", p = 1, ...)

# S3 method for Q4 rot.dist(x, Q2 = id.Q4, method = "extrinsic", p = 1, ...)

Value

The rotational distance between each rotation in x and R2 or Q2.

Arguments

x

\(n\times p\) matrix where each row corresponds to a random rotation in matrix (\(p=9\)) or quaternion (\(p=4\)) form.

...

additional arguments.

R2, Q2

a single, second rotation in the same parametrization as x.

method

string indicating "extrinsic" or "intrinsic" method of distance.

p

the order of the distance.

Details

This function will calculate the intrinsic (Riemannian) or extrinsic (Euclidean) distance between two rotations. R2 and Q2 are set to the identity rotations by default. For rotations \(R_1\) and \(R_2\) both in \(SO(3)\), the Euclidean distance between them is $$||R_1-R_2||_F$$ where \(||\cdot||_F\) is the Frobenius norm. The Riemannian distance is defined as $$||Log(R_1^\top R_2)||_F$$ where \(Log\) is the matrix logarithm, and it corresponds to the misorientation angle of \(R_1^\top R_2\). See the vignette `rotations-intro' for a comparison of these two distance measures.

Examples

Run this code
rs <- rcayley(20, kappa = 10)
Rs <- genR(rs, S = id.SO3)
dEs <- rot.dist(Rs,id.SO3)
dRs <- rot.dist(Rs, id.SO3 , method = "intrinsic")

#The intrinsic distance between the true central orientation and each observation
#is the same as the absolute value of observations' respective misorientation angles
all.equal(dRs, abs(rs))              #TRUE

#The extrinsic distance is related to the intrinsic distance
all.equal(dEs, 2*sqrt(2)*sin(dRs/2)) #TRUE

Run the code above in your browser using DataLab