changeset 962:21a498597eaa octave-forge

always return real angle
author etienne
date Tue, 03 Jun 2003 09:29:15 +0000
parents 09896bd1ff80
children 1068520a820d
files main/miscellaneous/rotparams.m
diffstat 1 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/main/miscellaneous/rotparams.m	Mon Jun 02 19:28:06 2003 +0000
+++ b/main/miscellaneous/rotparams.m	Tue Jun 03 09:29:15 2003 +0000
@@ -11,34 +11,34 @@
 ##  Ignores matrices with zero rows or with NaNs. (returns 0 for them)
 
 ## Author:        Etienne Grossmann  <etienne@isr.ist.utl.pt>
-## Last modified: Setembro 2002
 
-function [vstacked,astacked]=rotparams(rstacked)
+function [vstacked, astacked] = rotparams (rstacked)
 
-N = size(rstacked,1)/3;
+N = size (rstacked,1) / 3;
 
 ## ang = 0 ;
 ## if length(varargin),
 ##   if strcmp(varargin{1},'ang'),    ang = 1;  end
 ## end
-ok = all( ! isnan(rstacked') ) & any( rstacked' ) ;
-ok = min( reshape(ok,3,N) ) ;
-ok = find(ok) ;
+ok = all ( ! isnan (rstacked') ) & any ( rstacked' );
+ok = min ( reshape (ok,3,N) );
+ok = find (ok) ;
 ## keyboard
-vstacked = zeros(N,3);
-astacked = zeros(N,1);
+vstacked = zeros (N,3);
+astacked = zeros (N,1);
 for j = ok,
   r = rstacked(3*j-2:3*j,:);
-  [v,f]=eig(r); f=diag(f);
+  [v,f] = eig (r); 
+  f = diag(f);
 
-  [m,i]=min(abs(real(f)-1));
-  v=v(:,i);
+  [m,i] = min (abs (real (f)-1));
+  v = v(:,i);
 
-  w=null(v');
-  u=w(:,1);
+  w = null (v');
+  u = w(:,1);
   a = u'*r*u;
   if a<1,
-    a = acos(u'*r*u);
+    a = real (acos (u'*r*u));
   else
     a = 0;
   end