source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/qtfm/@quaternion/conj.m @ 177

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

Added original make3d

File size: 1.2 KB
Line 
1function c = conj(a, F)
2% CONJ   Quaternion conjugate.
3% (Quaternion overloading of Matlab standard function.)
4%
5% Implements three different conjugates:
6%
7% conj(X) or
8% conj(X, 'hamilton') returns the quaternion conjugate.
9% conj(X, 'complex')  returns the complex conjugate.
10% conj(X, 'total')    returns the 'total' conjugate equivalent to
11%                     conj(conj(X, 'complex'), 'hamilton')
12
13% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
14% See the file : Copyright.m for further details.
15
16error(nargchk(1, 2, nargin)), error(nargoutchk(0, 1, nargout))
17
18if nargin == 1
19    F = 'hamilton'; % Supply the default parameter value.
20end
21
22if ~strcmp(F, 'hamilton') & ~strcmp(F, 'complex') & ~strcmp(F, 'total')
23    error('Second parameter value must be ''hamilton'', ''complex'' or ''total''.')
24end
25
26switch F
27    case 'hamilton'
28        if ispure(a)
29            c = -a;
30        else
31            c = quaternion(s(a), -x(a), -y(a), -z(a));
32        end
33    case 'complex'
34        if ispure(a)
35            c = quaternion(conj(x(a)), conj(y(a)), conj(z(a)));
36        else
37            c = conj(s(a)) + conj(v(a), 'complex');
38        end
39    case 'total'
40        c = conj(conj(a, 'complex'));
41    otherwise
42        error('Bad value for second parameter.');
43end
Note: See TracBrowser for help on using the repository browser.