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

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

Added original make3d

File size: 1.2 KB
Line 
1function c = horzcat(varargin)
2% HORZCAT Horizontal concatenation.
3% (Quaternion overloading of standard Matlab function.)
4
5% Copyright © 2005 Stephen J. Sangwine and Nicolas Le Bihan.
6% See the file : Copyright.m for further details.
7
8if length(varargin) == 1
9    c = varargin{1}; % We have been passed one argument, nothing to do!
10    return
11end
12
13% This is implemented recursively for simplicity, as it is unlikely to be
14% used for more than a few arguments.
15
16a = varargin{1};
17b = varargin{2};
18
19if isempty(b)
20    c = a; return;
21elseif isempty(a)
22    c = b; return;
23end
24
25if ~isa(a, 'quaternion') | ~isa(b, 'quaternion')
26    % We probably could handle this but for now we don't ...
27    error('Cannot concatenate quaternion with non-quaternion arrays.')
28end
29
30if xor(ispure(a), ispure(b))
31    % Again, we could do it, but the code would be more complex ...
32    error('Arrays to be concatenated must be both pure or both full.');
33end
34
35if ispure(a) & ispure(b)
36    c = quaternion(             [x(a) x(b)], [y(a) y(b)], [z(a) z(b)]);
37else
38    c = quaternion([s(a) s(b)], [x(a) x(b)], [y(a) y(b)], [z(a) z(b)]);
39end
40
41if length(varargin) == 2
42    return
43else
44    c = horzcat(c, varargin{3:end});
45end
Note: See TracBrowser for help on using the repository browser.