changeset 8905:cac88c349f8f octave-forge

quaternion_oo: style fixes
author paramaniac
date Mon, 14 Nov 2011 16:24:51 +0000
parents 7b028c9e612a
children c0bfe654cd65
files extra/quaternion_oo/inst/@quaternion/dot.m
diffstat 1 files changed, 42 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/extra/quaternion_oo/inst/@quaternion/dot.m	Mon Nov 14 16:03:08 2011 +0000
+++ b/extra/quaternion_oo/inst/@quaternion/dot.m	Mon Nov 14 16:24:51 2011 +0000
@@ -1,41 +1,41 @@
-%% Copyright (c) 1998, 2000, 2005, 2007 Auburn University.
-%% Copyright (c) 2011 Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
-%%
-%%    This program is free software: you can redistribute it and/or modify
-%%    it under the terms of the GNU General Public License as published by
-%%    the Free Software Foundation, either version 3 of the License, or
-%%    any later version.
-%%
-%%    This program is distributed in the hope that it will be useful,
-%%    but WITHOUT ANY WARRANTY; without even the implied warranty of
-%%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%%    GNU General Public License for more details.
-%%
-%%    You should have received a copy of the GNU General Public License
-%%    along with this program. If not, see <http://www.gnu.org/licenses/>.
+## Copyright (c) 1998, 2000, 2005, 2007 Auburn University.
+## Copyright (c) 2011 Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-%% -*- texinfo -*-
-%% @deftypefn {Function File} {} dot (q, omega)
-%% Derivative of a quaternion.
-%%
-%% Let Q be a quaternion to transform a vector from a fixed frame to
-%% a rotating frame.  If the rotating frame is rotating about the
-%% [x, y, z] axes at angular rates [wx, wy, wz], then the derivative
-%% of Q is given by
-%%
-%% @example
-%% Q' = dot(Q, omega)
-%% @end example
-%%
-%% If the passive convention is used (rotate the frame, not the vector),
-%% then
-%%
-%% @example
-%% Q' = dot(Q,-omega)
-%% @end example
-%% @end deftypefn
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{qdot} =} dot (@var{q}, @var{omega})
+## Derivative of a quaternion.
+##
+## Let Q be a quaternion to transform a vector from a fixed frame to
+## a rotating frame.  If the rotating frame is rotating about the
+## [x, y, z] axes at angular rates [wx, wy, wz], then the derivative
+## of Q is given by
+##
+## @example
+## Q' = dot(Q, omega)
+## @end example
+##
+## If the passive convention is used (rotate the frame, not the vector),
+## then
+##
+## @example
+## Q' = dot(Q,-omega)
+## @end example
+## @end deftypefn
 
-%% Adapted from: qderiv by A. S. Hodel <a.s.hodel@eng.auburn.edu>
+## Adapted from: qderiv by A. S. Hodel <a.s.hodel@eng.auburn.edu>
 
 function qd = dot (q, Omega)
 
@@ -43,13 +43,17 @@
     print_usage ();
   endif
 
+  if (! isa (q, "quaternion") || ! isscalar (q.w))
+    error ("quaternion: first argument ""%s"" must be a scalar quaternion", inputname(1));
+  endif
+
   Omega = vec (Omega);
 
   if (length (Omega) != 3)
-    error ("Quaternion:InvalidArgument: Omega must be a length 3 vector");
+    error ("quaternion: second argument ""%s"" must be a length 3 vector", inputname(2));
   endif
 
-  qd = 0.5 * quaternion(Omega(1),Omega(2),Omega(3)) * q;
+  qd = 0.5 * quaternion (Omega(1), Omega(2), Omega(3)) * q;
 
 endfunction