How to determine corresponding points between two 3d coordinate systems?

Hello,
I have a prism that is expressed in two different coordinate systems. Let's say I know the coordinates of all vertices of the prism in both coordinate systems and I have a point/set of points I only know coordinates of in one system. How would I determine the coordinates of those point(s) in the second coordinate system, or vice versa? In this example, the prism is the same scale in both systems, but I'm hoping to be able to convert between the two systems even if the scales were different if that makes sense.
figure
v1 = [1 0 0; 3 0 0; 3 2 0; 1 2 0; 1 0 1; 3 0 1];
faces = [1 2 3 4; 1 2 6 5; 3 4 5 6];
patch('Faces',faces,'Vertices',v1,'FaceAlpha',0.5);
hold on
v2 = [-1 3 5; -1 5 5; -1 5 3; -1 3 3; -2 3 5; -2 5 5];
patch('Faces',faces,'Vertices',v2,'FaceAlpha',0.3)
point1 = [4 0 0];
point2 = [-1 6 5];
scatter3(4,0,0,'o');
scatter3(-1,6,5,'o');
grid on;

 Accepted Answer

Using this FEX download,
v1 = [1 0 0; 3 0 0; 3 2 0; 1 2 0; 1 0 1; 3 0 1];
v2 = [-1 3 5; -1 5 5; -1 5 3; -1 3 3; -2 3 5; -2 5 5];
point1 = [4 0 0];
[reg,~,Error]=absor(v1',v2','doScale',1)
reg = struct with fields:
R: [3×3 double] t: [3×1 double] s: 1.0000 M: [4×4 double] q: [4×1 double]
Error = struct with fields:
errlsq: 1.7200e-15 errmax: 8.8818e-16
point2=point1*reg.R'*reg.s+reg.t'
point2 = 1×3
-1.0000 6.0000 5.0000

More Answers (0)

Categories

Asked:

on 29 Dec 2022

Commented:

on 30 Dec 2022

Community Treasure Hunt

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

Start Hunting!