Hi!
I have an issue with my script and even when I simplify the numbers, it still looks funny...here's the simplifed form, question still applies.
I am using two arrays which create squares:
original = [ 1 0 1 1 1 1 0 1 1 0 0 1];
rotated = [ 1 0 1 1 0 0 0 0 0 0 0 1];
I use the following commands:
[D, Z, TRANSFORM] = procrustes(rotated, original);
[yawR, pitchR, rollR] = dcm2angle(TRANSFORM.T);
yaw = rad2deg(yawR);
pitch = rad2deg(pitchR);
roll = rad2deg(rollR);
In this case, I correctly find the roll to be -90deg. Right hand rule!
If I swap the two, I would expect to find the roll to be +90 deg. It still comes up as roll = -90deg. Why does it calculate -90deg for roll in either configuration? I see that the original plane could be translated "above" the rotated plane, allowing for a -90 deg rotation, but that is not the objective: I have ensured that the points on the original correspond to the points in the rotated square. That is to say, if I were to leave the adjacent points in place (the first point both the original and rotated are the same and I desire the rotation to be around this point), the shortest roll should be in the positive 90 deg direction, which would bring the far edges of the squares together.
I can add the plots if it is helpful. Understanding this should help me identify the problem in my alignment! Thank you.