calculate rotation matrix in 3D
Afficher commentaires plus anciens
i have 3 axis starting at a point of origin and a rotated vector dir1_new starting at the origin. How can i calculate the rotation matrix =
E.G
orig = [311.51 -23.0379 -448.7862]
axis_1 = [2.7239 -0.2014 -3.9228] % starts at origin
axis_2 = [-0.4315 -5.8348 9.9199e-06] % starts at origin
axis_3 = [4.4008 -0.3255 3.0715] % starts at origin
my new vector is :
dir1_new = [2.6843 -0.1997 -3.9435] % starts at origin
6 commentaires
This question does not contain enough information.
It appears that the 3 axis_n vectors define an orthogonal set, and you specify a direction vector dir1_new, assumed to be in this set of axes.
but the question is not clear. It seems that dir1_new is the final direction vector after some rotation, but we need to know where it started from, i.e. what is the starting direction?
(Note that the actual position of the origin is not important since the axis and direction vectors as given appear to be relative vectors)
James Tursa
le 7 Jan 2020
And, if you only have one rotated vector then there will be infinitely many rotation matrices that will work.
bbah
le 8 Jan 2020
Jim Riggs
le 8 Jan 2020
Need one last point of clarification before an answer may be proposed.
If I interpret the three axes (axis_1, axis_2, and axis_3) to be (X, Y, and Z), then we have a left-handed coordinate frame. Note that if I construct unit vectors from the axis vectors:
Vmag = @(x) sqrt(sum(x.^2)):
U1 = axis_1./Vmag(axis_1);
U2 = axis_2./Vmag(axis_2);
U3 = axis_3/Vmag(axis_3);
Now U1 x U2 = -U3
U2 x U3 = -U1, and
U3 x U1 = -U2
A couple suggested ways to turn this into a propper right-handed system:
1) swap the 1 and 2 axes, or
2) negate axis 3
bbah
le 8 Jan 2020
Jim Riggs
le 8 Jan 2020
No, these are not unit vectors. Their magnitudes are all greater than 1.
Réponse acceptée
Plus de réponses (1)
B1=[axis_1/norm(axis_1);axis_2/norm(axis_2);axis_3/norm(axis_3)];
B2=[dir1_new(:),null(dir1_new)];
s=sign(det(B2));
B2=B2.*[1,1,s];
rotationMatrix=B2*B1;
Catégories
En savoir plus sur Polygons dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


