source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/missing-data/random_motion.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 607 bytes
Line 
1function S = random_motion(n)
2% We will produce an 2nx4 matrix that describes a random motion.  Each row of
3% S is (r1 r2 r3 t) where t is a translation and (r1 r2 r3) is a component of
4% rotation.  An odd row and the following even row must have orthonormal
5% rotation vectors.
6S = [];
7for i = 1:n
8   S = [S; one_random_rotation];
9end
10S = [S,rand(2*n,1)];
11
12function S = one_random_rotation()
13r1 = random_normal;
14r2 = random_normal;
15r2p = r2 - sum(r2.*r1)*r1;
16% r2p is projected into the plane normal to r1.  It's no longer a unit vector.
17r2pn=r2p./(sqrt(sum(r2p.*r2p)));
18S = [r1'; r2pn'];
Note: See TracBrowser for help on using the repository browser.