source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/qtfm/test/test_fundamentals.m @ 37

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

Added original make3d

File size: 1.1 KB
Line 
1% Test code for the fundamental quaternion functions.
2
3% Copyright © 2005, 2006 Stephen J. Sangwine and Nicolas Le Bihan.
4% See the file : Copyright.m for further details.
5
6check(qi == q1, 'qi and q1 are not equal.');
7check(qj == q2, 'qj and q2 are not equal.');
8check(qk == q3, 'qk and q3 are not equal.');
9
10check(qi .* qj .* qk == -1, 'ijk is not -1.');
11
12check(abs(qi) == 1, 'abs(qi) is not 1');
13check(abs(qj) == 1, 'abs(qj) is not 1');
14check(abs(qk) == 1, 'abs(qk) is not 1');
15
16check(quaternion(1,1,1,1) == 1 + qi + qj + qk, 'Constructor error.');
17check(abs(quaternion(1,1,1,1)) == 2, 'abs(1,1,1,1) is not 2.');
18check(abs(quaternion(1,1,1,1)+quaternion(1,1,1,1).*i) == 2 + 2.*i,...
19                                     'abs error on complex value.');
20
21check(quaternion(5, 6, 7, 8) .* (1 + 2 .* qi + 3 .* qj + 4 .* qk) ...
22    - quaternion(-60,20,14,32) == 0, 'Error in simple multiplication.');
23
24compare(axis(quaternion(42,1,1,1)), axis(quaternion(3,3,3)), 1e-14,...
25    'Error in axis comparison.');
26                                                   
27% To be continued....
Note: See TracBrowser for help on using the repository browser.