フィルターのクリア

How can I transform a coordinates data into another 3-D space?

4 ビュー (過去 30 日間)
Heejun Rho
Heejun Rho 2018 年 6 月 21 日
コメント済み: Heejun Rho 2018 年 6 月 23 日
suppose that I have coordinates of 4 points X1, X2, X3, and X4 which have form of Xi = [xi1; xi2; xi3; xi4] for i = 1~4 . Their relative position to each other never change. But the whole coordinates were rotated in some way, and now I measured the coordinates of X'1, X'2, and X'3 but not X'4. In this case how can I find the coordinates of X'4 in new 3D space? What function can I use?
+) If there is a linear transform T with 3x3 size matrix that satisfies T*[X1 X2 X3] = [X'1 X'2 X'3] then is it unique?
  2 件のコメント
Matt J
Matt J 2018 年 6 月 21 日
If there is a linear transform T with 3x3 size matrix that satisfies T[X1 X2 X3] = [X'1 X'2 X'3] then is it unique?*
But you said your Xi are 4x1 column vectors. How can they multiply with a 3x3 matrix?
Heejun Rho
Heejun Rho 2018 年 6 月 22 日
You're right. Xi's must be 3x1 column vectors

サインインしてコメントする。

採用された回答

Matt J
Matt J 2018 年 6 月 22 日
You can use ABSOR (Download).
reg = absor([X1 X2 X3],[X'1 X'2 X'3]);
X'4= reg.R*X4 + reg.t;
  1 件のコメント
Heejun Rho
Heejun Rho 2018 年 6 月 23 日
This is exactly what I was looking for. Thank you very much for nice code and example!

サインインしてコメントする。

その他の回答 (2 件)

Mark Saad
Mark Saad 2018 年 6 月 21 日
If you know angles through which they were rotated, you could try using rotation matrices.
https://www.mathworks.com/help/phased/ref/rotx.html

Anton Semechko
Anton Semechko 2018 年 6 月 21 日
Code below demonstrates how to obtain rotation matrices between corresponding 3-tupples of non-collinear points in 3-space:
function three_point_rotation_demo
% Generate 3 random points and random rotation
% -------------------------------------------------------------------------
% 3 (noncollinear) data points
Xo=randn(3,3); % xyz-coordiantes along rows
% Random rotation matrix
r=randn(3,1);
r=r/norm(r); % direction of rotation vector
t=(178*rand(1)+1)*(pi/180); % rotation amount; between 1 and 179 degrees
r=t*r; % random rotation vector
K=zeros(3);
K(1,2)=-r(3);
K(1,3)= r(2);
K(2,3)=-r(1);
K=K-K'; % log of rotation matrix
Ro=expm(K); % rotation matrix corresponding to r
% Apply R to Xo to get X
X=(Ro*(Xo'))';
% Now, suppose that Ro (i.e., rotation that transforms Xo to X) is unknown.
% -------------------------------------------------------------------------
% Compute local (orthogonal) reference frame for X
d21=X(2,:)-X(1,:);
d31=X(3,:)-X(1,:);
e1=d21; e1=e1/norm(e1);
e2=d31-dot(e1,d31)*e1; e2=e2/norm(e2);
e3=cross(e1,e2); e3=e3/norm(e3);
F=[e1;e2;e3]'; % principal axes along columns
% Compute local (orthogonal) reference frame for Xo
d21=Xo(2,:)-Xo(1,:);
d31=Xo(3,:)-Xo(1,:);
e1=d21; e1=e1/norm(e1);
e2=d31-dot(e1,d31)*e1; e2=e2/norm(e2);
e3=cross(e1,e2); e3=e3/norm(e3);
Fo=[e1;e2;e3]';
% Rotation we seek (R) satisfies the equation F=R*Fo. Since Fo and F are
% orhogonal rotation matrices themselves, R=F*transpose(Fo)
R=F*(Fo');
% Now let's check that R is the same (up to numerical round off error) as
% Ro. If it is then R'*Ro should be a 3-by-3 matrix close to identity.
fprintf('Rotation residual:\n')
disp(R'*Ro)
% You can also verify that X=(R*(Xo'))', in which case, (R*(Xo'))'-X will be
% a 3-by-3 matrix with all entries very close to zero
fprintf('\nFrobenius norm of (R*(Xo''))''-X:\n')
disp(norm((R*(Xo'))'-X,'fro'))

カテゴリ

Help Center および File Exchange3-D Scene Control についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by