Calculate Rotation matrix from 3 points
29 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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...
0 Kommentare
Antworten (2)
William Rose
am 8 Nov. 2021
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));
fprintf('Length(pya-p0a)=%.2f\n',norm(pya-p0a));
fprintf('angle(pxa-p0a-pya)=%.2f radians\n',...
acos((pya-p0a)'*(pxa-p0a)/(norm(pya-p0a)*norm(pxa-p0a))));
We see that the sides are of unequal length and are not at right angles. Therefore you must reevaluate the original problem statement.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Computational Geometry finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!