How to find rotation matrix from vector to another?
조회 수: 104 (최근 30일)
이전 댓글 표시
I have object with 3 vector. Let's say:
e1=[a1 b1 c1];
e2=[a2 b2 c2];
e3=[a3 b3 c3];
The global coordinator system (Ox, Oy, Oz)
n1=[1 0 0]; % Ox
n2=[0 1 0]; % Oy
n3=[0 0 1]; % Oz
How to find the rotation matrix R to rotate the object to match with xyz (e1 // n1, e2 // n2, e3 // n3) ? (// :parallel)
How to find R?
댓글 수: 0
채택된 답변
Jan
2017년 9월 20일
편집: Jan
2017년 9월 20일
R = [e1; e2; e3]
is the rotation matrix already, when we assume, that these are the normalized orthogonal vectors of the local coordinate system. To convert between the two reference systems all you need is R and R.' (as long as the translation is ignored).
A vector v=[x;y;z] in the global reference system is
R * v
in the local system. Then you can convert it back to the global system by:
R.' * R * v
and because this must reply v again you get the identity:
R.' * R == eye(3)
such that
R.' == inv(R) % except for rounding errors
You can split this rotation matrix to 3 matrices around specific axes to get a set of Euler or Cardan angles.
You will find many discussions in the net, which end in flamewars, because the users cannot decide if R or R' is the actual rotation, because sometimes the rotation of the vector is meant, and sometimes the rotation of the reference system. Each field of science has its own preferences in this point. See https://www.mathworks.com/matlabcentral/answers/313150-why-is-the-result-of-quaternion-rotation-an-matrix-multiplication-not-the-same
Maybe you are looking for the "helical axes", which can define the relative attitude between two coordinate systems by a vector of translation and a rotation around this vector. If so, please clarify this.
댓글 수: 6
John Razzano
2018년 5월 15일
Does this account for the fact that the new coordinate system is not only rotated but translated from the original? For example, if you use [0 0 0] as the "old" point you still get [0 0 0] after it has been transformed to the new frame using this method - I don't think this is correct unless I am misunderstanding something.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 座標変換と軌跡에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!