% given a Theo Jansen orbit matrix, make a pretty plot set
function plotJansenOrbit(a)
% assuming two sets of orbits for a pair of legs...
n = size(a,1)/2
ax = [-110,110,-90,45];
for k=1:n
   hold off;
   for i=1:2:2*n
     plotJansen(a(i,:),'c');
   end
   plot(a(:,13),a(:,14),'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
   plotJansen(a(  kr,:),'b',3);
   plotJansen(a(n+kr,:),'b',3);
   plot(a(kr,5),a(kr,6),'bo','markersize',7); % crank location
   plotJansen(a(  k,:),'r',3);
   plotJansen(a(n+k,:),'r',3);
   plot(a(k,5),a(k,6),'ro','markersize',7); % crank location
   plot(a(1,3)*[-1,1],[0,0],'ko');  % fixed point B location
   plot(0,a(1,2),'ko');  % crank center
   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
