7

I just need some directions regarding a problem I have, where to look, etc.. I am using a movement tracking glove for one of my projects, which returns an X, Y and Z values for each finger and for the palm.

What I would like to do is to first create a representation of each finger movements based on these coordinates, , and then attach each of them to the movement of the palm, to have a representation of the hand. This second step will be easy once I manage the first one, but... I don't manage.

I'm trying to implement it in Java (better analysis possibilities), but can only manage to make a 3D graph with ALL the points, at the same time. And there are around 45,000 of them in each curve, so... Would you have any idea of how to make it more like an animation, as in displaying a point at its XYZ coordinates at a given time t?

The other question is: is matlab actually the best option for this? I see how to make this animation work in Java, but I've never used Java for data management, and I doubt it is really good at it.. Is there another software/language that would be good at data management AND animating it? Or should I just use Java to make the animation, and Matlab to do the analysis?

Thanks!

Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201
Cristol.GdM
  • 505
  • 2
  • 5
  • 21
  • Matlab does a pretty good job at what you ask. However you should provide more detail regarding how you represent the finger in matlab (graphic object). It is rather easy but you should provide more detail. – Jorge Jan 05 '12 at 12:58
  • Thanks! What I'm looking for is to have a 3D space with axis/coordinates, and a basic dot moving in this space, at the XYZ coordinates corresponding to a given t. The dot would just move by itself continuously, or would be controlled through the interface (for example moving a scrolling bar representing the whole range of t). The glove is recording only one position for the whole finger, so their representation is pretty simple (one dot per finger) Again, this whole 3D animation/interface control seems a lot more appropriate for Java, but if there is a way to do it in Matlab it would be great – Cristol.GdM Jan 05 '12 at 14:46

1 Answers1

2

You can do the following. Let pos be an Nx3 matrix which contains the x,y,z data of a point, for N time instances. You write a main script which sets up vars etc, and create a loop timer t1 that calls the plotting function "doPlot". The main script is,

clear all
clc

pos=rand(100,3)*10;  %position matrix of random x,y,z coordinates. 100 time instances here

ax=axes;
set(ax,'NextPlot','replacechildren');
axis([0 10 0 10 0 10]); %set axis limits- fit to your needs

Dt=0.1; %sampling period in secs

k=1;
hp=plot3(pos(k,1),pos(k,2),pos(k,3),'o'); %get handle to dot object

t1=timer('TimerFcn','k=doPlot(hp,pos,t1,k)','Period', Dt,'ExecutionMode','fixedRate');
start(t1);

Next you create the plotting function doPlot,

function k=doPlot(hp,pos,t1,k)

k=k+1;
if k<length(pos)
   set(hp,'XData',pos(k,1),'YData',pos(k,2),'ZData',pos(k,3));
   axis([0 10 0 10 0 10]);
else
    stop(t1)
end

You will see a point (circle) in 3D randomly moving aroung in space. The animation period is Dt secs (0.1 secs in this case). You must fit it to your needs. This is a basic animation in Matlab. You could do much more. It depends on your needs.

Jorge
  • 784
  • 5
  • 16