Learn R Programming

DPCD (version 0.0.1)

procrustes: Procrustes Transformation

Description

Aligns a given object configuration to a target object configuration using a Procrustes transformation.

Usage

procrustes(X, Y)

Value

The transformed version of Y aligned to X.

Arguments

X

The target configuration.

Y

The configuration to be aligned to X.

Details

This function performs a Procrustes transformation to align a given configuration, Y, to the target configuration, X, using a combination of translation and rotation. The transformation aims to minimize the sum of squared differences between the two configurations.

X and Y should be numeric matrices of the same dimension.

Examples

Run this code
X <- matrix(rnorm(20), ncol = 2)
rotation_matrix <- matrix(c(cos(pi/4), -sin(pi/4), sin(pi/4), cos(pi/4)), ncol = 2)
Y <- X %*% rotation_matrix + 2
Y_transformed <- procrustes(X, Y)

Run the code above in your browser using DataLab