how to find a value for velocity or speed of a moving point?

kjruddick's picture

Hello I am currently working on a series of fun interactive art projections using Synapse and a Kinect. I am pretty new to quartz but having a lot of fun. My problem is this. I would like to extrapolate a velocity value(some might say speed) from the moving points being tracked by the kinect. This seems like a very simple operation that compares the difference of x, y over time. The result might be in something like pixels per second. Does anyone have a patch or something made to point me too? I have been search for a few hours and tried a lot of patches so far and have yet to crack this one. thanks for any suggestions

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

jrs's picture
Re: how to find a value for velocity or speed of a moving point?

Use a queue patch of length 2 to store the last two values of the points position - then use a structure index member patch to access the current and last positions and then a math patch to work out the distance moved between frames

dust's picture
Re: how to find a value for velocity or speed of a moving point?

for your basic acceleration equation you would take your euclidean distance and divide it by delta time. the euclidean distance coordinatesP1 and P2 would be equation is sqrt((P2-P1)*(P2-P1))/∆t.

to simplify acceleration = P1-P2/∆t = positive result.

for velocity without using gravity acceleration and mass etc..

velocity = (((P-∆t) + P) / ∆t) = positive result.

the simplest equation for velocity with respects to gravity, acceleration and force etc.. would be to use a linear euler method.

acceleration = gravity *(1 - velocity/ terminal velocity) velocity += acceleration * ∆t position += velocity * ∆t

the easiest way would be to make up an init velocity state the same size as your kinect point cloud and feed them both into euler method. this would result in a meters per second squared result.

if you want to just find out the velocity of you hand point. Velocity = (((P-∆t) + P) / ∆t) = will give a positive result in units per time etc...

if you want to know the measurements its helps to know if your working in world dimensions, screen dimensions, pixel space or unit space etc.. just pay attention to those things.

i added example kernel in unit space with the mouse and a point cloud example with gravity using a sphere model to simulate the point cloud.

there are many ways to do this in qc. just to be clear velocity and acceleration are two different things. acceleration being the rate of change of velocity where as velocity is rate of change of position. confusing sort of i would stay away from calling it speed that is more confusing.

EulerLinear.zip57.12 KB

dimitri's picture
Re: how to find a value for velocity or speed of a moving point?

Here's an old composition that demonstrates that, along with a macro for your library. It returns speed and direction over time, and it is javascript free.

Hope it helps a bit.

dd_QC_GestureRec.zip172.49 KB
dd_Movement to trajectory.qtz6.06 KB