How do I get the position coordinates of a moving object?
Mostra commenti meno recenti
I have four different 3d points in a single axes and have combined all the four points into a single object. Now I have defined their motion through the makehgtform command and then run it in a loop. The animation runs perfect. But at the end of every iteration, I would like to get the position coordinates data of the 3d points. Is it possible ? I am pasting the relevant code here as well.
if true
rot = eye(4); % Rotation Matrix
i = 1;
for r = 1:length(latitude)
rot = makehgtform('zrotate',r);
translation = makehgtform('translate', [latitude(i) longitude(i+1) altitude(i)]);
set(combinedobj,'matrix',translation*rot);
drawnow
pause(0.3);
i = i+1;
end
end
%%The combinedobj in this code represents the 4 3d points combined into a single object. The value of the property "Matrix" changes every step and it is a 4 by 4 matrix (The value of translation*rot).Is it possible to get any information from this matrix?
Risposte (1)
Walter Roberson
il 13 Giu 2015
m = get(combinedobj, 'matrix');
now multiply m by the original coordinates of the points as an N x 3 matrix. My mind is too foggy right now to remember how to deal with the translation.
2 Commenti
quicklearner
il 13 Giu 2015
Walter Roberson
il 13 Giu 2015
N would be 4 in your case. One row for each of your points.
Categorie
Scopri di più su Object Containers in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!