Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rotonto

rotates, translates and scales one matrix onto an other using Procrustes fitting


Description

rotates, translates and scales one matrix onto an other using Procrustes fitting

Usage

rotonto(x, y, scale = FALSE, signref = TRUE, reflection = TRUE,
  weights = NULL, centerweight = FALSE)

rotreverse(mat, rot)

## S3 method for class 'matrix'
rotreverse(mat, rot)

## S3 method for class 'mesh3d'
rotreverse(mat, rot)

Arguments

x

k x m matrix to be rotated onto (targetmatrix)

y

k x m matrix which will be rotated (reference matrix)

scale

logical: scale matrix to minimize sums of squares

signref

logical: report if reflections were involved in the rotation

reflection

allow reflections.

weights

vector of length k, containing weights for each landmark.

centerweight

logical or vector of weights: if weights are defined and centerweigths=TRUE, the matrix will be centered according to these weights instead of the barycenter. If centerweight is a vector of length nrow(x), the barycenter will be weighted accordingly.

mat

matrix on which the reverse transformations have to be applied

rot

an object resulting from the former application of rotonto

Details

rotate a matrix onto an other without loosing information about the location of the targetmatrix and reverse this transformations using rotreverse

Value

yrot

rotated and translated matrix

Y

centred and rotated reference matrix

X

centred target matrix

trans

vector between original position of target and centered reference (during rotation process)

transy

vector between original position of reference and centered reference (during rotation process)

gamm

rotation matrix

bet

scaling factor applied

reflect

if reflect = 1, reflections are involved in the superimposition. Else, reflect = 0

Note

all lines containing NA, or NaN are ignored in computing the transformation.

Author(s)

Stefan Schlager

References

Lissitz, R. W., Schoenemann, P. H., & Lingoes, J. C. (1976). A solution to the weighted Procrustes problem in which the transformation is in agreement with the loss function. Psychometrika, 41,547-550.

See Also

Examples

if (require(shapes)) {
lims <- c(min(gorf.dat[,,1:2]),max(gorf.dat[,,1:2]))
rot <- rotonto(gorf.dat[,,1],gorf.dat[,,2]) ### rotate the second onto the first config
plot(rot$yrot,pch=19,xlim=lims,ylim=lims) ## view result
points(gorf.dat [,,2],pch=19,col=2) ## view original config
rev1 <- rotreverse(rot$yrot,rot)
points(rev1,cex=2) ### show inversion by larger circles around original configuration
}

Morpho

Calculations and Visualisations Related to Geometric Morphometrics

v2.8
GPL-2
Authors
Stefan Schlager [aut, cre, cph], Gregory Jefferis [ctb], Dryden Ian [cph]
Initial release
2020-02-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.