Rev | Line | |
---|
[37] | 1 | function x = scalar(q) |
---|
| 2 | % SCALAR Quaternion scalar part. |
---|
| 3 | % |
---|
| 4 | % This function returns zero in the case of pure quaternions, |
---|
| 5 | % whereas the function S gives an error if q is pure. |
---|
| 6 | |
---|
| 7 | % Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan. |
---|
| 8 | % See the file : Copyright.m for further details. |
---|
| 9 | |
---|
| 10 | error(nargchk(1, 1, nargin)), error(nargoutchk(0, 1, nargout)) |
---|
| 11 | |
---|
| 12 | % A possible problem here: zeros will return a double array |
---|
| 13 | % and if Q has some other type, the result will not be of the |
---|
| 14 | % same type. |
---|
| 15 | |
---|
| 16 | if ispure(q) |
---|
| 17 | x = zeros(size(q)); |
---|
| 18 | else |
---|
| 19 | x = s(q); |
---|
| 20 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.