Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

Calculating velocity/acceleration

General discussion about anything TouchDesigner

Calculating velocity/acceleration

Postby bnew » Wed Apr 17, 2019 12:37 pm

Hi - I'm trying to calculate the velocity and acceleration of a generic chop input. I'm shaky with the math, but since my intention to look at this frame by frame (making time=1), I'm doing:

where input[0] is the latest sample in the channel

vel1 = input[0] - input[1]
vel2 = input[1] - input[2]

acceleration1 = vel1-vel2

I've made a simple tox to do these calculations but I'm seeing some weird results. When I feed it a ramp pattern, velocity and acceleration values vary just ever so slightly. I've attached the tox and would appreciate a look to see if this is the proper way to do these calculations. I'm using delay chops, specifying delays in frames, and maths rather than python to do the calculations.

thanks!
b
Attachments
accel_test.tox
(1.19 KiB) Downloaded 2 times
bnew
 
Posts: 22
Joined: Tue Dec 19, 2017 8:40 pm

Re: Calculating velocity/acceleration

Postby guarana » Wed Apr 17, 2019 5:28 pm

You could compare your results with a slopeCHOP

https://docs.derivative.ca/Slope_CHOP

(+ use trailCHOP with a fixed viewer to visualize)
// Philippe Provencher
guarana
 
Posts: 80
Joined: Sun Apr 27, 2014 10:13 pm

Re: Calculating velocity/acceleration

Postby bnew » Wed Apr 17, 2019 6:25 pm

Thank you! Did not know the 'slope' chop existed... I am seeing some of the same artifacts but far less. Anyone have any ideas of why it would be doing this?

Here's how the data looks. First column is speed, second acceleration. Sometimes I get weird little blips in acceleration and/or velocity. Maybe its just because im feeding this with a pattern.
Screen Shot 2019-04-17 at 6.18.49 PM.png
Screen Shot 2019-04-17 at 6.18.49 PM.png (28.55 KiB) Viewed 78 times

Screen Shot 2019-04-17 at 6.20.55 PM.png
Screen Shot 2019-04-17 at 6.20.55 PM.png (78.09 KiB) Viewed 78 times


tox attached as well.
Attachments
slopeTest.tox
(694 Bytes) Downloaded 3 times
bnew
 
Posts: 22
Joined: Tue Dec 19, 2017 8:40 pm

Re: Calculating velocity/acceleration

Postby rob » Thu Apr 18, 2019 9:25 am

The glitch is happening as the timeline wraps around.
Specifically the value in pattern1 drops from 1 to 0 at that time.

The slight variations in value are likely due to the limits of floating point precision happening in the CHOPs.

Hope that helps,
Rob
User avatar
rob
Staff
 
Posts: 1621
Joined: Tue Nov 13, 2007 1:14 am


Return to General TouchDesigner Discussion

Who is online

Users browsing this forum: No registered users and 14 guests