I have 2 sets of 3D axes in Matlab. I have a list of points in the first set of 3D axes that I want to apply a rotation matrix to in order to convert them to the same location in the second set of axes. I am a bit rusty with applying rotation matrices, any help is appreciated.

2 commentaires

James Tursa
James Tursa le 13 Déc 2018
Modifié(e) : James Tursa le 13 Déc 2018
You need to form the direction cosine (rotation) matrix that goes from one coordinate frame to the other coordinate frame. You can get the elements of this matrix with the dot products of the coordinate axes that you have. How are these coordinate axes stored?
Student123
Student123 le 13 Déc 2018
Thanks for your response.
I have defined the axes like this within a function called getaxes:
if ~isequal(size(point1),[1,3]) || ~isequal(size(point2),[1,3])...
|| ~isequal(size(point3),[1,3])|| ~isequal(size(point4),[1,3])
error('Error: Inputs are in wrong dimensions')
end
z_axis= point1-point2;
z_axis=z_axis/norm(z_axis);
plane=cross(z_axis, point3-point4);
y_axis=plane/norm(plane);
x_axis=cross(y_axis, z_axis);
And then I will have points 5 and 6 for example in this coordinate system above that I wish to convert to my second coordinate system which is defined in a similar fashion.

Connectez-vous pour commenter.

 Réponse acceptée

James Tursa
James Tursa le 13 Déc 2018
Modifié(e) : James Tursa le 13 Déc 2018

0 votes

You can use this FEX submission by Matt J with your coordinate axes as the inputs to get the rotation matrix R:
Then just multiply your points with that rotation matrix R.

2 commentaires

Student123
Student123 le 14 Déc 2018
Haven't had a chance to give it a shot yet but looks like what I need, thank you!
James Tursa
James Tursa le 14 Déc 2018
Yes. Just give it the three coordinate axes directions in the two sets as the inputs to get the rotation matrix R as the output. Then just multiply all of your other points by R.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactions, Camera Views, and Lighting dans Centre d'aide et File Exchange

Produits

Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by