3452
|
1 ## Copyright (C) 1998 Auburn University. All rights reserved. |
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
3452
|
9 ## |
|
10 ## Octave is distributed in the hope that it will be useful, but |
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 ## General Public License for more details. |
|
14 ## |
|
15 ## You should have received a copy of the GNU General Public License |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
3224
|
18 |
3452
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Function File} {} qtrans (@var{v}, @var{q}) |
|
21 ## Transform the unit quaternion @var{v} by the unit quaternion @var{q}. |
|
22 ## Returns @code{@var{v} = @var{q}*@var{v}/@var{q}}. |
|
23 ## @end deftypefn |
|
24 |
|
25 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
|
26 ## Adapted-By: jwe |
3224
|
27 |
3452
|
28 function v = qtrans (v, q) |
|
29 |
4030
|
30 if (! isvector (v) || length (v) != 4) |
3452
|
31 error ("qtrans: v(%d,%d) must be a quaternion", rows (v), columns (v)); |
4030
|
32 elseif (! isvector (q) || length (q) != 4) |
3452
|
33 error ("qtrans: q(%d,%d) must be a quaternion", rows (q), columns (q)); |
|
34 endif |
|
35 |
|
36 v = qmult (q, qmult (v, qinv (q))); |
|
37 |
|
38 endfunction |