% $URL: svn+ssh://aaron@birenboim.com/home/users/svn/Jansen/trunk/plotKlannOrbit.m $
% $Id: plotKlannOrbit.m 73 2013-05-18 15:23:58Z aaron $

% given a Klann orbit matrix, make a pretty plot set
function plotKlannOrbit(a)
% assuming two sets of orbits for a pair of legs...
n = size(a,1)/2
for k=1:n
   hold off;
   for i=2:2:2*n
     plotKlann(a(i,:),'c');
   end
   plot(a(:,11),a(:,12),'gd');  % foot orbit
   %kr = mod(k+floor(n/4)-1,n)+1;  % index for rear pair, 90deg out of phase
   kr = mod(k+floor(n/2)-1,n)+1;  % index for rear pair, 180deg out of phase
   plotKlann(a(  kr,:),'b',3);
   plotKlann(a(n+kr,:),'b',3);
   plot(a(kr,1),a(kr,2),'bo','markersize',7); % crank location
   plotKlann(a(  k,:),'r',3);
   plotKlann(a(n+k,:),'r',3);
   plot(a(k,1),a(k,2),'ro','markersize',7); % crank location
   plot([0,a(k,1),a(k,5),a(n+k,1),a(n+k,5)],...
        [0,a(k,2),a(k,6),a(n+k,2),a(n+k,6)],'ko');  % fixed point locations
   grid on;
   %axis(ax);
   axis equal;
   title(sprintf("%6.1f deg",((k-1)*360)/n));
   %print(sprintf('orbit%02d.png',k-1),'-S1024,768');
   %print(sprintf('orbit%02d.png',k-1)); % 1200x900, graph area significantly smaller than 1024x768
   %print(sprintf('orbit%02d.png',k-1),'-S1536,1152');
   print(sprintf('orbit%02d.png',k-1),'-S1280,1024');
end
end
