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

View source: R/rotonto.r

rotontoR Documentation

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.

...

currently not used

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

rotmesh.onto

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 documentation built on June 22, 2024, 7:19 p.m.