source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/zisserman/vgg_numerics/vgg_quaternion_demo.m @ 37

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

Added original make3d

  • Property svn:executable set to *
File size: 535 bytes
Line 
1
2
3% Make some synthetic quaternions
4syms   q0 q1 q2 q3   p0 p1 p2 p3   real
5
6q = [q0 q1 q2 q3]';
7p = [p0 p1 p2 p3]';
8
9vgg_assert_equal('vgg_quat_mul(p,q)', 'vgg_quat_matrix(p) * q', 1e-8,1);
10
11% Generate a random unit quaternion.
12% This represents a 3D rotation.
13q = randn(4,1);
14q = q / norm(q);
15
16% Now convert it to a rotation matrix,
17% and convert back to ensure these routines
18% are self-inverse
19R = vgg_quat_rotation_matrix(q);
20qback = vgg_quat_from_rotation_matrix(R);
21
22vgg_assert_equal(q, qback, -1e-8,1);
23
Note: See TracBrowser for help on using the repository browser.