Calculate Rotation matrix from 3 points

49 次查看(过去 30 天)
I have 3 base coordinate points
p0 = [533,-422 -1];
px = [219 -57 -993];
py = [5 -70 -23];
I would like to calculate the transformation matrix above these points. How would I go about doing so? because I am quite lost...

回答(2 个)

Matt J
Matt J 2021-11-8
编辑:Matt J 2021-11-8
You can use this File Exchange submission,
but it is not enough to have 3 points. You need 3 points both before and after the transformation (actually only 2 if you are only estimating rotation and not translation).

William Rose
William Rose 2021-11-8
A rotation in three dimensions has three degrees of freedom, so you need to know three "before" points and three "after" points.
I asssume you have given us the "after" points:
p0a = [533;-422;-1]; pxa = [219;-57;-993]; pya = [5;-70;-23];
I assume from the names of the ponts that the "before" points are
p0b=[0;0;0]; pxb=[1;0;0]; pyb=[0;1;0];
But those cannot be the real before points, because the "after" points are separated by more than 1 unit. Also, as @Matt J pointed out, the origin has been translated. You should check the "after" points to see that they form two equal-length legs of a right triangle. You may do this as follows:
fprintf('Length(pxa-p0a)=%.2f\n',norm(pxa-p0a));
Length(pxa-p0a)=1102.67
fprintf('Length(pya-p0a)=%.2f\n',norm(pya-p0a));
Length(pya-p0a)=634.96
fprintf('angle(pxa-p0a-pya)=%.2f radians\n',...
acos((pya-p0a)'*(pxa-p0a)/(norm(pya-p0a)*norm(pxa-p0a))));
angle(pxa-p0a-pya)=1.10 radians
We see that the sides are of unequal length and are not at right angles. Therefore you must reevaluate the original problem statement.

类别

Help CenterFile Exchange 中查找有关 Computational Geometry 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by