How do I get the position coordinates of a moving object?
10 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Walter Roberson
on 13 Jun 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 Comments
Walter Roberson
on 13 Jun 2015
N would be 4 in your case. One row for each of your points.
See Also
Categories
Find more on Object Containers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!