Rev | Line | |
---|
[37] | 1 | function Mt = add_translations(M,ftrans) |
---|
| 2 | % Translation is assumed constant, in a random direction. ftrans is the total |
---|
| 3 | % amount. |
---|
| 4 | nframes = size(M,1)/2; |
---|
| 5 | npts = size(M,2); |
---|
| 6 | |
---|
| 7 | translation_mag = ftrans/(nframes-1); |
---|
| 8 | % By the last frame, total translation should be ftrans. |
---|
| 9 | translation_dir = 2*pi*rand(1); |
---|
| 10 | translation_vec = translation_mag*[cos(translation_dir), sin(translation_dir)]; |
---|
| 11 | |
---|
| 12 | A = repeat((0:nframes-1)',npts); |
---|
| 13 | Mt = M; |
---|
| 14 | Mt(1:2:2*nframes,:) = Mt(1:2:2*nframes,:)+translation_vec(1)*A; |
---|
| 15 | Mt(2:2:2*nframes,:) = Mt(2:2:2*nframes,:)+translation_vec(2)*A; |
---|
Note: See
TracBrowser
for help on using the repository browser.