Rev | Line | |
---|
[37] | 1 | function c = cross(a, b) |
---|
| 2 | % CROSS (vector) product of two pure quaternions. |
---|
| 3 | |
---|
| 4 | % Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan. |
---|
| 5 | % See the file : Copyright.m for further details. |
---|
| 6 | |
---|
| 7 | if ~isa(a, 'quaternion') | ~isa(b, 'quaternion') |
---|
| 8 | error('Cross product is not defined for a quaternion and a non-quaternion.') |
---|
| 9 | end |
---|
| 10 | |
---|
| 11 | if ~ispure(a) | ~ispure(b) |
---|
| 12 | error('Cross product is defined only for pure quaternions.') |
---|
| 13 | end |
---|
| 14 | |
---|
| 15 | c = quaternion(y(a) .* z(b) - z(a) .* y(b), ... |
---|
| 16 | z(a) .* x(b) - x(a) .* z(b), ... |
---|
| 17 | x(a) .* y(b) - y(a) .* x(b)); |
---|
Note: See
TracBrowser
for help on using the repository browser.