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

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

Added original make3d

File size: 802 bytes
Line 
1function p = convert(q, t)
2% CONVERT Convert elements of a quaternion to another type.
3%
4% This function converts a quaternion array into a quaternion array with
5% components of a different data type (e.g. int8, double, single).
6
7% Copyright © 2006 Stephen J. Sangwine and Nicolas Le Bihan.
8% See the file : Copyright.m for further details.
9
10error(nargchk(2, 2, nargin)), error(nargoutchk(0, 1, nargout))
11
12if ~ischar(t)
13    error('Second parameter must be a string.')
14end
15
16f = str2func(t); % Construct a function handle from t, which must denote
17                 % a function on the current Matlab path, so if it does
18                 % not, an error will occur here.
19if ispure(q)
20    p = quaternion(         f(x(q)), f(y(q)), f(z(q)));
21else
22    p = quaternion(f(s(q)), f(x(q)), f(y(q)), f(z(q)));
23end
Note: See TracBrowser for help on using the repository browser.