source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/qtfm/@quaternion/private/isocomplex.m @ 37

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

Added original make3d

File size: 771 bytes
Line 
1function z = isocomplex(q)
2% Construct a complex number from a quaternion, with the same modulus and
3% argument as those of the quaternion.
4
5% Copyright © 2006 Stephen J. Sangwine and Nicolas Le Bihan.
6% See the file : Copyright.m for further details.
7
8error(nargchk(1, 1, nargin)), error(nargoutchk(0, 1, nargout))
9
10% First extract the scalar part and the modulus of the vector part of the
11% quaternion array q.
12
13s =     scalar(q);
14v = abs(vector(q));
15
16% Either of both of s and v may be complex, in which case we cannot create
17% an isomorphic complex number.
18
19if isreal(s) & isreal(v)
20  z = complex(s, v);
21else
22    error('Private function isocomplex called with complex quaternion argument')
23end;
24
25% Notes: the result will always have an argument in the range 0 to pi.
Note: See TracBrowser for help on using the repository browser.