Line | |
---|
1 | function [M, pts] = arbitrary_motion(nframes, npoints, trans) |
---|
2 | % This will produce a completely arbitrary motion sequence, in which each frame has |
---|
3 | % nothing to do with the previous one. |
---|
4 | |
---|
5 | pts = rand(4,npoints); |
---|
6 | pts(4,:) = ones(1,npoints); |
---|
7 | % points have x,y,z coordinates, and a 1 in the 4th row for translation. |
---|
8 | |
---|
9 | R = []; |
---|
10 | for i = 1:nframes |
---|
11 | r1 = random_normal'; |
---|
12 | % Produces a random unit vector. |
---|
13 | temp = random_normal'; |
---|
14 | r2 = temp - sum(r1.*temp)*r1; |
---|
15 | R = [R;r1;r2]; |
---|
16 | end |
---|
17 | |
---|
18 | if trans |
---|
19 | R = [R, 2*rand(2*nframes,1)-1]; |
---|
20 | else |
---|
21 | R = [R,zeros(2*nframes,1)]; |
---|
22 | end |
---|
23 | |
---|
24 | M = R*pts; |
---|
Note: See
TracBrowser
for help on using the repository browser.