views:

89

answers:

1

I have two Cartesian coordinates. There are xyz and BIG XYZ. I want to make these are parallel to each other. For example, x paralel to X ,y parallel to Y and z paralel to Z. I use a rotation matrix but I have a lot of different rotation matrices. For example I have 3D point in xyz Cartesian coordinates and it's called A and I want to change Cartesian coordinate to BIG XYZ and find the same 3D point in this coordinates its called B. Until now it is okay. But when I used a different rotational matrix, points were changed. What can I do? Which Euler rotations can I use?

A: 

Is this what you are looking for?

% an orthonormal base ('old')
x = [1; 0; 0];
y = [0; 1; 0];
z = [0; 0; 1];

% orthogonal (=rotation) matrix having this base as its columns
Rold = [x, y, z]; 

% another orthonormal base ('new')
X = [1;  1; 0]/sqrt(2);
Y = [-1; 1; 1]/sqrt(3);
Z = [1; -1; 2]/sqrt(6);

% orthogonal matrix having this basis as its columns
Rnew = [X, Y, Z]; 

% a "point" (indeed a vector; coordinates are with respect to the 'old' base,
% so this is actually the point 1*x + 2*y + 3*z)
A = [1; 2; 3]

% point = [x y z] A = [x y z] |1| = [X Y Z] |p| = [X Y Z] B
%                             |2|           |q|
%                             |3|           |r|
% where p,q,r are the unknown coordinates in the 'new' base
% To find them, just multiply by the inverse (=transpose) of [X Y Z]
B = Rnew'*Rold*A

% Rnew'*Rold, i.e. transpose(Rnew)*Rold is the rotation you are searching
Federico Ramponi