Last change
on this file since 177 was
37,
checked in by (none), 15 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
535 bytes
|
Line | |
---|
1 |
|
---|
2 |
|
---|
3 | % Make some synthetic quaternions
|
---|
4 | syms q0 q1 q2 q3 p0 p1 p2 p3 real
|
---|
5 |
|
---|
6 | q = [q0 q1 q2 q3]';
|
---|
7 | p = [p0 p1 p2 p3]';
|
---|
8 |
|
---|
9 | vgg_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.
|
---|
13 | q = randn(4,1);
|
---|
14 | q = q / norm(q);
|
---|
15 |
|
---|
16 | % Now convert it to a rotation matrix,
|
---|
17 | % and convert back to ensure these routines
|
---|
18 | % are self-inverse
|
---|
19 | R = vgg_quat_rotation_matrix(q);
|
---|
20 | qback = vgg_quat_from_rotation_matrix(R);
|
---|
21 |
|
---|
22 | vgg_assert_equal(q, qback, -1e-8,1);
|
---|
23 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.