Learn R Programming

Morpho (version 1.0-1)

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

Description

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

Usage

rotonto(x, y, scale = FALSE, signref = TRUE, reflection = TRUE, weights
= NULL, centerweight = FALSE)
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
mat
matrix on which the reverse transformations have to be applied
rot
an object resulting from the former application of rotonto
reflection
allow reflections.
weights
vector of length k, containing weights for each landmark.
centerweight
logical: if weights are defined and centerweigths=TRUE, the matrix will be centered according to these weights instead of the barycenter.

Value

  • yrotrotated and translated matrix
  • Ycentred and rotated reference matrix
  • Xcentred target matrix
  • transvector between original position of target and centered reference (during rotation process)
  • transyvector between original position of reference and centered reference (during rotation process)
  • gammrotation matrix
  • betscaling factor applied
  • reflectif reflect = 1, reflections are involved in the superimposition. Else, reflect = 0

References

Lissitz, R. W., Sch6nemann, 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

rotmesh.onto

Examples

Run this code
library(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

Run the code above in your browser using DataLab