How do I get the position coordinates of a moving object?

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?

Answers (1)

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 Comments

Hi, Could you please explain what 'N' means ? I still do not get your logic. Kindly request you to explain a bit more. Thanks in Advance.

Sign in to comment.

Categories

Asked:

on 13 Jun 2015

Commented:

on 13 Jun 2015

Community Treasure Hunt

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

Start Hunting!