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 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