Calculate Rotation matrix from 3 points

49 ビュー (過去 30 日間)
Jimmy Neutron
Jimmy Neutron 2021 年 11 月 8 日
回答済み: William Rose 2021 年 11 月 8 日
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 Center および File ExchangeComputational Geometry についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by