framework icon indicating copy to clipboard operation
framework copied to clipboard

Procrustes analysis returns reflection

Open HorpeHUN opened this issue 5 years ago • 0 comments

What would you like to submit? (put an 'x' inside the bracket that applies)

  • [x] question
  • [ ] bug report
  • [ ] feature request

Issue description

I am trying to fit sets of 2D points. Find the translation and rotation and maybe scaling between them. Procrustes analysis in some cases returns a result that also contains a reflection. But in my use case I can only fit the points with a translation and a rotation. I am not sure if Procrustes analysis should return a reflection. Maybe there should be an option to restrict it? For the following test data:

var nominals = new[,]
{
    {2.7186382958540563, 89.4185373017815},
    {97.268828979359824, 8.6692414797785737}
};
var actuals = new[,]
{
    { 3.58390459282478, 89.778705956158973},
    { 96.709759025384741, 7.383093758324625}
};

It returns this rotation matrix in the ProcrustedDatasets.RotationMatrix property. And I think this isn't just a rotation, this is also a reflection.

0,139169785653097 -0,99026853467192
-0,990268534671919 -0,139169785653097

Thank you very much if you look into this issue. Here is the full sample program:

static void Main(string[] args)
{
    var nominals = new[,]
    {
        {2.7186382958540563, 89.4185373017815},
        {97.268828979359824, 8.6692414797785737}
    };
    var actuals = new[,]
    {
        {3.58390459282478, 89.778705956158973},
        {96.709759025384741, 7.383093758324625}
    };

    var pa = new ProcrustesAnalysis(nominals, actuals);
    pa.Compute();

    var m = pa.ProcrustedDatasets[1].RotationMatrix;

    Console.WriteLine(m[0, 0] + " " + m[0, 1]);
    Console.WriteLine(m[1, 0] + " " + m[1, 1]);
}

HorpeHUN avatar Aug 25 '20 10:08 HorpeHUN